Importer-Exporter.js 83 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007
  1. define("amber_core/Importer-Exporter", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects", "amber_core/Kernel-Infrastructure"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Importer-Exporter');
  3. smalltalk.packages["Importer-Exporter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AbstractExporter', smalltalk.Object, [], 'Importer-Exporter');
  5. smalltalk.AbstractExporter.comment="I am an abstract exporter for Amber source code.\x0a\x0a## API\x0a\x0aUse `#exportPackage:on:` to export a given package on a Stream.";
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "chunkEscape:",
  9. category: 'convenience',
  10. fn: function (aString){
  11. var self=this;
  12. return smalltalk.withContext(function($ctx1) {
  13. var $1;
  14. $1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
  15. return $1;
  16. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},smalltalk.AbstractExporter)})},
  17. args: ["aString"],
  18. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^(aString replace: '!' with: '!!') trimBoth",
  19. messageSends: ["trimBoth", "replace:with:"],
  20. referencedClasses: []
  21. }),
  22. smalltalk.AbstractExporter);
  23. smalltalk.addMethod(
  24. smalltalk.method({
  25. selector: "classNameFor:",
  26. category: 'convenience',
  27. fn: function (aClass){
  28. var self=this;
  29. return smalltalk.withContext(function($ctx1) {
  30. var $2,$3,$1;
  31. $2=_st(aClass)._isMetaclass();
  32. if(smalltalk.assert($2)){
  33. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(" class");
  34. } else {
  35. $3=_st(aClass)._isNil();
  36. if(smalltalk.assert($3)){
  37. $1="nil";
  38. } else {
  39. $1=_st(aClass)._name();
  40. };
  41. };
  42. return $1;
  43. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.AbstractExporter)})},
  44. args: ["aClass"],
  45. source: "classNameFor: aClass\x0a\x09^aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, ' class' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass isNil\x0a\x09\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09\x09ifFalse: [ aClass name ] ]",
  46. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"],
  47. referencedClasses: []
  48. }),
  49. smalltalk.AbstractExporter);
  50. smalltalk.addMethod(
  51. smalltalk.method({
  52. selector: "exportPackage:on:",
  53. category: 'output',
  54. fn: function (aPackage,aStream){
  55. var self=this;
  56. return smalltalk.withContext(function($ctx1) {
  57. self._subclassResponsibility();
  58. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AbstractExporter)})},
  59. args: ["aPackage", "aStream"],
  60. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  61. messageSends: ["subclassResponsibility"],
  62. referencedClasses: []
  63. }),
  64. smalltalk.AbstractExporter);
  65. smalltalk.addMethod(
  66. smalltalk.method({
  67. selector: "extensionMethodsOfPackage:",
  68. category: 'accessing',
  69. fn: function (aPackage){
  70. var self=this;
  71. var result;
  72. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  73. return smalltalk.withContext(function($ctx1) {
  74. var $1;
  75. result=_st($OrderedCollection())._new();
  76. _st(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  77. return smalltalk.withContext(function($ctx2) {
  78. return _st(result)._addAll_(_st(each)._methods());
  79. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  80. $1=result;
  81. return $1;
  82. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},smalltalk.AbstractExporter)})},
  83. args: ["aPackage"],
  84. source: "extensionMethodsOfPackage: aPackage\x0a\x09| result |\x0a\x09\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09(self extensionProtocolsOfPackage: aPackage) do: [ :each |\x0a\x09\x09result addAll: each methods ].\x0a\x09\x09\x0a\x09^ result",
  85. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"],
  86. referencedClasses: ["OrderedCollection"]
  87. }),
  88. smalltalk.AbstractExporter);
  89. smalltalk.addMethod(
  90. smalltalk.method({
  91. selector: "extensionProtocolsOfPackage:",
  92. category: 'accessing',
  93. fn: function (aPackage){
  94. var self=this;
  95. var extensionName,result;
  96. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  97. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  98. function $ExportMethodProtocol(){return smalltalk.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  99. return smalltalk.withContext(function($ctx1) {
  100. var $1,$2;
  101. extensionName="*".__comma(_st(aPackage)._name());
  102. result=_st($OrderedCollection())._new();
  103. _st(_st(_st($Smalltalk())._current())._classes())._do_((function(each){
  104. return smalltalk.withContext(function($ctx2) {
  105. return _st([each,_st(each)._class()])._do_((function(behavior){
  106. return smalltalk.withContext(function($ctx3) {
  107. $1=_st(_st(behavior)._protocols())._includes_(extensionName);
  108. if(smalltalk.assert($1)){
  109. return _st(result)._add_(_st($ExportMethodProtocol())._name_theClass_(extensionName,behavior));
  110. };
  111. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,2)})}));
  112. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  113. $2=result;
  114. return $2;
  115. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},smalltalk.AbstractExporter)})},
  116. args: ["aPackage"],
  117. source: "extensionProtocolsOfPackage: aPackage\x0a\x09| extensionName result |\x0a\x09\x0a\x09extensionName := '*', aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09\x22The classes must be loaded since it is extensions only.\x0a\x09Therefore sorting (dependency resolution) does not matter here.\x0a\x09Not sorting improves the speed by a number of magnitude.\x22\x0a\x09\x0a\x09Smalltalk current classes do: [ :each |\x0a\x09\x09{each. each class} do: [ :behavior |\x0a\x09\x09\x09(behavior protocols includes: extensionName) ifTrue: [\x0a\x09\x09\x09\x09result add: (ExportMethodProtocol name: extensionName theClass: behavior) ] ] ].\x0a\x0a\x09^result",
  118. messageSends: [",", "name", "new", "do:", "classes", "current", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"],
  119. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"]
  120. }),
  121. smalltalk.AbstractExporter);
  122. smalltalk.addClass('ChunkExporter', smalltalk.AbstractExporter, [], 'Importer-Exporter');
  123. smalltalk.ChunkExporter.comment="I am an exporter dedicated to outputting Amber source code in the classic Smalltalk chunk format.\x0a\x0aI do not output any compiled code.";
  124. smalltalk.addMethod(
  125. smalltalk.method({
  126. selector: "exportCategoryEpilogueOf:on:",
  127. category: 'output',
  128. fn: function (aCategory,aStream){
  129. var self=this;
  130. return smalltalk.withContext(function($ctx1) {
  131. var $1,$2;
  132. $1=aStream;
  133. _st($1)._nextPutAll_(" !");
  134. _st($1)._lf();
  135. $2=_st($1)._lf();
  136. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},smalltalk.ChunkExporter)})},
  137. args: ["aCategory", "aStream"],
  138. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  139. messageSends: ["nextPutAll:", "lf"],
  140. referencedClasses: []
  141. }),
  142. smalltalk.ChunkExporter);
  143. smalltalk.addMethod(
  144. smalltalk.method({
  145. selector: "exportCategoryPrologueOf:on:",
  146. category: 'output',
  147. fn: function (aCategory,aStream){
  148. var self=this;
  149. return smalltalk.withContext(function($ctx1) {
  150. var $1,$2;
  151. $1=aStream;
  152. _st($1)._nextPutAll_("!".__comma(self._classNameFor_(_st(aCategory)._theClass())));
  153. $2=_st($1)._nextPutAll_(_st(" methodsFor: '".__comma(_st(aCategory)._name())).__comma("'!"));
  154. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},smalltalk.ChunkExporter)})},
  155. args: ["aCategory", "aStream"],
  156. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  157. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"],
  158. referencedClasses: []
  159. }),
  160. smalltalk.ChunkExporter);
  161. smalltalk.addMethod(
  162. smalltalk.method({
  163. selector: "exportDefinitionOf:on:",
  164. category: 'output',
  165. fn: function (aClass,aStream){
  166. var self=this;
  167. return smalltalk.withContext(function($ctx1) {
  168. var $1,$2,$3,$4,$5,$6,$7;
  169. $1=aStream;
  170. _st($1)._nextPutAll_(self._classNameFor_(_st(aClass)._superclass()));
  171. _st($1)._nextPutAll_(" subclass: #".__comma(self._classNameFor_(aClass)));
  172. _st($1)._lf();
  173. _st($1)._tab();
  174. $2=_st($1)._nextPutAll_("instanceVariableNames: '");
  175. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  176. return smalltalk.withContext(function($ctx2) {
  177. return _st(aStream)._nextPutAll_(each);
  178. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  179. return smalltalk.withContext(function($ctx2) {
  180. return _st(aStream)._nextPutAll_(" ");
  181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  182. $3=aStream;
  183. _st($3)._nextPutAll_("'");
  184. _st($3)._lf();
  185. _st($3)._tab();
  186. _st($3)._nextPutAll_(_st("package: '".__comma(_st(aClass)._category())).__comma("'!"));
  187. $4=_st($3)._lf();
  188. $5=_st(_st(aClass)._comment())._notEmpty();
  189. if(smalltalk.assert($5)){
  190. $6=aStream;
  191. _st($6)._nextPutAll_(_st("!".__comma(self._classNameFor_(aClass))).__comma(" commentStamp!"));
  192. _st($6)._lf();
  193. _st($6)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
  194. $7=_st($6)._lf();
  195. $7;
  196. };
  197. _st(aStream)._lf();
  198. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  199. args: ["aClass", "aStream"],
  200. source: "exportDefinitionOf: aClass on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ' subclass: #', (self classNameFor: aClass); lf;\x0a\x09\x09tab; nextPutAll: 'instanceVariableNames: '''.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [:each | aStream nextPutAll: each]\x0a\x09\x09separatedBy: [aStream nextPutAll: ' '].\x0a\x09aStream\x0a\x09\x09nextPutAll: ''''; lf;\x0a\x09\x09tab; nextPutAll: 'package: ''', aClass category, '''!'; lf.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aClass), ' commentStamp!';lf;\x0a\x09\x09nextPutAll: (self chunkEscape: aClass comment), '!';lf].\x0a\x09aStream lf",
  201. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"],
  202. referencedClasses: []
  203. }),
  204. smalltalk.ChunkExporter);
  205. smalltalk.addMethod(
  206. smalltalk.method({
  207. selector: "exportMetaDefinitionOf:on:",
  208. category: 'output',
  209. fn: function (aClass,aStream){
  210. var self=this;
  211. return smalltalk.withContext(function($ctx1) {
  212. var $1,$2,$3,$4,$5;
  213. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  214. if(! smalltalk.assert($1)){
  215. $2=aStream;
  216. _st($2)._nextPutAll_(self._classNameFor_(_st(aClass)._class()));
  217. $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
  218. $3;
  219. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  220. return smalltalk.withContext(function($ctx2) {
  221. return _st(aStream)._nextPutAll_(each);
  222. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  223. return smalltalk.withContext(function($ctx2) {
  224. return _st(aStream)._nextPutAll_(" ");
  225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  226. $4=aStream;
  227. _st($4)._nextPutAll_("'!");
  228. _st($4)._lf();
  229. $5=_st($4)._lf();
  230. $5;
  231. };
  232. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  233. args: ["aClass", "aStream"],
  234. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: (self classNameFor: aClass class);\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09\x09do: [:each | aStream nextPutAll: each]\x0a\x09\x09\x09separatedBy: [aStream nextPutAll: ' '].\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '''!'; lf; lf]",
  235. messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"],
  236. referencedClasses: []
  237. }),
  238. smalltalk.ChunkExporter);
  239. smalltalk.addMethod(
  240. smalltalk.method({
  241. selector: "exportMethod:on:",
  242. category: 'output',
  243. fn: function (aMethod,aStream){
  244. var self=this;
  245. return smalltalk.withContext(function($ctx1) {
  246. var $1,$2;
  247. $1=aStream;
  248. _st($1)._lf();
  249. _st($1)._lf();
  250. _st($1)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
  251. _st($1)._lf();
  252. $2=_st($1)._nextPutAll_("!");
  253. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.ChunkExporter)})},
  254. args: ["aMethod", "aStream"],
  255. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  256. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"],
  257. referencedClasses: []
  258. }),
  259. smalltalk.ChunkExporter);
  260. smalltalk.addMethod(
  261. smalltalk.method({
  262. selector: "exportPackage:on:",
  263. category: 'output',
  264. fn: function (aPackage,aStream){
  265. var self=this;
  266. return smalltalk.withContext(function($ctx1) {
  267. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  268. _st(_st(aPackage)._sortedClasses())._do_((function(each){
  269. return smalltalk.withContext(function($ctx2) {
  270. self._exportDefinitionOf_on_(each,aStream);
  271. self._exportProtocols_on_(self._ownMethodProtocolsOfClass_(each),aStream);
  272. self._exportMetaDefinitionOf_on_(each,aStream);
  273. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_(_st(each)._class()),aStream);
  274. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  275. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  276. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},smalltalk.ChunkExporter)})},
  277. args: ["aPackage", "aStream"],
  278. source: "exportPackage: aPackage on: aStream\x0a\x0a\x09self exportPackageDefinitionOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each)\x0a\x09\x09\x09on: aStream.\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each class)\x0a\x09\x09\x09on: aStream ].\x0a\x09\x09\x09\x0a\x09self \x0a\x09\x09exportProtocols: (self extensionProtocolsOfPackage: aPackage)\x0a\x09\x09on: aStream",
  279. messageSends: ["exportPackageDefinitionOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"],
  280. referencedClasses: []
  281. }),
  282. smalltalk.ChunkExporter);
  283. smalltalk.addMethod(
  284. smalltalk.method({
  285. selector: "exportPackageDefinitionOf:on:",
  286. category: 'output',
  287. fn: function (aPackage,aStream){
  288. var self=this;
  289. return smalltalk.withContext(function($ctx1) {
  290. var $1,$2;
  291. $1=aStream;
  292. _st($1)._nextPutAll_(_st("Smalltalk current createPackage: '".__comma(_st(aPackage)._name())).__comma("'!"));
  293. $2=_st($1)._lf();
  294. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.ChunkExporter)})},
  295. args: ["aPackage", "aStream"],
  296. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk current createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  297. messageSends: ["nextPutAll:", ",", "name", "lf"],
  298. referencedClasses: []
  299. }),
  300. smalltalk.ChunkExporter);
  301. smalltalk.addMethod(
  302. smalltalk.method({
  303. selector: "exportProtocol:on:",
  304. category: 'output',
  305. fn: function (aProtocol,aStream){
  306. var self=this;
  307. return smalltalk.withContext(function($ctx1) {
  308. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  309. _st(_st(aProtocol)._methods())._do_((function(method){
  310. return smalltalk.withContext(function($ctx2) {
  311. return self._exportMethod_on_(method,aStream);
  312. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)})}));
  313. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  314. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},smalltalk.ChunkExporter)})},
  315. args: ["aProtocol", "aStream"],
  316. source: "exportProtocol: aProtocol on: aStream\x0a\x09self exportProtocolPrologueOf: aProtocol on: aStream.\x0a\x09aProtocol methods do: [ :method | \x0a\x09\x09self exportMethod: method on: aStream ].\x0a\x09self exportProtocolEpilogueOf: aProtocol on: aStream",
  317. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"],
  318. referencedClasses: []
  319. }),
  320. smalltalk.ChunkExporter);
  321. smalltalk.addMethod(
  322. smalltalk.method({
  323. selector: "exportProtocolEpilogueOf:on:",
  324. category: 'output',
  325. fn: function (aProtocol,aStream){
  326. var self=this;
  327. return smalltalk.withContext(function($ctx1) {
  328. var $1,$2;
  329. $1=aStream;
  330. _st($1)._nextPutAll_(" !");
  331. _st($1)._lf();
  332. $2=_st($1)._lf();
  333. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},smalltalk.ChunkExporter)})},
  334. args: ["aProtocol", "aStream"],
  335. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  336. messageSends: ["nextPutAll:", "lf"],
  337. referencedClasses: []
  338. }),
  339. smalltalk.ChunkExporter);
  340. smalltalk.addMethod(
  341. smalltalk.method({
  342. selector: "exportProtocolPrologueOf:on:",
  343. category: 'output',
  344. fn: function (aProtocol,aStream){
  345. var self=this;
  346. return smalltalk.withContext(function($ctx1) {
  347. var $1,$2;
  348. $1=aStream;
  349. _st($1)._nextPutAll_("!".__comma(self._classNameFor_(_st(aProtocol)._theClass())));
  350. $2=_st($1)._nextPutAll_(_st(" methodsFor: '".__comma(_st(aProtocol)._name())).__comma("'!"));
  351. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},smalltalk.ChunkExporter)})},
  352. args: ["aProtocol", "aStream"],
  353. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  354. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"],
  355. referencedClasses: []
  356. }),
  357. smalltalk.ChunkExporter);
  358. smalltalk.addMethod(
  359. smalltalk.method({
  360. selector: "exportProtocols:on:",
  361. category: 'output',
  362. fn: function (aCollection,aStream){
  363. var self=this;
  364. return smalltalk.withContext(function($ctx1) {
  365. _st(aCollection)._do_((function(each){
  366. return smalltalk.withContext(function($ctx2) {
  367. return self._exportProtocol_on_(each,aStream);
  368. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  369. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},smalltalk.ChunkExporter)})},
  370. args: ["aCollection", "aStream"],
  371. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  372. messageSends: ["do:", "exportProtocol:on:"],
  373. referencedClasses: []
  374. }),
  375. smalltalk.ChunkExporter);
  376. smalltalk.addMethod(
  377. smalltalk.method({
  378. selector: "extensionCategoriesOfPackage:",
  379. category: 'accessing',
  380. fn: function (aPackage){
  381. var self=this;
  382. var name,map,result;
  383. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  384. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  385. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  386. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  387. function $MethodCategory(){return smalltalk.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  388. return smalltalk.withContext(function($ctx1) {
  389. var $1,$2;
  390. name=_st(aPackage)._name();
  391. result=_st($OrderedCollection())._new();
  392. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  393. return smalltalk.withContext(function($ctx2) {
  394. return _st([each,_st(each)._class()])._do_((function(aClass){
  395. return smalltalk.withContext(function($ctx3) {
  396. map=_st($Dictionary())._new();
  397. map;
  398. _st(aClass)._protocolsDo_((function(category,methods){
  399. return smalltalk.withContext(function($ctx4) {
  400. $1=_st(category).__eq("*".__comma(name));
  401. if(smalltalk.assert($1)){
  402. return _st(map)._at_put_(category,methods);
  403. };
  404. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)})}));
  405. return _st(result)._addAll_(_st(_st(_st(map)._keys())._sorted_((function(a,b){
  406. return smalltalk.withContext(function($ctx4) {
  407. return _st(a).__lt_eq(b);
  408. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)})})))._collect_((function(category){
  409. return smalltalk.withContext(function($ctx4) {
  410. return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
  411. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)})})));
  412. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)})}));
  413. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  414. $2=result;
  415. return $2;
  416. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},smalltalk.ChunkExporter)})},
  417. args: ["aPackage"],
  418. source: "extensionCategoriesOfPackage: aPackage\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk current classes) do: [ :each |\x0a\x09\x09{each. each class} do: [ :aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [ :category :methods |\x0a\x09\x09\x09\x09category = ('*', name) ifTrue: [ map at: category put: methods ] ].\x0a\x09\x09\x09result addAll: ((map keys sorted: [:a :b | a <= b ]) collect: [ :category |\x0a\x09\x09\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category) ]) ] ].\x0a\x09^result",
  419. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "current", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"],
  420. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"]
  421. }),
  422. smalltalk.ChunkExporter);
  423. smalltalk.addMethod(
  424. smalltalk.method({
  425. selector: "ownCategoriesOfClass:",
  426. category: 'accessing',
  427. fn: function (aClass){
  428. var self=this;
  429. var map;
  430. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  431. function $MethodCategory(){return smalltalk.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  432. return smalltalk.withContext(function($ctx1) {
  433. var $1,$2;
  434. map=_st($Dictionary())._new();
  435. _st(aClass)._protocolsDo_((function(each,methods){
  436. return smalltalk.withContext(function($ctx2) {
  437. $1=_st(each)._match_("^\x5c*");
  438. if(! smalltalk.assert($1)){
  439. return _st(map)._at_put_(each,methods);
  440. };
  441. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)})}));
  442. $2=_st(_st(_st(map)._keys())._sorted_((function(a,b){
  443. return smalltalk.withContext(function($ctx2) {
  444. return _st(a).__lt_eq(b);
  445. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})})))._collect_((function(each){
  446. return smalltalk.withContext(function($ctx2) {
  447. return _st($MethodCategory())._name_theClass_methods_(each,aClass,_st(map)._at_(each));
  448. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  449. return $2;
  450. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},smalltalk.ChunkExporter)})},
  451. args: ["aClass"],
  452. source: "ownCategoriesOfClass: aClass\x0a\x09\x22Answer the protocols of aClass that are not package extensions\x22\x0a\x09\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| map |\x0a\x09map := Dictionary new.\x0a\x09aClass protocolsDo: [ :each :methods |\x0a\x09\x09(each match: '^\x5c*') ifFalse: [ map at: each put: methods ] ].\x0a\x09^(map keys sorted: [:a :b | a <= b ]) collect: [ :each |\x0a\x09\x09MethodCategory name: each theClass: aClass methods: (map at: each) ]",
  453. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"],
  454. referencedClasses: ["Dictionary", "MethodCategory"]
  455. }),
  456. smalltalk.ChunkExporter);
  457. smalltalk.addMethod(
  458. smalltalk.method({
  459. selector: "ownCategoriesOfMetaClass:",
  460. category: 'accessing',
  461. fn: function (aClass){
  462. var self=this;
  463. return smalltalk.withContext(function($ctx1) {
  464. var $1;
  465. $1=self._ownCategoriesOfClass_(_st(aClass)._class());
  466. return $1;
  467. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},smalltalk.ChunkExporter)})},
  468. args: ["aClass"],
  469. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^self ownCategoriesOfClass: aClass class",
  470. messageSends: ["ownCategoriesOfClass:", "class"],
  471. referencedClasses: []
  472. }),
  473. smalltalk.ChunkExporter);
  474. smalltalk.addMethod(
  475. smalltalk.method({
  476. selector: "ownMethodProtocolsOfClass:",
  477. category: 'accessing',
  478. fn: function (aClass){
  479. var self=this;
  480. function $ExportMethodProtocol(){return smalltalk.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  481. return smalltalk.withContext(function($ctx1) {
  482. var $1;
  483. $1=_st(_st(aClass)._ownProtocols())._collect_((function(each){
  484. return smalltalk.withContext(function($ctx2) {
  485. return _st($ExportMethodProtocol())._name_theClass_(each,aClass);
  486. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  487. return $1;
  488. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},smalltalk.ChunkExporter)})},
  489. args: ["aClass"],
  490. source: "ownMethodProtocolsOfClass: aClass\x0a\x09\x22Answer a collection of ExportMethodProtocol object of aClass that are not package extensions\x22\x0a\x09\x0a\x09^ aClass ownProtocols collect: [ :each |\x0a\x09\x09ExportMethodProtocol name: each theClass: aClass ]",
  491. messageSends: ["collect:", "ownProtocols", "name:theClass:"],
  492. referencedClasses: ["ExportMethodProtocol"]
  493. }),
  494. smalltalk.ChunkExporter);
  495. smalltalk.addClass('Exporter', smalltalk.AbstractExporter, [], 'Importer-Exporter');
  496. smalltalk.Exporter.comment="I am responsible for outputting Amber code into a JavaScript string.\x0a\x0aThe generated output is enough to reconstruct the exported data, including Smalltalk source code and other metadata.\x0a\x0a## Use case\x0a\x0aI am typically used to save code outside of the Amber runtime (committing to disk, etc.).";
  497. smalltalk.addMethod(
  498. smalltalk.method({
  499. selector: "classNameFor:",
  500. category: 'convenience',
  501. fn: function (aClass){
  502. var self=this;
  503. return smalltalk.withContext(function($ctx1) {
  504. var $2,$3,$1;
  505. $2=_st(aClass)._isMetaclass();
  506. if(smalltalk.assert($2)){
  507. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(".klass");
  508. } else {
  509. $3=_st(aClass)._isNil();
  510. if(smalltalk.assert($3)){
  511. $1="nil";
  512. } else {
  513. $1=_st(aClass)._name();
  514. };
  515. };
  516. return $1;
  517. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.Exporter)})},
  518. args: ["aClass"],
  519. source: "classNameFor: aClass\x0a\x09^aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass isNil\x0a\x09\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09\x09ifFalse: [ aClass name ] ]",
  520. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"],
  521. referencedClasses: []
  522. }),
  523. smalltalk.Exporter);
  524. smalltalk.addMethod(
  525. smalltalk.method({
  526. selector: "exportDefinitionOf:on:",
  527. category: 'output',
  528. fn: function (aClass,aStream){
  529. var self=this;
  530. return smalltalk.withContext(function($ctx1) {
  531. var $1,$2,$3,$4,$5,$6,$7;
  532. $1=aStream;
  533. _st($1)._lf();
  534. _st($1)._nextPutAll_("smalltalk.addClass(");
  535. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  536. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  537. $2=_st($1)._nextPutAll_(", [");
  538. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  539. return smalltalk.withContext(function($ctx2) {
  540. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  541. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  542. return smalltalk.withContext(function($ctx2) {
  543. return _st(aStream)._nextPutAll_(", ");
  544. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  545. $3=aStream;
  546. _st($3)._nextPutAll_("], '");
  547. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  548. $4=_st($3)._nextPutAll_(");");
  549. $5=_st(_st(aClass)._comment())._notEmpty();
  550. if(smalltalk.assert($5)){
  551. $6=aStream;
  552. _st($6)._lf();
  553. _st($6)._nextPutAll_("smalltalk.");
  554. _st($6)._nextPutAll_(self._classNameFor_(aClass));
  555. _st($6)._nextPutAll_(".comment=");
  556. _st($6)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
  557. $7=_st($6)._nextPutAll_(";");
  558. $7;
  559. };
  560. _st(aStream)._lf();
  561. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  562. args: ["aClass", "aStream"],
  563. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'smalltalk.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09\x09separatedBy: [aStream nextPutAll: ', '].\x0a\x09aStream\x0a\x09\x09nextPutAll: '], ''';\x0a\x09\x09nextPutAll: aClass category, '''';\x0a\x09\x09nextPutAll: ');'.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09nextPutAll: 'smalltalk.';\x0a\x09\x09nextPutAll: (self classNameFor: aClass);\x0a\x09\x09nextPutAll: '.comment=';\x0a\x09\x09nextPutAll: aClass comment asJavascript;\x0a\x09\x09nextPutAll: ';'].\x0a\x09aStream lf",
  564. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript"],
  565. referencedClasses: []
  566. }),
  567. smalltalk.Exporter);
  568. smalltalk.addMethod(
  569. smalltalk.method({
  570. selector: "exportMetaDefinitionOf:on:",
  571. category: 'output',
  572. fn: function (aClass,aStream){
  573. var self=this;
  574. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  575. return smalltalk.withContext(function($ctx1) {
  576. var $1,$2,$3;
  577. _st(aStream)._lf();
  578. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  579. if(! smalltalk.assert($1)){
  580. $2=aStream;
  581. _st($2)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._class())));
  582. $3=_st($2)._nextPutAll_(".iVarNames = [");
  583. $3;
  584. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  585. return smalltalk.withContext(function($ctx2) {
  586. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  587. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  588. return smalltalk.withContext(function($ctx2) {
  589. return _st(aStream)._nextPutAll_(",");
  590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  591. _st(aStream)._nextPutAll_("];".__comma(_st($String())._lf()));
  592. };
  593. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  594. args: ["aClass", "aStream"],
  595. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass class);\x0a\x09\x09nextPutAll: '.iVarNames = ['.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09\x09separatedBy: [aStream nextPutAll: ','].\x0a\x09\x09aStream nextPutAll: '];', String lf]",
  596. messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", ",", "classNameFor:", "do:separatedBy:"],
  597. referencedClasses: ["String"]
  598. }),
  599. smalltalk.Exporter);
  600. smalltalk.addMethod(
  601. smalltalk.method({
  602. selector: "exportMethod:on:",
  603. category: 'output',
  604. fn: function (aMethod,aStream){
  605. var self=this;
  606. return smalltalk.withContext(function($ctx1) {
  607. var $1,$2,$3,$4;
  608. $1=aStream;
  609. _st($1)._nextPutAll_("smalltalk.addMethod(");
  610. _st($1)._lf();
  611. _st($1)._nextPutAll_("smalltalk.method({");
  612. _st($1)._lf();
  613. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  614. _st($1)._lf();
  615. _st($1)._nextPutAll_(_st("category: '".__comma(_st(aMethod)._category())).__comma("',"));
  616. _st($1)._lf();
  617. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  618. _st($1)._lf();
  619. _st($1)._nextPutAll_(_st("args: ".__comma(_st(_st(aMethod)._arguments())._asJavascript())).__comma(","));
  620. _st($1)._lf();
  621. _st($1)._nextPutAll_(_st("source: ".__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
  622. _st($1)._lf();
  623. _st($1)._nextPutAll_(_st("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript())).__comma(","));
  624. _st($1)._lf();
  625. $2=_st($1)._nextPutAll_("referencedClasses: ".__comma(_st(_st(aMethod)._referencedClasses())._asJavascript()));
  626. $3=aStream;
  627. _st($3)._lf();
  628. _st($3)._nextPutAll_("}),");
  629. _st($3)._lf();
  630. _st($3)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
  631. _st($3)._nextPutAll_(");");
  632. _st($3)._lf();
  633. $4=_st($3)._lf();
  634. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.Exporter)})},
  635. args: ["aMethod", "aStream"],
  636. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addMethod(';lf;\x0a\x09\x09\x22nextPutAll: aMethod selector asSelector asJavascript, ',';lf;\x22\x0a\x09\x09nextPutAll: 'smalltalk.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'category: ''', aMethod category, ''',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript.\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aMethod methodClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
  637. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "category", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:", "methodClass"],
  638. referencedClasses: []
  639. }),
  640. smalltalk.Exporter);
  641. smalltalk.addMethod(
  642. smalltalk.method({
  643. selector: "exportPackage:on:",
  644. category: 'output',
  645. fn: function (aPackage,aStream){
  646. var self=this;
  647. return smalltalk.withContext(function($ctx1) {
  648. var $1,$2;
  649. $1=self;
  650. _st($1)._exportPackagePrologueOf_on_(aPackage,aStream);
  651. _st($1)._exportPackageDefinitionOf_on_(aPackage,aStream);
  652. $2=_st($1)._exportPackageTransportOf_on_(aPackage,aStream);
  653. _st(_st(aPackage)._sortedClasses())._do_((function(each){
  654. return smalltalk.withContext(function($ctx2) {
  655. self._exportDefinitionOf_on_(each,aStream);
  656. _st(_st(each)._ownMethods())._do_((function(method){
  657. return smalltalk.withContext(function($ctx3) {
  658. return self._exportMethod_on_(method,aStream);
  659. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)})}));
  660. self._exportMetaDefinitionOf_on_(each,aStream);
  661. return _st(_st(_st(each)._class())._ownMethods())._do_((function(method){
  662. return smalltalk.withContext(function($ctx3) {
  663. return self._exportMethod_on_(method,aStream);
  664. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)})}));
  665. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  666. _st(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  667. return smalltalk.withContext(function($ctx2) {
  668. return self._exportMethod_on_(each,aStream);
  669. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  670. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  671. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  672. args: ["aPackage", "aStream"],
  673. source: "exportPackage: aPackage on: aStream\x0a\x09\x0a\x09self \x0a\x09\x09exportPackagePrologueOf: aPackage on: aStream;\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageTransportOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09each ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ].\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09each class ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ] ].\x0a\x09\x09\x09\x0a\x09(self extensionMethodsOfPackage: aPackage) do: [ :each |\x0a\x09\x09self exportMethod: each on: aStream ].\x0a\x09\x09\x0a\x09self exportPackageEpilogueOf: aPackage on: aStream",
  674. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"],
  675. referencedClasses: []
  676. }),
  677. smalltalk.Exporter);
  678. smalltalk.addMethod(
  679. smalltalk.method({
  680. selector: "exportPackageDefinitionOf:on:",
  681. category: 'output',
  682. fn: function (aPackage,aStream){
  683. var self=this;
  684. return smalltalk.withContext(function($ctx1) {
  685. var $1,$2;
  686. $1=aStream;
  687. _st($1)._nextPutAll_("smalltalk.addPackage(");
  688. _st($1)._nextPutAll_(_st("'".__comma(_st(aPackage)._name())).__comma("');"));
  689. $2=_st($1)._lf();
  690. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  691. args: ["aPackage", "aStream"],
  692. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  693. messageSends: ["nextPutAll:", ",", "name", "lf"],
  694. referencedClasses: []
  695. }),
  696. smalltalk.Exporter);
  697. smalltalk.addMethod(
  698. smalltalk.method({
  699. selector: "exportPackageEpilogueOf:on:",
  700. category: 'output',
  701. fn: function (aPackage,aStream){
  702. var self=this;
  703. return smalltalk.withContext(function($ctx1) {
  704. var $1,$2;
  705. $1=aStream;
  706. _st($1)._nextPutAll_("})(global_smalltalk,global_nil,global__st);");
  707. $2=_st($1)._lf();
  708. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  709. args: ["aPackage", "aStream"],
  710. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '})(global_smalltalk,global_nil,global__st);';\x0a\x09\x09lf",
  711. messageSends: ["nextPutAll:", "lf"],
  712. referencedClasses: []
  713. }),
  714. smalltalk.Exporter);
  715. smalltalk.addMethod(
  716. smalltalk.method({
  717. selector: "exportPackagePrologueOf:on:",
  718. category: 'output',
  719. fn: function (aPackage,aStream){
  720. var self=this;
  721. return smalltalk.withContext(function($ctx1) {
  722. var $1,$2;
  723. $1=aStream;
  724. _st($1)._nextPutAll_("(function(smalltalk,nil,_st){");
  725. $2=_st($1)._lf();
  726. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  727. args: ["aPackage", "aStream"],
  728. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '(function(smalltalk,nil,_st){';\x0a\x09\x09lf",
  729. messageSends: ["nextPutAll:", "lf"],
  730. referencedClasses: []
  731. }),
  732. smalltalk.Exporter);
  733. smalltalk.addMethod(
  734. smalltalk.method({
  735. selector: "exportPackageTransportOf:on:",
  736. category: 'output',
  737. fn: function (aPackage,aStream){
  738. var self=this;
  739. return smalltalk.withContext(function($ctx1) {
  740. var $1,$2;
  741. $1=aStream;
  742. _st($1)._nextPutAll_("smalltalk.packages[");
  743. _st($1)._nextPutAll_(_st(_st(aPackage)._name())._asJavascript());
  744. _st($1)._nextPutAll_("].transport = ");
  745. _st($1)._nextPutAll_(_st(_st(aPackage)._transport())._asJSONString());
  746. _st($1)._nextPutAll_(";");
  747. $2=_st($1)._lf();
  748. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  749. args: ["aPackage", "aStream"],
  750. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.packages[';\x0a\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09nextPutAll: '].transport = ';\x0a\x09\x09nextPutAll: aPackage transport asJSONString;\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf",
  751. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"],
  752. referencedClasses: []
  753. }),
  754. smalltalk.Exporter);
  755. smalltalk.addMethod(
  756. smalltalk.method({
  757. selector: "ownMethodsOfClass:",
  758. category: 'accessing',
  759. fn: function (aClass){
  760. var self=this;
  761. return smalltalk.withContext(function($ctx1) {
  762. var $1;
  763. $1=_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  764. return smalltalk.withContext(function($ctx2) {
  765. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  766. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})})))._reject_((function(each){
  767. return smalltalk.withContext(function($ctx2) {
  768. return _st(_st(each)._category())._match_("^\x5c*");
  769. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  770. return $1;
  771. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},smalltalk.Exporter)})},
  772. args: ["aClass"],
  773. source: "ownMethodsOfClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^((aClass methodDictionary values) sorted: [:a :b | a selector <= b selector])\x0a\x09\x09reject: [:each | (each category match: '^\x5c*')]",
  774. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "category"],
  775. referencedClasses: []
  776. }),
  777. smalltalk.Exporter);
  778. smalltalk.addMethod(
  779. smalltalk.method({
  780. selector: "ownMethodsOfMetaClass:",
  781. category: 'accessing',
  782. fn: function (aClass){
  783. var self=this;
  784. return smalltalk.withContext(function($ctx1) {
  785. var $1;
  786. $1=self._ownMethodsOfClass_(_st(aClass)._class());
  787. return $1;
  788. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},smalltalk.Exporter)})},
  789. args: ["aClass"],
  790. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^self ownMethodsOfClass: aClass class",
  791. messageSends: ["ownMethodsOfClass:", "class"],
  792. referencedClasses: []
  793. }),
  794. smalltalk.Exporter);
  795. smalltalk.addClass('AmdExporter', smalltalk.Exporter, ['namespace'], 'Importer-Exporter');
  796. smalltalk.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  797. smalltalk.addMethod(
  798. smalltalk.method({
  799. selector: "amdNamesOfPackages:",
  800. category: 'private',
  801. fn: function (anArray){
  802. var self=this;
  803. return smalltalk.withContext(function($ctx1) {
  804. var $1;
  805. $1=_st(_st(anArray)._select_((function(each){
  806. return smalltalk.withContext(function($ctx2) {
  807. return _st(self._amdNamespaceOfPackage_(each))._notNil();
  808. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._collect_((function(each){
  809. return smalltalk.withContext(function($ctx2) {
  810. return _st(_st(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma(_st(each)._name());
  811. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  812. return $1;
  813. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},smalltalk.AmdExporter)})},
  814. args: ["anArray"],
  815. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  816. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"],
  817. referencedClasses: []
  818. }),
  819. smalltalk.AmdExporter);
  820. smalltalk.addMethod(
  821. smalltalk.method({
  822. selector: "amdNamespaceOfPackage:",
  823. category: 'private',
  824. fn: function (aPackage){
  825. var self=this;
  826. return smalltalk.withContext(function($ctx1) {
  827. var $2,$1;
  828. $2=_st(_st(_st(aPackage)._transport())._type()).__eq("amd");
  829. if(smalltalk.assert($2)){
  830. $1=_st(_st(aPackage)._transport())._namespace();
  831. } else {
  832. $1=nil;
  833. };
  834. return $1;
  835. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},smalltalk.AmdExporter)})},
  836. args: ["aPackage"],
  837. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  838. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"],
  839. referencedClasses: []
  840. }),
  841. smalltalk.AmdExporter);
  842. smalltalk.addMethod(
  843. smalltalk.method({
  844. selector: "exportPackageEpilogueOf:on:",
  845. category: 'output',
  846. fn: function (aPackage,aStream){
  847. var self=this;
  848. return smalltalk.withContext(function($ctx1) {
  849. var $1,$2;
  850. $1=aStream;
  851. _st($1)._nextPutAll_("});");
  852. $2=_st($1)._lf();
  853. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter)})},
  854. args: ["aPackage", "aStream"],
  855. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  856. messageSends: ["nextPutAll:", "lf"],
  857. referencedClasses: []
  858. }),
  859. smalltalk.AmdExporter);
  860. smalltalk.addMethod(
  861. smalltalk.method({
  862. selector: "exportPackagePrologueOf:on:",
  863. category: 'output',
  864. fn: function (aPackage,aStream){
  865. var self=this;
  866. return smalltalk.withContext(function($ctx1) {
  867. var $1,$2;
  868. $1=aStream;
  869. _st($1)._nextPutAll_("define(\x22");
  870. _st($1)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
  871. _st($1)._nextPutAll_("/");
  872. _st($1)._nextPutAll_(_st(aPackage)._name());
  873. _st($1)._nextPutAll_("\x22, ");
  874. _st($1)._nextPutAll_(_st(["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st"].__comma(self._amdNamesOfPackages_(_st(aPackage)._loadDependencies())))._asJavascript());
  875. _st($1)._nextPutAll_(", function(smalltalk,nil,_st){");
  876. $2=_st($1)._lf();
  877. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter)})},
  878. args: ["aPackage", "aStream"],
  879. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'define(\x22';\x0a\x09\x09nextPutAll: (self amdNamespaceOfPackage: aPackage);\x0a\x09\x09nextPutAll: '/';\x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, ';\x0a\x09\x09nextPutAll: (#('amber_vm/smalltalk' 'amber_vm/nil' 'amber_vm/_st'), (self amdNamesOfPackages: aPackage loadDependencies)) asJavascript;\x0a\x09\x09nextPutAll: ', function(smalltalk,nil,_st){';\x0a\x09\x09lf",
  880. messageSends: ["nextPutAll:", "amdNamespaceOfPackage:", "name", "asJavascript", ",", "amdNamesOfPackages:", "loadDependencies", "lf"],
  881. referencedClasses: []
  882. }),
  883. smalltalk.AmdExporter);
  884. smalltalk.addClass('ChunkParser', smalltalk.Object, ['stream'], 'Importer-Exporter');
  885. smalltalk.ChunkParser.comment="I am responsible for parsing aStream contents in the chunk format.\x0a\x0a## API\x0a\x0a ChunkParser new\x0a stream: aStream;\x0a nextChunk";
  886. smalltalk.addMethod(
  887. smalltalk.method({
  888. selector: "nextChunk",
  889. category: 'reading',
  890. fn: function (){
  891. var self=this;
  892. var char,result,chunk;
  893. return smalltalk.withContext(function($ctx1) {
  894. var $1,$2,$3;
  895. var $early={};
  896. try {
  897. result=""._writeStream();
  898. _st((function(){
  899. return smalltalk.withContext(function($ctx2) {
  900. char=_st(self["@stream"])._next();
  901. char;
  902. return _st(char)._notNil();
  903. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  904. return smalltalk.withContext(function($ctx2) {
  905. $1=_st(char).__eq("!");
  906. if(smalltalk.assert($1)){
  907. $2=_st(_st(self["@stream"])._peek()).__eq("!");
  908. if(smalltalk.assert($2)){
  909. _st(self["@stream"])._next();
  910. } else {
  911. $3=_st(_st(result)._contents())._trimBoth();
  912. throw $early=[$3];
  913. };
  914. };
  915. return _st(result)._nextPut_(char);
  916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  917. return nil;
  918. }
  919. catch(e) {if(e===$early)return e[0]; throw e}
  920. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},smalltalk.ChunkParser)})},
  921. args: [],
  922. source: "nextChunk\x0a\x09\x22The chunk format (Smalltalk Interchange Format or Fileout format)\x0a\x09is a trivial format but can be a bit tricky to understand:\x0a\x09\x09- Uses the exclamation mark as delimiter of chunks.\x0a\x09\x09- Inside a chunk a normal exclamation mark must be doubled.\x0a\x09\x09- A non empty chunk must be a valid Smalltalk expression.\x0a\x09\x09- A chunk on top level with a preceding empty chunk is an instruction chunk:\x0a\x09\x09\x09- The object created by the expression then takes over reading chunks.\x0a\x0a\x09This method returns next chunk as a String (trimmed), empty String (all whitespace) or nil.\x22\x0a\x0a\x09| char result chunk |\x0a\x09result := '' writeStream.\x0a\x09\x09[char := stream next.\x0a\x09\x09char notNil] whileTrue: [\x0a\x09\x09\x09\x09char = '!' ifTrue: [\x0a\x09\x09\x09\x09\x09\x09stream peek = '!'\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifTrue: [stream next \x22skipping the escape double\x22]\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifFalse: [^result contents trimBoth \x22chunk end marker found\x22]].\x0a\x09\x09\x09\x09result nextPut: char].\x0a\x09^nil \x22a chunk needs to end with !\x22",
  923. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"],
  924. referencedClasses: []
  925. }),
  926. smalltalk.ChunkParser);
  927. smalltalk.addMethod(
  928. smalltalk.method({
  929. selector: "stream:",
  930. category: 'accessing',
  931. fn: function (aStream){
  932. var self=this;
  933. return smalltalk.withContext(function($ctx1) {
  934. self["@stream"]=aStream;
  935. return self}, function($ctx1) {$ctx1.fill(self,"stream:",{aStream:aStream},smalltalk.ChunkParser)})},
  936. args: ["aStream"],
  937. source: "stream: aStream\x0a\x09stream := aStream",
  938. messageSends: [],
  939. referencedClasses: []
  940. }),
  941. smalltalk.ChunkParser);
  942. smalltalk.addMethod(
  943. smalltalk.method({
  944. selector: "on:",
  945. category: 'instance creation',
  946. fn: function (aStream){
  947. var self=this;
  948. return smalltalk.withContext(function($ctx1) {
  949. var $1;
  950. $1=_st(self._new())._stream_(aStream);
  951. return $1;
  952. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},smalltalk.ChunkParser.klass)})},
  953. args: ["aStream"],
  954. source: "on: aStream\x0a\x09^self new stream: aStream",
  955. messageSends: ["stream:", "new"],
  956. referencedClasses: []
  957. }),
  958. smalltalk.ChunkParser.klass);
  959. smalltalk.addClass('ExportMethodProtocol', smalltalk.Object, ['name', 'theClass'], 'Importer-Exporter');
  960. smalltalk.ExportMethodProtocol.comment="I am an abstraction for a method protocol in a class / metaclass.\x0a\x0aI know of my class, name and methods.\x0aI am used when exporting a package.";
  961. smalltalk.addMethod(
  962. smalltalk.method({
  963. selector: "methods",
  964. category: 'accessing',
  965. fn: function (){
  966. var self=this;
  967. return smalltalk.withContext(function($ctx1) {
  968. var $1;
  969. $1=_st(_st(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  970. return smalltalk.withContext(function($ctx2) {
  971. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  972. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})}));
  973. return $1;
  974. }, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.ExportMethodProtocol)})},
  975. args: [],
  976. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  977. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"],
  978. referencedClasses: []
  979. }),
  980. smalltalk.ExportMethodProtocol);
  981. smalltalk.addMethod(
  982. smalltalk.method({
  983. selector: "name",
  984. category: 'accessing',
  985. fn: function (){
  986. var self=this;
  987. return smalltalk.withContext(function($ctx1) {
  988. var $1;
  989. $1=self["@name"];
  990. return $1;
  991. }, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.ExportMethodProtocol)})},
  992. args: [],
  993. source: "name\x0a\x09^name",
  994. messageSends: [],
  995. referencedClasses: []
  996. }),
  997. smalltalk.ExportMethodProtocol);
  998. smalltalk.addMethod(
  999. smalltalk.method({
  1000. selector: "name:",
  1001. category: 'accessing',
  1002. fn: function (aString){
  1003. var self=this;
  1004. return smalltalk.withContext(function($ctx1) {
  1005. self["@name"]=aString;
  1006. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.ExportMethodProtocol)})},
  1007. args: ["aString"],
  1008. source: "name: aString\x0a\x09name := aString",
  1009. messageSends: [],
  1010. referencedClasses: []
  1011. }),
  1012. smalltalk.ExportMethodProtocol);
  1013. smalltalk.addMethod(
  1014. smalltalk.method({
  1015. selector: "theClass",
  1016. category: 'accessing',
  1017. fn: function (){
  1018. var self=this;
  1019. return smalltalk.withContext(function($ctx1) {
  1020. var $1;
  1021. $1=self["@theClass"];
  1022. return $1;
  1023. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ExportMethodProtocol)})},
  1024. args: [],
  1025. source: "theClass\x0a\x09^theClass",
  1026. messageSends: [],
  1027. referencedClasses: []
  1028. }),
  1029. smalltalk.ExportMethodProtocol);
  1030. smalltalk.addMethod(
  1031. smalltalk.method({
  1032. selector: "theClass:",
  1033. category: 'accessing',
  1034. fn: function (aClass){
  1035. var self=this;
  1036. return smalltalk.withContext(function($ctx1) {
  1037. self["@theClass"]=aClass;
  1038. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ExportMethodProtocol)})},
  1039. args: ["aClass"],
  1040. source: "theClass: aClass\x0a\x09theClass := aClass",
  1041. messageSends: [],
  1042. referencedClasses: []
  1043. }),
  1044. smalltalk.ExportMethodProtocol);
  1045. smalltalk.addMethod(
  1046. smalltalk.method({
  1047. selector: "name:theClass:",
  1048. category: 'instance creation',
  1049. fn: function (aString,aClass){
  1050. var self=this;
  1051. return smalltalk.withContext(function($ctx1) {
  1052. var $2,$3,$1;
  1053. $2=self._new();
  1054. _st($2)._name_(aString);
  1055. _st($2)._theClass_(aClass);
  1056. $3=_st($2)._yourself();
  1057. $1=$3;
  1058. return $1;
  1059. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},smalltalk.ExportMethodProtocol.klass)})},
  1060. args: ["aString", "aClass"],
  1061. source: "name: aString theClass: aClass\x0a\x09^self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  1062. messageSends: ["name:", "new", "theClass:", "yourself"],
  1063. referencedClasses: []
  1064. }),
  1065. smalltalk.ExportMethodProtocol.klass);
  1066. smalltalk.addClass('Importer', smalltalk.Object, [], 'Importer-Exporter');
  1067. smalltalk.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  1068. smalltalk.addMethod(
  1069. smalltalk.method({
  1070. selector: "import:",
  1071. category: 'fileIn',
  1072. fn: function (aStream){
  1073. var self=this;
  1074. var chunk,result,parser,lastEmpty;
  1075. function $ChunkParser(){return smalltalk.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  1076. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  1077. return smalltalk.withContext(function($ctx1) {
  1078. var $1,$2;
  1079. parser=_st($ChunkParser())._on_(aStream);
  1080. lastEmpty=false;
  1081. _st((function(){
  1082. return smalltalk.withContext(function($ctx2) {
  1083. chunk=_st(parser)._nextChunk();
  1084. chunk;
  1085. return _st(chunk)._isNil();
  1086. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  1087. return smalltalk.withContext(function($ctx2) {
  1088. $1=_st(chunk)._isEmpty();
  1089. if(smalltalk.assert($1)){
  1090. lastEmpty=true;
  1091. return lastEmpty;
  1092. } else {
  1093. result=_st(_st($Compiler())._new())._evaluateExpression_(chunk);
  1094. result;
  1095. $2=lastEmpty;
  1096. if(smalltalk.assert($2)){
  1097. lastEmpty=false;
  1098. lastEmpty;
  1099. return _st(result)._scanFrom_(parser);
  1100. };
  1101. };
  1102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1103. return self}, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},smalltalk.Importer)})},
  1104. args: ["aStream"],
  1105. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09[chunk := parser nextChunk.\x0a\x09chunk isNil] whileFalse: [\x0a\x09\x09chunk isEmpty\x0a\x09\x09\x09ifTrue: [lastEmpty := true]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser]]]",
  1106. messageSends: ["on:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:"],
  1107. referencedClasses: ["ChunkParser", "Compiler"]
  1108. }),
  1109. smalltalk.Importer);
  1110. smalltalk.addClass('PackageHandler', smalltalk.InterfacingObject, [], 'Importer-Exporter');
  1111. smalltalk.PackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  1112. smalltalk.addMethod(
  1113. smalltalk.method({
  1114. selector: "ajaxPutAt:data:",
  1115. category: 'private',
  1116. fn: function (aURL,aString){
  1117. var self=this;
  1118. return smalltalk.withContext(function($ctx1) {
  1119. self._ajax_(smalltalk.HashedCollection._from_(["url".__minus_gt(aURL),"type".__minus_gt("PUT"),"data".__minus_gt(aString),"contentType".__minus_gt("text/plain;charset=UTF-8"),"error".__minus_gt((function(xhr){
  1120. return smalltalk.withContext(function($ctx2) {
  1121. return self._error_(_st(_st(_st("Commiting ".__comma(aURL)).__comma(" failed with reason: \x22")).__comma(_st(xhr)._responseText())).__comma("\x22"));
  1122. }, function($ctx2) {$ctx2.fillBlock({xhr:xhr},$ctx1,1)})}))]));
  1123. return self}, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:",{aURL:aURL,aString:aString},smalltalk.PackageHandler)})},
  1124. args: ["aURL", "aString"],
  1125. source: "ajaxPutAt: aURL data: aString\x0a\x09self\x0a\x09\x09ajax: #{\x0a\x09\x09\x09'url' -> aURL.\x0a\x09\x09\x09'type' -> 'PUT'.\x0a\x09\x09\x09'data' -> aString.\x0a\x09\x09\x09'contentType' -> 'text/plain;charset=UTF-8'.\x0a\x09\x09\x09'error' -> [ :xhr | self error: 'Commiting ' , aURL , ' failed with reason: \x22' , (xhr responseText) , '\x22'] }",
  1126. messageSends: ["ajax:", "->", "error:", ",", "responseText"],
  1127. referencedClasses: []
  1128. }),
  1129. smalltalk.PackageHandler);
  1130. smalltalk.addMethod(
  1131. smalltalk.method({
  1132. selector: "chunkContentsFor:",
  1133. category: 'accessing',
  1134. fn: function (aPackage){
  1135. var self=this;
  1136. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1137. return smalltalk.withContext(function($ctx1) {
  1138. var $1;
  1139. $1=_st($String())._streamContents_((function(str){
  1140. return smalltalk.withContext(function($ctx2) {
  1141. return _st(self._chunkExporter())._exportPackage_on_(aPackage,str);
  1142. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  1143. return $1;
  1144. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1145. args: ["aPackage"],
  1146. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  1147. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"],
  1148. referencedClasses: ["String"]
  1149. }),
  1150. smalltalk.PackageHandler);
  1151. smalltalk.addMethod(
  1152. smalltalk.method({
  1153. selector: "chunkExporter",
  1154. category: 'factory',
  1155. fn: function (){
  1156. var self=this;
  1157. return smalltalk.withContext(function($ctx1) {
  1158. var $1;
  1159. $1=_st(self._chunkExporterClass())._new();
  1160. return $1;
  1161. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},smalltalk.PackageHandler)})},
  1162. args: [],
  1163. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  1164. messageSends: ["new", "chunkExporterClass"],
  1165. referencedClasses: []
  1166. }),
  1167. smalltalk.PackageHandler);
  1168. smalltalk.addMethod(
  1169. smalltalk.method({
  1170. selector: "chunkExporterClass",
  1171. category: 'accessing',
  1172. fn: function (){
  1173. var self=this;
  1174. function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  1175. return smalltalk.withContext(function($ctx1) {
  1176. var $1;
  1177. $1=$ChunkExporter();
  1178. return $1;
  1179. }, function($ctx1) {$ctx1.fill(self,"chunkExporterClass",{},smalltalk.PackageHandler)})},
  1180. args: [],
  1181. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  1182. messageSends: [],
  1183. referencedClasses: ["ChunkExporter"]
  1184. }),
  1185. smalltalk.PackageHandler);
  1186. smalltalk.addMethod(
  1187. smalltalk.method({
  1188. selector: "commit:",
  1189. category: 'committing',
  1190. fn: function (aPackage){
  1191. var self=this;
  1192. return smalltalk.withContext(function($ctx1) {
  1193. _st([(function(){
  1194. return smalltalk.withContext(function($ctx2) {
  1195. return self._commitStFileFor_(aPackage);
  1196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  1197. return smalltalk.withContext(function($ctx2) {
  1198. return self._commitJsFileFor_(aPackage);
  1199. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})])._do_displayingProgress_((function(each){
  1200. return smalltalk.withContext(function($ctx2) {
  1201. return _st(each)._value();
  1202. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}),"Committing package ".__comma(_st(aPackage)._name()));
  1203. return self}, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1204. args: ["aPackage"],
  1205. source: "commit: aPackage\x0a\x09{\x0a\x09\x09[ self commitStFileFor: aPackage ].\x0a\x09\x09[ self commitJsFileFor: aPackage ]\x0a\x09}\x0a\x09\x09do: [ :each | each value ]\x0a\x09\x09displayingProgress: 'Committing package ', aPackage name",
  1206. messageSends: ["do:displayingProgress:", "commitStFileFor:", "commitJsFileFor:", "value", ",", "name"],
  1207. referencedClasses: []
  1208. }),
  1209. smalltalk.PackageHandler);
  1210. smalltalk.addMethod(
  1211. smalltalk.method({
  1212. selector: "commitJsFileFor:",
  1213. category: 'committing',
  1214. fn: function (aPackage){
  1215. var self=this;
  1216. return smalltalk.withContext(function($ctx1) {
  1217. self._ajaxPutAt_data_(_st(_st(_st(self._commitPathJsFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name())).__comma(".js"),self._contentsFor_(aPackage));
  1218. return self}, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1219. args: ["aPackage"],
  1220. source: "commitJsFileFor: aPackage\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathJsFor: aPackage), '/', aPackage name, '.js'\x0a\x09\x09data: (self contentsFor: aPackage)",
  1221. messageSends: ["ajaxPutAt:data:", ",", "commitPathJsFor:", "name", "contentsFor:"],
  1222. referencedClasses: []
  1223. }),
  1224. smalltalk.PackageHandler);
  1225. smalltalk.addMethod(
  1226. smalltalk.method({
  1227. selector: "commitPathJsFor:",
  1228. category: 'accessing',
  1229. fn: function (aPackage){
  1230. var self=this;
  1231. return smalltalk.withContext(function($ctx1) {
  1232. self._subclassResponsibility();
  1233. return self}, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1234. args: ["aPackage"],
  1235. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  1236. messageSends: ["subclassResponsibility"],
  1237. referencedClasses: []
  1238. }),
  1239. smalltalk.PackageHandler);
  1240. smalltalk.addMethod(
  1241. smalltalk.method({
  1242. selector: "commitPathStFor:",
  1243. category: 'accessing',
  1244. fn: function (aPackage){
  1245. var self=this;
  1246. return smalltalk.withContext(function($ctx1) {
  1247. self._subclassResponsibility();
  1248. return self}, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1249. args: ["aPackage"],
  1250. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  1251. messageSends: ["subclassResponsibility"],
  1252. referencedClasses: []
  1253. }),
  1254. smalltalk.PackageHandler);
  1255. smalltalk.addMethod(
  1256. smalltalk.method({
  1257. selector: "commitStFileFor:",
  1258. category: 'committing',
  1259. fn: function (aPackage){
  1260. var self=this;
  1261. return smalltalk.withContext(function($ctx1) {
  1262. self._ajaxPutAt_data_(_st(_st(_st(self._commitPathStFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name())).__comma(".st"),self._chunkContentsFor_(aPackage));
  1263. return self}, function($ctx1) {$ctx1.fill(self,"commitStFileFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1264. args: ["aPackage"],
  1265. source: "commitStFileFor: aPackage\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathStFor: aPackage), '/', aPackage name, '.st'\x0a\x09\x09data: (self chunkContentsFor: aPackage)",
  1266. messageSends: ["ajaxPutAt:data:", ",", "commitPathStFor:", "name", "chunkContentsFor:"],
  1267. referencedClasses: []
  1268. }),
  1269. smalltalk.PackageHandler);
  1270. smalltalk.addMethod(
  1271. smalltalk.method({
  1272. selector: "contentsFor:",
  1273. category: 'accessing',
  1274. fn: function (aPackage){
  1275. var self=this;
  1276. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1277. return smalltalk.withContext(function($ctx1) {
  1278. var $1;
  1279. $1=_st($String())._streamContents_((function(str){
  1280. return smalltalk.withContext(function($ctx2) {
  1281. return _st(self._exporter())._exportPackage_on_(aPackage,str);
  1282. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  1283. return $1;
  1284. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1285. args: ["aPackage"],
  1286. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  1287. messageSends: ["streamContents:", "exportPackage:on:", "exporter"],
  1288. referencedClasses: ["String"]
  1289. }),
  1290. smalltalk.PackageHandler);
  1291. smalltalk.addMethod(
  1292. smalltalk.method({
  1293. selector: "exporter",
  1294. category: 'factory',
  1295. fn: function (){
  1296. var self=this;
  1297. return smalltalk.withContext(function($ctx1) {
  1298. var $1;
  1299. $1=_st(self._exporterClass())._new();
  1300. return $1;
  1301. }, function($ctx1) {$ctx1.fill(self,"exporter",{},smalltalk.PackageHandler)})},
  1302. args: [],
  1303. source: "exporter\x0a\x09^ self exporterClass new",
  1304. messageSends: ["new", "exporterClass"],
  1305. referencedClasses: []
  1306. }),
  1307. smalltalk.PackageHandler);
  1308. smalltalk.addMethod(
  1309. smalltalk.method({
  1310. selector: "exporterClass",
  1311. category: 'accessing',
  1312. fn: function (){
  1313. var self=this;
  1314. function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  1315. return smalltalk.withContext(function($ctx1) {
  1316. var $1;
  1317. $1=$Exporter();
  1318. return $1;
  1319. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},smalltalk.PackageHandler)})},
  1320. args: [],
  1321. source: "exporterClass\x0a\x09^ Exporter",
  1322. messageSends: [],
  1323. referencedClasses: ["Exporter"]
  1324. }),
  1325. smalltalk.PackageHandler);
  1326. smalltalk.addClass('AmdPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
  1327. smalltalk.AmdPackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  1328. smalltalk.addMethod(
  1329. smalltalk.method({
  1330. selector: "commitPathJsFor:",
  1331. category: 'accessing',
  1332. fn: function (aPackage){
  1333. var self=this;
  1334. return smalltalk.withContext(function($ctx1) {
  1335. var $1;
  1336. $1=self._toUrl_(self._namespaceFor_(aPackage));
  1337. return $1;
  1338. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  1339. args: ["aPackage"],
  1340. source: "commitPathJsFor: aPackage\x0a\x09^self toUrl: (self namespaceFor: aPackage)",
  1341. messageSends: ["toUrl:", "namespaceFor:"],
  1342. referencedClasses: []
  1343. }),
  1344. smalltalk.AmdPackageHandler);
  1345. smalltalk.addMethod(
  1346. smalltalk.method({
  1347. selector: "commitPathStFor:",
  1348. category: 'accessing',
  1349. fn: function (aPackage){
  1350. var self=this;
  1351. return smalltalk.withContext(function($ctx1) {
  1352. var $1;
  1353. $1=self._toUrl_(_st(self._namespaceFor_(aPackage)).__comma("/_source"));
  1354. return $1;
  1355. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  1356. args: ["aPackage"],
  1357. source: "commitPathStFor: aPackage\x0a\x09\x22if _source is not mapped, .st commit will likely fail\x22\x0a\x09^self toUrl: (self namespaceFor: aPackage), '/_source'.",
  1358. messageSends: ["toUrl:", ",", "namespaceFor:"],
  1359. referencedClasses: []
  1360. }),
  1361. smalltalk.AmdPackageHandler);
  1362. smalltalk.addMethod(
  1363. smalltalk.method({
  1364. selector: "exporterClass",
  1365. category: 'accessing',
  1366. fn: function (){
  1367. var self=this;
  1368. function $AmdExporter(){return smalltalk.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  1369. return smalltalk.withContext(function($ctx1) {
  1370. var $1;
  1371. $1=$AmdExporter();
  1372. return $1;
  1373. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},smalltalk.AmdPackageHandler)})},
  1374. args: [],
  1375. source: "exporterClass\x0a\x09^ AmdExporter",
  1376. messageSends: [],
  1377. referencedClasses: ["AmdExporter"]
  1378. }),
  1379. smalltalk.AmdPackageHandler);
  1380. smalltalk.addMethod(
  1381. smalltalk.method({
  1382. selector: "namespaceFor:",
  1383. category: 'committing',
  1384. fn: function (aPackage){
  1385. var self=this;
  1386. return smalltalk.withContext(function($ctx1) {
  1387. var $1;
  1388. $1=_st(_st(aPackage)._transport())._namespace();
  1389. return $1;
  1390. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  1391. args: ["aPackage"],
  1392. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  1393. messageSends: ["namespace", "transport"],
  1394. referencedClasses: []
  1395. }),
  1396. smalltalk.AmdPackageHandler);
  1397. smalltalk.addMethod(
  1398. smalltalk.method({
  1399. selector: "toUrl:",
  1400. category: 'private',
  1401. fn: function (aString){
  1402. var self=this;
  1403. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1404. return smalltalk.withContext(function($ctx1) {
  1405. var $2,$1;
  1406. $2=_st(_st($Smalltalk())._current())._amdRequire();
  1407. if(($receiver = $2) == nil || $receiver == null){
  1408. $1=self._error_("AMD loader not present");
  1409. } else {
  1410. var require;
  1411. require=$receiver;
  1412. $1=_st(_st(require)._basicAt_("toUrl"))._value_(aString);
  1413. };
  1414. return $1;
  1415. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},smalltalk.AmdPackageHandler)})},
  1416. args: ["aString"],
  1417. source: "toUrl: aString\x0a\x09^ Smalltalk current amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
  1418. messageSends: ["ifNil:ifNotNil:", "amdRequire", "current", "error:", "value:", "basicAt:"],
  1419. referencedClasses: ["Smalltalk"]
  1420. }),
  1421. smalltalk.AmdPackageHandler);
  1422. smalltalk.addMethod(
  1423. smalltalk.method({
  1424. selector: "defaultNamespace",
  1425. category: 'commit paths',
  1426. fn: function (){
  1427. var self=this;
  1428. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1429. return smalltalk.withContext(function($ctx1) {
  1430. var $1;
  1431. $1=_st(_st($Smalltalk())._current())._defaultAmdNamespace();
  1432. return $1;
  1433. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},smalltalk.AmdPackageHandler.klass)})},
  1434. args: [],
  1435. source: "defaultNamespace\x0a\x09^ Smalltalk current defaultAmdNamespace",
  1436. messageSends: ["defaultAmdNamespace", "current"],
  1437. referencedClasses: ["Smalltalk"]
  1438. }),
  1439. smalltalk.AmdPackageHandler.klass);
  1440. smalltalk.addMethod(
  1441. smalltalk.method({
  1442. selector: "defaultNamespace:",
  1443. category: 'commit paths',
  1444. fn: function (aString){
  1445. var self=this;
  1446. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1447. return smalltalk.withContext(function($ctx1) {
  1448. _st(_st($Smalltalk())._current())._defaultAmdNamespace_(aString);
  1449. return self}, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},smalltalk.AmdPackageHandler.klass)})},
  1450. args: ["aString"],
  1451. source: "defaultNamespace: aString\x0a\x09Smalltalk current defaultAmdNamespace: aString",
  1452. messageSends: ["defaultAmdNamespace:", "current"],
  1453. referencedClasses: ["Smalltalk"]
  1454. }),
  1455. smalltalk.AmdPackageHandler.klass);
  1456. smalltalk.addClass('PackageTransport', smalltalk.Object, ['package'], 'Importer-Exporter');
  1457. smalltalk.PackageTransport.comment="I represent the transport mechanism used to commit a package.\x0a\x0aMy concrete subclasses have a `#handler` to which committing is delegated.";
  1458. smalltalk.addMethod(
  1459. smalltalk.method({
  1460. selector: "asJSON",
  1461. category: 'converting',
  1462. fn: function (){
  1463. var self=this;
  1464. return smalltalk.withContext(function($ctx1) {
  1465. var $1;
  1466. $1=smalltalk.HashedCollection._from_(["type".__minus_gt(self._type())]);
  1467. return $1;
  1468. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.PackageTransport)})},
  1469. args: [],
  1470. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  1471. messageSends: ["->", "type"],
  1472. referencedClasses: []
  1473. }),
  1474. smalltalk.PackageTransport);
  1475. smalltalk.addMethod(
  1476. smalltalk.method({
  1477. selector: "commit",
  1478. category: 'committing',
  1479. fn: function (){
  1480. var self=this;
  1481. return smalltalk.withContext(function($ctx1) {
  1482. _st(self._commitHandler())._commit_(self._package());
  1483. return self}, function($ctx1) {$ctx1.fill(self,"commit",{},smalltalk.PackageTransport)})},
  1484. args: [],
  1485. source: "commit\x0a\x09self commitHandler commit: self package",
  1486. messageSends: ["commit:", "commitHandler", "package"],
  1487. referencedClasses: []
  1488. }),
  1489. smalltalk.PackageTransport);
  1490. smalltalk.addMethod(
  1491. smalltalk.method({
  1492. selector: "commitHandler",
  1493. category: 'factory',
  1494. fn: function (){
  1495. var self=this;
  1496. return smalltalk.withContext(function($ctx1) {
  1497. var $1;
  1498. $1=_st(self._commitHandlerClass())._new();
  1499. return $1;
  1500. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},smalltalk.PackageTransport)})},
  1501. args: [],
  1502. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  1503. messageSends: ["new", "commitHandlerClass"],
  1504. referencedClasses: []
  1505. }),
  1506. smalltalk.PackageTransport);
  1507. smalltalk.addMethod(
  1508. smalltalk.method({
  1509. selector: "commitHandlerClass",
  1510. category: 'accessing',
  1511. fn: function (){
  1512. var self=this;
  1513. return smalltalk.withContext(function($ctx1) {
  1514. self._subclassResponsibility();
  1515. return self}, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},smalltalk.PackageTransport)})},
  1516. args: [],
  1517. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  1518. messageSends: ["subclassResponsibility"],
  1519. referencedClasses: []
  1520. }),
  1521. smalltalk.PackageTransport);
  1522. smalltalk.addMethod(
  1523. smalltalk.method({
  1524. selector: "package",
  1525. category: 'accessing',
  1526. fn: function (){
  1527. var self=this;
  1528. return smalltalk.withContext(function($ctx1) {
  1529. var $1;
  1530. $1=self["@package"];
  1531. return $1;
  1532. }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.PackageTransport)})},
  1533. args: [],
  1534. source: "package\x0a\x09^ package",
  1535. messageSends: [],
  1536. referencedClasses: []
  1537. }),
  1538. smalltalk.PackageTransport);
  1539. smalltalk.addMethod(
  1540. smalltalk.method({
  1541. selector: "package:",
  1542. category: 'accessing',
  1543. fn: function (aPackage){
  1544. var self=this;
  1545. return smalltalk.withContext(function($ctx1) {
  1546. self["@package"]=aPackage;
  1547. return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage},smalltalk.PackageTransport)})},
  1548. args: ["aPackage"],
  1549. source: "package: aPackage\x0a\x09package := aPackage",
  1550. messageSends: [],
  1551. referencedClasses: []
  1552. }),
  1553. smalltalk.PackageTransport);
  1554. smalltalk.addMethod(
  1555. smalltalk.method({
  1556. selector: "setupFromJson:",
  1557. category: 'initialization',
  1558. fn: function (anObject){
  1559. var self=this;
  1560. return smalltalk.withContext(function($ctx1) {
  1561. return self}, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},smalltalk.PackageTransport)})},
  1562. args: ["anObject"],
  1563. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  1564. messageSends: [],
  1565. referencedClasses: []
  1566. }),
  1567. smalltalk.PackageTransport);
  1568. smalltalk.addMethod(
  1569. smalltalk.method({
  1570. selector: "type",
  1571. category: 'accessing',
  1572. fn: function (){
  1573. var self=this;
  1574. return smalltalk.withContext(function($ctx1) {
  1575. var $1;
  1576. $1=_st(self._class())._type();
  1577. return $1;
  1578. }, function($ctx1) {$ctx1.fill(self,"type",{},smalltalk.PackageTransport)})},
  1579. args: [],
  1580. source: "type\x0a\x09^ self class type",
  1581. messageSends: ["type", "class"],
  1582. referencedClasses: []
  1583. }),
  1584. smalltalk.PackageTransport);
  1585. smalltalk.PackageTransport.klass.iVarNames = ['registry'];
  1586. smalltalk.addMethod(
  1587. smalltalk.method({
  1588. selector: "classRegisteredFor:",
  1589. category: 'accessing',
  1590. fn: function (aString){
  1591. var self=this;
  1592. return smalltalk.withContext(function($ctx1) {
  1593. var $1;
  1594. $1=_st(self["@registry"])._at_(aString);
  1595. return $1;
  1596. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},smalltalk.PackageTransport.klass)})},
  1597. args: ["aString"],
  1598. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  1599. messageSends: ["at:"],
  1600. referencedClasses: []
  1601. }),
  1602. smalltalk.PackageTransport.klass);
  1603. smalltalk.addMethod(
  1604. smalltalk.method({
  1605. selector: "defaultType",
  1606. category: 'accessing',
  1607. fn: function (){
  1608. var self=this;
  1609. function $AmdPackageTransport(){return smalltalk.AmdPackageTransport||(typeof AmdPackageTransport=="undefined"?nil:AmdPackageTransport)}
  1610. return smalltalk.withContext(function($ctx1) {
  1611. var $1;
  1612. $1=_st($AmdPackageTransport())._type();
  1613. return $1;
  1614. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},smalltalk.PackageTransport.klass)})},
  1615. args: [],
  1616. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  1617. messageSends: ["type"],
  1618. referencedClasses: ["AmdPackageTransport"]
  1619. }),
  1620. smalltalk.PackageTransport.klass);
  1621. smalltalk.addMethod(
  1622. smalltalk.method({
  1623. selector: "for:",
  1624. category: 'instance creation',
  1625. fn: function (aString){
  1626. var self=this;
  1627. return smalltalk.withContext(function($ctx1) {
  1628. var $1;
  1629. $1=_st(self._classRegisteredFor_(aString))._new();
  1630. return $1;
  1631. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},smalltalk.PackageTransport.klass)})},
  1632. args: ["aString"],
  1633. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  1634. messageSends: ["new", "classRegisteredFor:"],
  1635. referencedClasses: []
  1636. }),
  1637. smalltalk.PackageTransport.klass);
  1638. smalltalk.addMethod(
  1639. smalltalk.method({
  1640. selector: "fromJson:",
  1641. category: 'instance creation',
  1642. fn: function (anObject){
  1643. var self=this;
  1644. return smalltalk.withContext(function($ctx1) {
  1645. var $1,$2,$4,$5,$3;
  1646. $1=anObject;
  1647. if(($receiver = $1) == nil || $receiver == null){
  1648. $2=self._for_(self._defaultType());
  1649. return $2;
  1650. } else {
  1651. $1;
  1652. };
  1653. $4=self._for_(_st(anObject)._type());
  1654. _st($4)._setupFromJson_(anObject);
  1655. $5=_st($4)._yourself();
  1656. $3=$5;
  1657. return $3;
  1658. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},smalltalk.PackageTransport.klass)})},
  1659. args: ["anObject"],
  1660. source: "fromJson: anObject\x0a\x09anObject ifNil: [ ^ self for: self defaultType ].\x0a\x09\x0a\x09^ (self for: anObject type)\x0a\x09\x09setupFromJson: anObject;\x0a\x09\x09yourself",
  1661. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"],
  1662. referencedClasses: []
  1663. }),
  1664. smalltalk.PackageTransport.klass);
  1665. smalltalk.addMethod(
  1666. smalltalk.method({
  1667. selector: "initialize",
  1668. category: 'initialization',
  1669. fn: function (){
  1670. var self=this;
  1671. return smalltalk.withContext(function($ctx1) {
  1672. smalltalk.PackageTransport.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  1673. self["@registry"]=smalltalk.HashedCollection._from_([]);
  1674. self._register();
  1675. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.PackageTransport.klass)})},
  1676. args: [],
  1677. source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}.\x0a\x09self register",
  1678. messageSends: ["initialize", "register"],
  1679. referencedClasses: []
  1680. }),
  1681. smalltalk.PackageTransport.klass);
  1682. smalltalk.addMethod(
  1683. smalltalk.method({
  1684. selector: "register",
  1685. category: 'registration',
  1686. fn: function (){
  1687. var self=this;
  1688. function $PackageTransport(){return smalltalk.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  1689. return smalltalk.withContext(function($ctx1) {
  1690. _st($PackageTransport())._register_(self);
  1691. return self}, function($ctx1) {$ctx1.fill(self,"register",{},smalltalk.PackageTransport.klass)})},
  1692. args: [],
  1693. source: "register\x0a\x09PackageTransport register: self",
  1694. messageSends: ["register:"],
  1695. referencedClasses: ["PackageTransport"]
  1696. }),
  1697. smalltalk.PackageTransport.klass);
  1698. smalltalk.addMethod(
  1699. smalltalk.method({
  1700. selector: "register:",
  1701. category: 'registration',
  1702. fn: function (aClass){
  1703. var self=this;
  1704. return smalltalk.withContext(function($ctx1) {
  1705. var $1;
  1706. $1=_st(aClass)._type();
  1707. if(($receiver = $1) == nil || $receiver == null){
  1708. $1;
  1709. } else {
  1710. _st(self["@registry"])._at_put_(_st(aClass)._type(),aClass);
  1711. };
  1712. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},smalltalk.PackageTransport.klass)})},
  1713. args: ["aClass"],
  1714. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  1715. messageSends: ["ifNotNil:", "type", "at:put:"],
  1716. referencedClasses: []
  1717. }),
  1718. smalltalk.PackageTransport.klass);
  1719. smalltalk.addMethod(
  1720. smalltalk.method({
  1721. selector: "type",
  1722. category: 'accessing',
  1723. fn: function (){
  1724. var self=this;
  1725. return smalltalk.withContext(function($ctx1) {
  1726. return nil;
  1727. }, function($ctx1) {$ctx1.fill(self,"type",{},smalltalk.PackageTransport.klass)})},
  1728. args: [],
  1729. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  1730. messageSends: [],
  1731. referencedClasses: []
  1732. }),
  1733. smalltalk.PackageTransport.klass);
  1734. smalltalk.addClass('AmdPackageTransport', smalltalk.PackageTransport, ['namespace'], 'Importer-Exporter');
  1735. smalltalk.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  1736. smalltalk.addMethod(
  1737. smalltalk.method({
  1738. selector: "asJSON",
  1739. category: 'converting',
  1740. fn: function (){
  1741. var self=this;
  1742. return smalltalk.withContext(function($ctx1) {
  1743. var $2,$3,$1;
  1744. $2=smalltalk.AmdPackageTransport.superclass.fn.prototype._asJSON.apply(_st(self), []);
  1745. _st($2)._at_put_("amdNamespace",self._namespace());
  1746. $3=_st($2)._yourself();
  1747. $1=$3;
  1748. return $1;
  1749. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.AmdPackageTransport)})},
  1750. args: [],
  1751. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  1752. messageSends: ["at:put:", "asJSON", "namespace", "yourself"],
  1753. referencedClasses: []
  1754. }),
  1755. smalltalk.AmdPackageTransport);
  1756. smalltalk.addMethod(
  1757. smalltalk.method({
  1758. selector: "commitHandlerClass",
  1759. category: 'accessing',
  1760. fn: function (){
  1761. var self=this;
  1762. function $AmdPackageHandler(){return smalltalk.AmdPackageHandler||(typeof AmdPackageHandler=="undefined"?nil:AmdPackageHandler)}
  1763. return smalltalk.withContext(function($ctx1) {
  1764. var $1;
  1765. $1=$AmdPackageHandler();
  1766. return $1;
  1767. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},smalltalk.AmdPackageTransport)})},
  1768. args: [],
  1769. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  1770. messageSends: [],
  1771. referencedClasses: ["AmdPackageHandler"]
  1772. }),
  1773. smalltalk.AmdPackageTransport);
  1774. smalltalk.addMethod(
  1775. smalltalk.method({
  1776. selector: "defaultNamespace",
  1777. category: 'defaults',
  1778. fn: function (){
  1779. var self=this;
  1780. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1781. return smalltalk.withContext(function($ctx1) {
  1782. var $1;
  1783. $1=_st(_st($Smalltalk())._current())._defaultAmdNamespace();
  1784. return $1;
  1785. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},smalltalk.AmdPackageTransport)})},
  1786. args: [],
  1787. source: "defaultNamespace\x0a\x09^ Smalltalk current defaultAmdNamespace",
  1788. messageSends: ["defaultAmdNamespace", "current"],
  1789. referencedClasses: ["Smalltalk"]
  1790. }),
  1791. smalltalk.AmdPackageTransport);
  1792. smalltalk.addMethod(
  1793. smalltalk.method({
  1794. selector: "namespace",
  1795. category: 'accessing',
  1796. fn: function (){
  1797. var self=this;
  1798. return smalltalk.withContext(function($ctx1) {
  1799. var $2,$1;
  1800. $2=self["@namespace"];
  1801. if(($receiver = $2) == nil || $receiver == null){
  1802. $1=self._defaultNamespace();
  1803. } else {
  1804. $1=$2;
  1805. };
  1806. return $1;
  1807. }, function($ctx1) {$ctx1.fill(self,"namespace",{},smalltalk.AmdPackageTransport)})},
  1808. args: [],
  1809. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  1810. messageSends: ["ifNil:", "defaultNamespace"],
  1811. referencedClasses: []
  1812. }),
  1813. smalltalk.AmdPackageTransport);
  1814. smalltalk.addMethod(
  1815. smalltalk.method({
  1816. selector: "namespace:",
  1817. category: 'accessing',
  1818. fn: function (aString){
  1819. var self=this;
  1820. return smalltalk.withContext(function($ctx1) {
  1821. self["@namespace"]=aString;
  1822. return self}, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},smalltalk.AmdPackageTransport)})},
  1823. args: ["aString"],
  1824. source: "namespace: aString\x0a\x09namespace := aString",
  1825. messageSends: [],
  1826. referencedClasses: []
  1827. }),
  1828. smalltalk.AmdPackageTransport);
  1829. smalltalk.addMethod(
  1830. smalltalk.method({
  1831. selector: "setupFromJson:",
  1832. category: 'initialization',
  1833. fn: function (anObject){
  1834. var self=this;
  1835. return smalltalk.withContext(function($ctx1) {
  1836. self._namespace_(_st(anObject)._at_("amdNamespace"));
  1837. return self}, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},smalltalk.AmdPackageTransport)})},
  1838. args: ["anObject"],
  1839. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  1840. messageSends: ["namespace:", "at:"],
  1841. referencedClasses: []
  1842. }),
  1843. smalltalk.AmdPackageTransport);
  1844. smalltalk.addMethod(
  1845. smalltalk.method({
  1846. selector: "namespace:",
  1847. category: 'instance creation',
  1848. fn: function (aString){
  1849. var self=this;
  1850. return smalltalk.withContext(function($ctx1) {
  1851. var $2,$3,$1;
  1852. $2=self._new();
  1853. _st($2)._namespace_(aString);
  1854. $3=_st($2)._yourself();
  1855. $1=$3;
  1856. return $1;
  1857. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},smalltalk.AmdPackageTransport.klass)})},
  1858. args: ["aString"],
  1859. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  1860. messageSends: ["namespace:", "new", "yourself"],
  1861. referencedClasses: []
  1862. }),
  1863. smalltalk.AmdPackageTransport.klass);
  1864. smalltalk.addMethod(
  1865. smalltalk.method({
  1866. selector: "type",
  1867. category: 'accessing',
  1868. fn: function (){
  1869. var self=this;
  1870. return smalltalk.withContext(function($ctx1) {
  1871. return "amd";
  1872. }, function($ctx1) {$ctx1.fill(self,"type",{},smalltalk.AmdPackageTransport.klass)})},
  1873. args: [],
  1874. source: "type\x0a\x09^ 'amd'",
  1875. messageSends: [],
  1876. referencedClasses: []
  1877. }),
  1878. smalltalk.AmdPackageTransport.klass);
  1879. smalltalk.addMethod(
  1880. smalltalk.method({
  1881. selector: "commit",
  1882. category: '*Importer-Exporter',
  1883. fn: function (){
  1884. var self=this;
  1885. return smalltalk.withContext(function($ctx1) {
  1886. var $1;
  1887. $1=_st(self._transport())._commit();
  1888. return $1;
  1889. }, function($ctx1) {$ctx1.fill(self,"commit",{},smalltalk.Package)})},
  1890. args: [],
  1891. source: "commit\x0a\x09^ self transport commit",
  1892. messageSends: ["commit", "transport"],
  1893. referencedClasses: []
  1894. }),
  1895. smalltalk.Package);
  1896. });