Kernel-ImportExport.js 97 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481
  1. define("amber_core/Kernel-ImportExport", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects", "amber_core/Kernel-Infrastructure"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-ImportExport');
  3. smalltalk.packages["Kernel-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AbstractExporter', smalltalk.Object, [], 'Kernel-ImportExport');
  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. protocol: '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. protocol: 'convenience',
  27. fn: function (aClass){
  28. var self=this;
  29. return smalltalk.withContext(function($ctx1) {
  30. var $2,$3,$4,$1;
  31. $2=_st(aClass)._isMetaclass();
  32. if(smalltalk.assert($2)){
  33. $3=_st(_st(aClass)._instanceClass())._name();
  34. $ctx1.sendIdx["name"]=1;
  35. $1=_st($3).__comma(" class");
  36. } else {
  37. $4=_st(aClass)._isNil();
  38. if(smalltalk.assert($4)){
  39. $1="nil";
  40. } else {
  41. $1=_st(aClass)._name();
  42. };
  43. };
  44. return $1;
  45. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.AbstractExporter)})},
  46. args: ["aClass"],
  47. 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 ] ]",
  48. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"],
  49. referencedClasses: []
  50. }),
  51. smalltalk.AbstractExporter);
  52. smalltalk.addMethod(
  53. smalltalk.method({
  54. selector: "exportPackage:on:",
  55. protocol: 'output',
  56. fn: function (aPackage,aStream){
  57. var self=this;
  58. return smalltalk.withContext(function($ctx1) {
  59. self._subclassResponsibility();
  60. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AbstractExporter)})},
  61. args: ["aPackage", "aStream"],
  62. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  63. messageSends: ["subclassResponsibility"],
  64. referencedClasses: []
  65. }),
  66. smalltalk.AbstractExporter);
  67. smalltalk.addMethod(
  68. smalltalk.method({
  69. selector: "extensionMethodsOfPackage:",
  70. protocol: 'accessing',
  71. fn: function (aPackage){
  72. var self=this;
  73. var result;
  74. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  75. return smalltalk.withContext(function($ctx1) {
  76. var $1;
  77. result=_st($OrderedCollection())._new();
  78. _st(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  79. return smalltalk.withContext(function($ctx2) {
  80. return _st(result)._addAll_(_st(each)._methods());
  81. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  82. $1=result;
  83. return $1;
  84. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},smalltalk.AbstractExporter)})},
  85. args: ["aPackage"],
  86. 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",
  87. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"],
  88. referencedClasses: ["OrderedCollection"]
  89. }),
  90. smalltalk.AbstractExporter);
  91. smalltalk.addMethod(
  92. smalltalk.method({
  93. selector: "extensionProtocolsOfPackage:",
  94. protocol: 'accessing',
  95. fn: function (aPackage){
  96. var self=this;
  97. var extensionName,result;
  98. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  99. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  100. function $ExportMethodProtocol(){return smalltalk.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  101. return smalltalk.withContext(function($ctx1) {
  102. var $1,$2;
  103. extensionName="*".__comma(_st(aPackage)._name());
  104. result=_st($OrderedCollection())._new();
  105. _st(_st(_st($Smalltalk())._current())._classes())._do_((function(each){
  106. return smalltalk.withContext(function($ctx2) {
  107. return _st([each,_st(each)._class()])._do_((function(behavior){
  108. return smalltalk.withContext(function($ctx3) {
  109. $1=_st(_st(behavior)._protocols())._includes_(extensionName);
  110. if(smalltalk.assert($1)){
  111. return _st(result)._add_(_st($ExportMethodProtocol())._name_theClass_(extensionName,behavior));
  112. };
  113. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,2)})}));
  114. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  115. $ctx1.sendIdx["do:"]=1;
  116. $2=result;
  117. return $2;
  118. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},smalltalk.AbstractExporter)})},
  119. args: ["aPackage"],
  120. 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",
  121. messageSends: [",", "name", "new", "do:", "classes", "current", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"],
  122. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"]
  123. }),
  124. smalltalk.AbstractExporter);
  125. smalltalk.addClass('ChunkExporter', smalltalk.AbstractExporter, [], 'Kernel-ImportExport');
  126. 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.";
  127. smalltalk.addMethod(
  128. smalltalk.method({
  129. selector: "exportCategoryEpilogueOf:on:",
  130. protocol: 'output',
  131. fn: function (aCategory,aStream){
  132. var self=this;
  133. return smalltalk.withContext(function($ctx1) {
  134. var $1;
  135. _st(aStream)._nextPutAll_(" !");
  136. _st(aStream)._lf();
  137. $ctx1.sendIdx["lf"]=1;
  138. $1=_st(aStream)._lf();
  139. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},smalltalk.ChunkExporter)})},
  140. args: ["aCategory", "aStream"],
  141. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  142. messageSends: ["nextPutAll:", "lf"],
  143. referencedClasses: []
  144. }),
  145. smalltalk.ChunkExporter);
  146. smalltalk.addMethod(
  147. smalltalk.method({
  148. selector: "exportCategoryPrologueOf:on:",
  149. protocol: 'output',
  150. fn: function (aCategory,aStream){
  151. var self=this;
  152. return smalltalk.withContext(function($ctx1) {
  153. var $1,$3,$2;
  154. $1="!".__comma(self._classNameFor_(_st(aCategory)._theClass()));
  155. $ctx1.sendIdx[","]=1;
  156. _st(aStream)._nextPutAll_($1);
  157. $ctx1.sendIdx["nextPutAll:"]=1;
  158. $3=_st(" methodsFor: '".__comma(_st(aCategory)._name())).__comma("'!");
  159. $ctx1.sendIdx[","]=2;
  160. $2=_st(aStream)._nextPutAll_($3);
  161. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},smalltalk.ChunkExporter)})},
  162. args: ["aCategory", "aStream"],
  163. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  164. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"],
  165. referencedClasses: []
  166. }),
  167. smalltalk.ChunkExporter);
  168. smalltalk.addMethod(
  169. smalltalk.method({
  170. selector: "exportDefinitionOf:on:",
  171. protocol: 'output',
  172. fn: function (aClass,aStream){
  173. var self=this;
  174. return smalltalk.withContext(function($ctx1) {
  175. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12;
  176. $1=self._classNameFor_(_st(aClass)._superclass());
  177. $ctx1.sendIdx["classNameFor:"]=1;
  178. _st(aStream)._nextPutAll_($1);
  179. $ctx1.sendIdx["nextPutAll:"]=1;
  180. $3=self._classNameFor_(aClass);
  181. $ctx1.sendIdx["classNameFor:"]=2;
  182. $2=" subclass: #".__comma($3);
  183. $ctx1.sendIdx[","]=1;
  184. _st(aStream)._nextPutAll_($2);
  185. $ctx1.sendIdx["nextPutAll:"]=2;
  186. _st(aStream)._lf();
  187. $ctx1.sendIdx["lf"]=1;
  188. _st(aStream)._tab();
  189. $ctx1.sendIdx["tab"]=1;
  190. $4=_st(aStream)._nextPutAll_("instanceVariableNames: '");
  191. $ctx1.sendIdx["nextPutAll:"]=3;
  192. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  193. return smalltalk.withContext(function($ctx2) {
  194. return _st(aStream)._nextPutAll_(each);
  195. $ctx2.sendIdx["nextPutAll:"]=4;
  196. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  197. return smalltalk.withContext(function($ctx2) {
  198. return _st(aStream)._nextPutAll_(" ");
  199. $ctx2.sendIdx["nextPutAll:"]=5;
  200. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  201. _st(aStream)._nextPutAll_("'");
  202. $ctx1.sendIdx["nextPutAll:"]=6;
  203. _st(aStream)._lf();
  204. $ctx1.sendIdx["lf"]=2;
  205. _st(aStream)._tab();
  206. $6="package: '".__comma(_st(aClass)._category());
  207. $ctx1.sendIdx[","]=3;
  208. $5=_st($6).__comma("'!");
  209. $ctx1.sendIdx[","]=2;
  210. _st(aStream)._nextPutAll_($5);
  211. $ctx1.sendIdx["nextPutAll:"]=7;
  212. $7=_st(aStream)._lf();
  213. $ctx1.sendIdx["lf"]=3;
  214. $9=_st(aClass)._comment();
  215. $ctx1.sendIdx["comment"]=1;
  216. $8=_st($9)._notEmpty();
  217. if(smalltalk.assert($8)){
  218. $11="!".__comma(self._classNameFor_(aClass));
  219. $ctx1.sendIdx[","]=5;
  220. $10=_st($11).__comma(" commentStamp!");
  221. $ctx1.sendIdx[","]=4;
  222. _st(aStream)._nextPutAll_($10);
  223. $ctx1.sendIdx["nextPutAll:"]=8;
  224. _st(aStream)._lf();
  225. $ctx1.sendIdx["lf"]=4;
  226. _st(aStream)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
  227. $12=_st(aStream)._lf();
  228. $ctx1.sendIdx["lf"]=5;
  229. $12;
  230. };
  231. _st(aStream)._lf();
  232. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  233. args: ["aClass", "aStream"],
  234. 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",
  235. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"],
  236. referencedClasses: []
  237. }),
  238. smalltalk.ChunkExporter);
  239. smalltalk.addMethod(
  240. smalltalk.method({
  241. selector: "exportMetaDefinitionOf:on:",
  242. protocol: 'output',
  243. fn: function (aClass,aStream){
  244. var self=this;
  245. return smalltalk.withContext(function($ctx1) {
  246. var $3,$2,$1,$5,$4,$6,$7;
  247. $3=_st(aClass)._class();
  248. $ctx1.sendIdx["class"]=1;
  249. $2=_st($3)._instanceVariableNames();
  250. $ctx1.sendIdx["instanceVariableNames"]=1;
  251. $1=_st($2)._isEmpty();
  252. if(! smalltalk.assert($1)){
  253. $5=_st(aClass)._class();
  254. $ctx1.sendIdx["class"]=2;
  255. $4=self._classNameFor_($5);
  256. _st(aStream)._nextPutAll_($4);
  257. $ctx1.sendIdx["nextPutAll:"]=1;
  258. $6=_st(aStream)._nextPutAll_(" instanceVariableNames: '");
  259. $ctx1.sendIdx["nextPutAll:"]=2;
  260. $6;
  261. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  262. return smalltalk.withContext(function($ctx2) {
  263. return _st(aStream)._nextPutAll_(each);
  264. $ctx2.sendIdx["nextPutAll:"]=3;
  265. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  266. return smalltalk.withContext(function($ctx2) {
  267. return _st(aStream)._nextPutAll_(" ");
  268. $ctx2.sendIdx["nextPutAll:"]=4;
  269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  270. _st(aStream)._nextPutAll_("'!");
  271. _st(aStream)._lf();
  272. $ctx1.sendIdx["lf"]=1;
  273. $7=_st(aStream)._lf();
  274. $7;
  275. };
  276. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  277. args: ["aClass", "aStream"],
  278. 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 ]",
  279. messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"],
  280. referencedClasses: []
  281. }),
  282. smalltalk.ChunkExporter);
  283. smalltalk.addMethod(
  284. smalltalk.method({
  285. selector: "exportMethod:on:",
  286. protocol: 'output',
  287. fn: function (aMethod,aStream){
  288. var self=this;
  289. return smalltalk.withContext(function($ctx1) {
  290. var $1;
  291. _st(aStream)._lf();
  292. $ctx1.sendIdx["lf"]=1;
  293. _st(aStream)._lf();
  294. $ctx1.sendIdx["lf"]=2;
  295. _st(aStream)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
  296. $ctx1.sendIdx["nextPutAll:"]=1;
  297. _st(aStream)._lf();
  298. $1=_st(aStream)._nextPutAll_("!");
  299. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.ChunkExporter)})},
  300. args: ["aMethod", "aStream"],
  301. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  302. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"],
  303. referencedClasses: []
  304. }),
  305. smalltalk.ChunkExporter);
  306. smalltalk.addMethod(
  307. smalltalk.method({
  308. selector: "exportPackage:on:",
  309. protocol: 'output',
  310. fn: function (aPackage,aStream){
  311. var self=this;
  312. return smalltalk.withContext(function($ctx1) {
  313. var $1;
  314. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  315. _st(_st(aPackage)._sortedClasses())._do_((function(each){
  316. return smalltalk.withContext(function($ctx2) {
  317. self._exportDefinitionOf_on_(each,aStream);
  318. $1=self._ownMethodProtocolsOfClass_(each);
  319. $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
  320. self._exportProtocols_on_($1,aStream);
  321. $ctx2.sendIdx["exportProtocols:on:"]=1;
  322. self._exportMetaDefinitionOf_on_(each,aStream);
  323. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_(_st(each)._class()),aStream);
  324. $ctx2.sendIdx["exportProtocols:on:"]=2;
  325. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  326. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  327. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},smalltalk.ChunkExporter)})},
  328. args: ["aPackage", "aStream"],
  329. 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",
  330. messageSends: ["exportPackageDefinitionOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"],
  331. referencedClasses: []
  332. }),
  333. smalltalk.ChunkExporter);
  334. smalltalk.addMethod(
  335. smalltalk.method({
  336. selector: "exportPackageDefinitionOf:on:",
  337. protocol: 'output',
  338. fn: function (aPackage,aStream){
  339. var self=this;
  340. return smalltalk.withContext(function($ctx1) {
  341. var $1,$2;
  342. $1=_st("Smalltalk current createPackage: '".__comma(_st(aPackage)._name())).__comma("'!");
  343. $ctx1.sendIdx[","]=1;
  344. _st(aStream)._nextPutAll_($1);
  345. $2=_st(aStream)._lf();
  346. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.ChunkExporter)})},
  347. args: ["aPackage", "aStream"],
  348. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk current createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  349. messageSends: ["nextPutAll:", ",", "name", "lf"],
  350. referencedClasses: []
  351. }),
  352. smalltalk.ChunkExporter);
  353. smalltalk.addMethod(
  354. smalltalk.method({
  355. selector: "exportProtocol:on:",
  356. protocol: 'output',
  357. fn: function (aProtocol,aStream){
  358. var self=this;
  359. return smalltalk.withContext(function($ctx1) {
  360. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  361. _st(_st(aProtocol)._methods())._do_((function(method){
  362. return smalltalk.withContext(function($ctx2) {
  363. return self._exportMethod_on_(method,aStream);
  364. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)})}));
  365. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  366. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},smalltalk.ChunkExporter)})},
  367. args: ["aProtocol", "aStream"],
  368. 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",
  369. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"],
  370. referencedClasses: []
  371. }),
  372. smalltalk.ChunkExporter);
  373. smalltalk.addMethod(
  374. smalltalk.method({
  375. selector: "exportProtocolEpilogueOf:on:",
  376. protocol: 'output',
  377. fn: function (aProtocol,aStream){
  378. var self=this;
  379. return smalltalk.withContext(function($ctx1) {
  380. var $1;
  381. _st(aStream)._nextPutAll_(" !");
  382. _st(aStream)._lf();
  383. $ctx1.sendIdx["lf"]=1;
  384. $1=_st(aStream)._lf();
  385. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},smalltalk.ChunkExporter)})},
  386. args: ["aProtocol", "aStream"],
  387. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  388. messageSends: ["nextPutAll:", "lf"],
  389. referencedClasses: []
  390. }),
  391. smalltalk.ChunkExporter);
  392. smalltalk.addMethod(
  393. smalltalk.method({
  394. selector: "exportProtocolPrologueOf:on:",
  395. protocol: 'output',
  396. fn: function (aProtocol,aStream){
  397. var self=this;
  398. return smalltalk.withContext(function($ctx1) {
  399. var $1,$3,$2;
  400. $1="!".__comma(self._classNameFor_(_st(aProtocol)._theClass()));
  401. $ctx1.sendIdx[","]=1;
  402. _st(aStream)._nextPutAll_($1);
  403. $ctx1.sendIdx["nextPutAll:"]=1;
  404. $3=_st(" methodsFor: '".__comma(_st(aProtocol)._name())).__comma("'!");
  405. $ctx1.sendIdx[","]=2;
  406. $2=_st(aStream)._nextPutAll_($3);
  407. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},smalltalk.ChunkExporter)})},
  408. args: ["aProtocol", "aStream"],
  409. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  410. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"],
  411. referencedClasses: []
  412. }),
  413. smalltalk.ChunkExporter);
  414. smalltalk.addMethod(
  415. smalltalk.method({
  416. selector: "exportProtocols:on:",
  417. protocol: 'output',
  418. fn: function (aCollection,aStream){
  419. var self=this;
  420. return smalltalk.withContext(function($ctx1) {
  421. _st(aCollection)._do_((function(each){
  422. return smalltalk.withContext(function($ctx2) {
  423. return self._exportProtocol_on_(each,aStream);
  424. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  425. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},smalltalk.ChunkExporter)})},
  426. args: ["aCollection", "aStream"],
  427. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  428. messageSends: ["do:", "exportProtocol:on:"],
  429. referencedClasses: []
  430. }),
  431. smalltalk.ChunkExporter);
  432. smalltalk.addMethod(
  433. smalltalk.method({
  434. selector: "extensionCategoriesOfPackage:",
  435. protocol: 'accessing',
  436. fn: function (aPackage){
  437. var self=this;
  438. var name,map,result;
  439. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  440. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  441. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  442. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  443. function $MethodCategory(){return smalltalk.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  444. return smalltalk.withContext(function($ctx1) {
  445. var $1,$2;
  446. name=_st(aPackage)._name();
  447. result=_st($OrderedCollection())._new();
  448. $ctx1.sendIdx["new"]=1;
  449. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  450. return smalltalk.withContext(function($ctx2) {
  451. return _st([each,_st(each)._class()])._do_((function(aClass){
  452. return smalltalk.withContext(function($ctx3) {
  453. map=_st($Dictionary())._new();
  454. map;
  455. _st(aClass)._protocolsDo_((function(category,methods){
  456. return smalltalk.withContext(function($ctx4) {
  457. $1=_st(category).__eq("*".__comma(name));
  458. if(smalltalk.assert($1)){
  459. return _st(map)._at_put_(category,methods);
  460. };
  461. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)})}));
  462. return _st(result)._addAll_(_st(_st(_st(map)._keys())._sorted_((function(a,b){
  463. return smalltalk.withContext(function($ctx4) {
  464. return _st(a).__lt_eq(b);
  465. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)})})))._collect_((function(category){
  466. return smalltalk.withContext(function($ctx4) {
  467. return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
  468. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)})})));
  469. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)})}));
  470. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  471. $ctx1.sendIdx["do:"]=1;
  472. $2=result;
  473. return $2;
  474. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},smalltalk.ChunkExporter)})},
  475. args: ["aPackage"],
  476. 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",
  477. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "current", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"],
  478. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"]
  479. }),
  480. smalltalk.ChunkExporter);
  481. smalltalk.addMethod(
  482. smalltalk.method({
  483. selector: "ownCategoriesOfClass:",
  484. protocol: 'accessing',
  485. fn: function (aClass){
  486. var self=this;
  487. var map;
  488. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  489. function $MethodCategory(){return smalltalk.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  490. return smalltalk.withContext(function($ctx1) {
  491. var $1,$2;
  492. map=_st($Dictionary())._new();
  493. _st(aClass)._protocolsDo_((function(each,methods){
  494. return smalltalk.withContext(function($ctx2) {
  495. $1=_st(each)._match_("^\x5c*");
  496. if(! smalltalk.assert($1)){
  497. return _st(map)._at_put_(each,methods);
  498. };
  499. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)})}));
  500. $2=_st(_st(_st(map)._keys())._sorted_((function(a,b){
  501. return smalltalk.withContext(function($ctx2) {
  502. return _st(a).__lt_eq(b);
  503. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})})))._collect_((function(each){
  504. return smalltalk.withContext(function($ctx2) {
  505. return _st($MethodCategory())._name_theClass_methods_(each,aClass,_st(map)._at_(each));
  506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  507. return $2;
  508. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},smalltalk.ChunkExporter)})},
  509. args: ["aClass"],
  510. 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) ]",
  511. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"],
  512. referencedClasses: ["Dictionary", "MethodCategory"]
  513. }),
  514. smalltalk.ChunkExporter);
  515. smalltalk.addMethod(
  516. smalltalk.method({
  517. selector: "ownCategoriesOfMetaClass:",
  518. protocol: 'accessing',
  519. fn: function (aClass){
  520. var self=this;
  521. return smalltalk.withContext(function($ctx1) {
  522. var $1;
  523. $1=self._ownCategoriesOfClass_(_st(aClass)._class());
  524. return $1;
  525. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},smalltalk.ChunkExporter)})},
  526. args: ["aClass"],
  527. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
  528. messageSends: ["ownCategoriesOfClass:", "class"],
  529. referencedClasses: []
  530. }),
  531. smalltalk.ChunkExporter);
  532. smalltalk.addMethod(
  533. smalltalk.method({
  534. selector: "ownMethodProtocolsOfClass:",
  535. protocol: 'accessing',
  536. fn: function (aClass){
  537. var self=this;
  538. function $ExportMethodProtocol(){return smalltalk.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  539. return smalltalk.withContext(function($ctx1) {
  540. var $1;
  541. $1=_st(_st(aClass)._ownProtocols())._collect_((function(each){
  542. return smalltalk.withContext(function($ctx2) {
  543. return _st($ExportMethodProtocol())._name_theClass_(each,aClass);
  544. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  545. return $1;
  546. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},smalltalk.ChunkExporter)})},
  547. args: ["aClass"],
  548. 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 ]",
  549. messageSends: ["collect:", "ownProtocols", "name:theClass:"],
  550. referencedClasses: ["ExportMethodProtocol"]
  551. }),
  552. smalltalk.ChunkExporter);
  553. smalltalk.addClass('Exporter', smalltalk.AbstractExporter, [], 'Kernel-ImportExport');
  554. 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.).";
  555. smalltalk.addMethod(
  556. smalltalk.method({
  557. selector: "classNameFor:",
  558. protocol: 'convenience',
  559. fn: function (aClass){
  560. var self=this;
  561. return smalltalk.withContext(function($ctx1) {
  562. var $2,$3,$4,$1;
  563. $2=_st(aClass)._isMetaclass();
  564. if(smalltalk.assert($2)){
  565. $3=_st(_st(aClass)._instanceClass())._name();
  566. $ctx1.sendIdx["name"]=1;
  567. $1=_st($3).__comma(".klass");
  568. } else {
  569. $4=_st(aClass)._isNil();
  570. if(smalltalk.assert($4)){
  571. $1="nil";
  572. } else {
  573. $1=_st(aClass)._name();
  574. };
  575. };
  576. return $1;
  577. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.Exporter)})},
  578. args: ["aClass"],
  579. 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 ] ]",
  580. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"],
  581. referencedClasses: []
  582. }),
  583. smalltalk.Exporter);
  584. smalltalk.addMethod(
  585. smalltalk.method({
  586. selector: "exportDefinitionOf:on:",
  587. protocol: 'output',
  588. fn: function (aClass,aStream){
  589. var self=this;
  590. return smalltalk.withContext(function($ctx1) {
  591. var $3,$2,$1,$5,$4,$6,$8,$7,$9,$11,$10,$12;
  592. _st(aStream)._lf();
  593. $ctx1.sendIdx["lf"]=1;
  594. _st(aStream)._nextPutAll_("smalltalk.addClass(");
  595. $ctx1.sendIdx["nextPutAll:"]=1;
  596. $3=self._classNameFor_(aClass);
  597. $ctx1.sendIdx["classNameFor:"]=1;
  598. $2="'".__comma($3);
  599. $ctx1.sendIdx[","]=2;
  600. $1=_st($2).__comma("', ");
  601. $ctx1.sendIdx[","]=1;
  602. _st(aStream)._nextPutAll_($1);
  603. $ctx1.sendIdx["nextPutAll:"]=2;
  604. $5=self._classNameFor_(_st(aClass)._superclass());
  605. $ctx1.sendIdx["classNameFor:"]=2;
  606. $4="smalltalk.".__comma($5);
  607. $ctx1.sendIdx[","]=3;
  608. _st(aStream)._nextPutAll_($4);
  609. $ctx1.sendIdx["nextPutAll:"]=3;
  610. $6=_st(aStream)._nextPutAll_(", [");
  611. $ctx1.sendIdx["nextPutAll:"]=4;
  612. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  613. return smalltalk.withContext(function($ctx2) {
  614. $8="'".__comma(each);
  615. $ctx2.sendIdx[","]=5;
  616. $7=_st($8).__comma("'");
  617. $ctx2.sendIdx[","]=4;
  618. return _st(aStream)._nextPutAll_($7);
  619. $ctx2.sendIdx["nextPutAll:"]=5;
  620. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  621. return smalltalk.withContext(function($ctx2) {
  622. return _st(aStream)._nextPutAll_(", ");
  623. $ctx2.sendIdx["nextPutAll:"]=6;
  624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  625. _st(aStream)._nextPutAll_("], '");
  626. $ctx1.sendIdx["nextPutAll:"]=7;
  627. _st(aStream)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  628. $ctx1.sendIdx["nextPutAll:"]=8;
  629. $9=_st(aStream)._nextPutAll_(");");
  630. $ctx1.sendIdx["nextPutAll:"]=9;
  631. $11=_st(aClass)._comment();
  632. $ctx1.sendIdx["comment"]=1;
  633. $10=_st($11)._notEmpty();
  634. if(smalltalk.assert($10)){
  635. _st(aStream)._lf();
  636. $ctx1.sendIdx["lf"]=2;
  637. _st(aStream)._nextPutAll_("smalltalk.");
  638. $ctx1.sendIdx["nextPutAll:"]=10;
  639. _st(aStream)._nextPutAll_(self._classNameFor_(aClass));
  640. $ctx1.sendIdx["nextPutAll:"]=11;
  641. _st(aStream)._nextPutAll_(".comment=");
  642. $ctx1.sendIdx["nextPutAll:"]=12;
  643. _st(aStream)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
  644. $ctx1.sendIdx["nextPutAll:"]=13;
  645. $12=_st(aStream)._nextPutAll_(";");
  646. $12;
  647. };
  648. _st(aStream)._lf();
  649. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  650. args: ["aClass", "aStream"],
  651. 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",
  652. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript"],
  653. referencedClasses: []
  654. }),
  655. smalltalk.Exporter);
  656. smalltalk.addMethod(
  657. smalltalk.method({
  658. selector: "exportMetaDefinitionOf:on:",
  659. protocol: 'output',
  660. fn: function (aClass,aStream){
  661. var self=this;
  662. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  663. return smalltalk.withContext(function($ctx1) {
  664. var $3,$2,$1,$6,$5,$4,$7,$9,$8;
  665. _st(aStream)._lf();
  666. $ctx1.sendIdx["lf"]=1;
  667. $3=_st(aClass)._class();
  668. $ctx1.sendIdx["class"]=1;
  669. $2=_st($3)._instanceVariableNames();
  670. $ctx1.sendIdx["instanceVariableNames"]=1;
  671. $1=_st($2)._isEmpty();
  672. if(! smalltalk.assert($1)){
  673. $6=_st(aClass)._class();
  674. $ctx1.sendIdx["class"]=2;
  675. $5=self._classNameFor_($6);
  676. $4="smalltalk.".__comma($5);
  677. $ctx1.sendIdx[","]=1;
  678. _st(aStream)._nextPutAll_($4);
  679. $ctx1.sendIdx["nextPutAll:"]=1;
  680. $7=_st(aStream)._nextPutAll_(".iVarNames = [");
  681. $ctx1.sendIdx["nextPutAll:"]=2;
  682. $7;
  683. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  684. return smalltalk.withContext(function($ctx2) {
  685. $9="'".__comma(each);
  686. $ctx2.sendIdx[","]=3;
  687. $8=_st($9).__comma("'");
  688. $ctx2.sendIdx[","]=2;
  689. return _st(aStream)._nextPutAll_($8);
  690. $ctx2.sendIdx["nextPutAll:"]=3;
  691. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  692. return smalltalk.withContext(function($ctx2) {
  693. return _st(aStream)._nextPutAll_(",");
  694. $ctx2.sendIdx["nextPutAll:"]=4;
  695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  696. _st(aStream)._nextPutAll_("];".__comma(_st($String())._lf()));
  697. };
  698. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  699. args: ["aClass", "aStream"],
  700. 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 ]",
  701. messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", ",", "classNameFor:", "do:separatedBy:"],
  702. referencedClasses: ["String"]
  703. }),
  704. smalltalk.Exporter);
  705. smalltalk.addMethod(
  706. smalltalk.method({
  707. selector: "exportMethod:on:",
  708. protocol: 'output',
  709. fn: function (aMethod,aStream){
  710. var self=this;
  711. return smalltalk.withContext(function($ctx1) {
  712. var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14,$18,$17,$19;
  713. _st(aStream)._nextPutAll_("smalltalk.addMethod(");
  714. $ctx1.sendIdx["nextPutAll:"]=1;
  715. _st(aStream)._lf();
  716. $ctx1.sendIdx["lf"]=1;
  717. _st(aStream)._nextPutAll_("smalltalk.method({");
  718. $ctx1.sendIdx["nextPutAll:"]=2;
  719. _st(aStream)._lf();
  720. $ctx1.sendIdx["lf"]=2;
  721. $3=_st(_st(aMethod)._selector())._asJavascript();
  722. $ctx1.sendIdx["asJavascript"]=1;
  723. $2="selector: ".__comma($3);
  724. $ctx1.sendIdx[","]=2;
  725. $1=_st($2).__comma(",");
  726. $ctx1.sendIdx[","]=1;
  727. _st(aStream)._nextPutAll_($1);
  728. $ctx1.sendIdx["nextPutAll:"]=3;
  729. _st(aStream)._lf();
  730. $ctx1.sendIdx["lf"]=3;
  731. $5="protocol: '".__comma(_st(aMethod)._protocol());
  732. $ctx1.sendIdx[","]=4;
  733. $4=_st($5).__comma("',");
  734. $ctx1.sendIdx[","]=3;
  735. _st(aStream)._nextPutAll_($4);
  736. $ctx1.sendIdx["nextPutAll:"]=4;
  737. _st(aStream)._lf();
  738. $ctx1.sendIdx["lf"]=4;
  739. $7="fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource());
  740. $ctx1.sendIdx[","]=6;
  741. $6=_st($7).__comma(",");
  742. $ctx1.sendIdx[","]=5;
  743. _st(aStream)._nextPutAll_($6);
  744. $ctx1.sendIdx["nextPutAll:"]=5;
  745. _st(aStream)._lf();
  746. $ctx1.sendIdx["lf"]=5;
  747. $10=_st(_st(aMethod)._arguments())._asJavascript();
  748. $ctx1.sendIdx["asJavascript"]=2;
  749. $9="args: ".__comma($10);
  750. $ctx1.sendIdx[","]=8;
  751. $8=_st($9).__comma(",");
  752. $ctx1.sendIdx[","]=7;
  753. _st(aStream)._nextPutAll_($8);
  754. $ctx1.sendIdx["nextPutAll:"]=6;
  755. _st(aStream)._lf();
  756. $ctx1.sendIdx["lf"]=6;
  757. $13=_st(_st(aMethod)._source())._asJavascript();
  758. $ctx1.sendIdx["asJavascript"]=3;
  759. $12="source: ".__comma($13);
  760. $ctx1.sendIdx[","]=10;
  761. $11=_st($12).__comma(",");
  762. $ctx1.sendIdx[","]=9;
  763. _st(aStream)._nextPutAll_($11);
  764. $ctx1.sendIdx["nextPutAll:"]=7;
  765. _st(aStream)._lf();
  766. $ctx1.sendIdx["lf"]=7;
  767. $16=_st(_st(aMethod)._messageSends())._asJavascript();
  768. $ctx1.sendIdx["asJavascript"]=4;
  769. $15="messageSends: ".__comma($16);
  770. $ctx1.sendIdx[","]=12;
  771. $14=_st($15).__comma(",");
  772. $ctx1.sendIdx[","]=11;
  773. _st(aStream)._nextPutAll_($14);
  774. $ctx1.sendIdx["nextPutAll:"]=8;
  775. _st(aStream)._lf();
  776. $ctx1.sendIdx["lf"]=8;
  777. $18="referencedClasses: ".__comma(_st(_st(aMethod)._referencedClasses())._asJavascript());
  778. $ctx1.sendIdx[","]=13;
  779. $17=_st(aStream)._nextPutAll_($18);
  780. $ctx1.sendIdx["nextPutAll:"]=9;
  781. _st(aStream)._lf();
  782. $ctx1.sendIdx["lf"]=9;
  783. _st(aStream)._nextPutAll_("}),");
  784. $ctx1.sendIdx["nextPutAll:"]=10;
  785. _st(aStream)._lf();
  786. $ctx1.sendIdx["lf"]=10;
  787. _st(aStream)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
  788. $ctx1.sendIdx["nextPutAll:"]=11;
  789. _st(aStream)._nextPutAll_(");");
  790. _st(aStream)._lf();
  791. $ctx1.sendIdx["lf"]=11;
  792. $19=_st(aStream)._lf();
  793. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.Exporter)})},
  794. args: ["aMethod", "aStream"],
  795. 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: 'protocol: ''', aMethod protocol, ''',';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",
  796. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:", "methodClass"],
  797. referencedClasses: []
  798. }),
  799. smalltalk.Exporter);
  800. smalltalk.addMethod(
  801. smalltalk.method({
  802. selector: "exportPackage:on:",
  803. protocol: 'output',
  804. fn: function (aPackage,aStream){
  805. var self=this;
  806. return smalltalk.withContext(function($ctx1) {
  807. var $1,$2;
  808. self._exportPackagePrologueOf_on_(aPackage,aStream);
  809. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  810. $1=self._exportPackageTransportOf_on_(aPackage,aStream);
  811. _st(_st(aPackage)._sortedClasses())._do_((function(each){
  812. return smalltalk.withContext(function($ctx2) {
  813. self._exportDefinitionOf_on_(each,aStream);
  814. $2=_st(each)._ownMethods();
  815. $ctx2.sendIdx["ownMethods"]=1;
  816. _st($2)._do_((function(method){
  817. return smalltalk.withContext(function($ctx3) {
  818. return self._exportMethod_on_(method,aStream);
  819. $ctx3.sendIdx["exportMethod:on:"]=1;
  820. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)})}));
  821. $ctx2.sendIdx["do:"]=2;
  822. self._exportMetaDefinitionOf_on_(each,aStream);
  823. return _st(_st(_st(each)._class())._ownMethods())._do_((function(method){
  824. return smalltalk.withContext(function($ctx3) {
  825. return self._exportMethod_on_(method,aStream);
  826. $ctx3.sendIdx["exportMethod:on:"]=2;
  827. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)})}));
  828. $ctx2.sendIdx["do:"]=3;
  829. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  830. $ctx1.sendIdx["do:"]=1;
  831. _st(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  832. return smalltalk.withContext(function($ctx2) {
  833. return self._exportMethod_on_(each,aStream);
  834. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  835. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  836. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  837. args: ["aPackage", "aStream"],
  838. 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",
  839. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"],
  840. referencedClasses: []
  841. }),
  842. smalltalk.Exporter);
  843. smalltalk.addMethod(
  844. smalltalk.method({
  845. selector: "exportPackageDefinitionOf:on:",
  846. protocol: 'output',
  847. fn: function (aPackage,aStream){
  848. var self=this;
  849. return smalltalk.withContext(function($ctx1) {
  850. var $1,$2;
  851. _st(aStream)._nextPutAll_("smalltalk.addPackage(");
  852. $ctx1.sendIdx["nextPutAll:"]=1;
  853. $1=_st("'".__comma(_st(aPackage)._name())).__comma("');");
  854. $ctx1.sendIdx[","]=1;
  855. _st(aStream)._nextPutAll_($1);
  856. $2=_st(aStream)._lf();
  857. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  858. args: ["aPackage", "aStream"],
  859. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  860. messageSends: ["nextPutAll:", ",", "name", "lf"],
  861. referencedClasses: []
  862. }),
  863. smalltalk.Exporter);
  864. smalltalk.addMethod(
  865. smalltalk.method({
  866. selector: "exportPackageEpilogueOf:on:",
  867. protocol: 'output',
  868. fn: function (aPackage,aStream){
  869. var self=this;
  870. return smalltalk.withContext(function($ctx1) {
  871. var $1;
  872. _st(aStream)._nextPutAll_("})(global_smalltalk,global_nil,global__st);");
  873. $1=_st(aStream)._lf();
  874. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  875. args: ["aPackage", "aStream"],
  876. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '})(global_smalltalk,global_nil,global__st);';\x0a\x09\x09lf",
  877. messageSends: ["nextPutAll:", "lf"],
  878. referencedClasses: []
  879. }),
  880. smalltalk.Exporter);
  881. smalltalk.addMethod(
  882. smalltalk.method({
  883. selector: "exportPackagePrologueOf:on:",
  884. protocol: 'output',
  885. fn: function (aPackage,aStream){
  886. var self=this;
  887. return smalltalk.withContext(function($ctx1) {
  888. var $1;
  889. _st(aStream)._nextPutAll_("(function(smalltalk,nil,_st){");
  890. $1=_st(aStream)._lf();
  891. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  892. args: ["aPackage", "aStream"],
  893. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '(function(smalltalk,nil,_st){';\x0a\x09\x09lf",
  894. messageSends: ["nextPutAll:", "lf"],
  895. referencedClasses: []
  896. }),
  897. smalltalk.Exporter);
  898. smalltalk.addMethod(
  899. smalltalk.method({
  900. selector: "exportPackageTransportOf:on:",
  901. protocol: 'output',
  902. fn: function (aPackage,aStream){
  903. var self=this;
  904. return smalltalk.withContext(function($ctx1) {
  905. var $1;
  906. _st(aStream)._nextPutAll_("smalltalk.packages[");
  907. $ctx1.sendIdx["nextPutAll:"]=1;
  908. _st(aStream)._nextPutAll_(_st(_st(aPackage)._name())._asJavascript());
  909. $ctx1.sendIdx["nextPutAll:"]=2;
  910. _st(aStream)._nextPutAll_("].transport = ");
  911. $ctx1.sendIdx["nextPutAll:"]=3;
  912. _st(aStream)._nextPutAll_(_st(_st(aPackage)._transport())._asJSONString());
  913. $ctx1.sendIdx["nextPutAll:"]=4;
  914. _st(aStream)._nextPutAll_(";");
  915. $1=_st(aStream)._lf();
  916. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  917. args: ["aPackage", "aStream"],
  918. 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",
  919. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"],
  920. referencedClasses: []
  921. }),
  922. smalltalk.Exporter);
  923. smalltalk.addMethod(
  924. smalltalk.method({
  925. selector: "ownMethodsOfClass:",
  926. protocol: 'accessing',
  927. fn: function (aClass){
  928. var self=this;
  929. return smalltalk.withContext(function($ctx1) {
  930. var $2,$1;
  931. $1=_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  932. return smalltalk.withContext(function($ctx2) {
  933. $2=_st(a)._selector();
  934. $ctx2.sendIdx["selector"]=1;
  935. return _st($2).__lt_eq(_st(b)._selector());
  936. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})})))._reject_((function(each){
  937. return smalltalk.withContext(function($ctx2) {
  938. return _st(_st(each)._protocol())._match_("^\x5c*");
  939. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  940. return $1;
  941. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},smalltalk.Exporter)})},
  942. args: ["aClass"],
  943. 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 protocol match: '^\x5c*') ]",
  944. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"],
  945. referencedClasses: []
  946. }),
  947. smalltalk.Exporter);
  948. smalltalk.addMethod(
  949. smalltalk.method({
  950. selector: "ownMethodsOfMetaClass:",
  951. protocol: 'accessing',
  952. fn: function (aClass){
  953. var self=this;
  954. return smalltalk.withContext(function($ctx1) {
  955. var $1;
  956. $1=self._ownMethodsOfClass_(_st(aClass)._class());
  957. return $1;
  958. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},smalltalk.Exporter)})},
  959. args: ["aClass"],
  960. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
  961. messageSends: ["ownMethodsOfClass:", "class"],
  962. referencedClasses: []
  963. }),
  964. smalltalk.Exporter);
  965. smalltalk.addClass('AmdExporter', smalltalk.Exporter, ['namespace'], 'Kernel-ImportExport');
  966. smalltalk.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  967. smalltalk.addMethod(
  968. smalltalk.method({
  969. selector: "amdNamesOfPackages:",
  970. protocol: 'private',
  971. fn: function (anArray){
  972. var self=this;
  973. return smalltalk.withContext(function($ctx1) {
  974. var $2,$1;
  975. $1=_st(_st(anArray)._select_((function(each){
  976. return smalltalk.withContext(function($ctx2) {
  977. $2=self._amdNamespaceOfPackage_(each);
  978. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  979. return _st($2)._notNil();
  980. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._collect_((function(each){
  981. return smalltalk.withContext(function($ctx2) {
  982. return _st(_st(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma(_st(each)._name());
  983. $ctx2.sendIdx[","]=1;
  984. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  985. return $1;
  986. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},smalltalk.AmdExporter)})},
  987. args: ["anArray"],
  988. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  989. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"],
  990. referencedClasses: []
  991. }),
  992. smalltalk.AmdExporter);
  993. smalltalk.addMethod(
  994. smalltalk.method({
  995. selector: "amdNamespaceOfPackage:",
  996. protocol: 'private',
  997. fn: function (aPackage){
  998. var self=this;
  999. return smalltalk.withContext(function($ctx1) {
  1000. var $4,$3,$2,$1;
  1001. $4=_st(aPackage)._transport();
  1002. $ctx1.sendIdx["transport"]=1;
  1003. $3=_st($4)._type();
  1004. $2=_st($3).__eq("amd");
  1005. if(smalltalk.assert($2)){
  1006. $1=_st(_st(aPackage)._transport())._namespace();
  1007. } else {
  1008. $1=nil;
  1009. };
  1010. return $1;
  1011. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},smalltalk.AmdExporter)})},
  1012. args: ["aPackage"],
  1013. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  1014. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"],
  1015. referencedClasses: []
  1016. }),
  1017. smalltalk.AmdExporter);
  1018. smalltalk.addMethod(
  1019. smalltalk.method({
  1020. selector: "exportPackageEpilogueOf:on:",
  1021. protocol: 'output',
  1022. fn: function (aPackage,aStream){
  1023. var self=this;
  1024. return smalltalk.withContext(function($ctx1) {
  1025. var $1;
  1026. _st(aStream)._nextPutAll_("});");
  1027. $1=_st(aStream)._lf();
  1028. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter)})},
  1029. args: ["aPackage", "aStream"],
  1030. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  1031. messageSends: ["nextPutAll:", "lf"],
  1032. referencedClasses: []
  1033. }),
  1034. smalltalk.AmdExporter);
  1035. smalltalk.addMethod(
  1036. smalltalk.method({
  1037. selector: "exportPackagePrologueOf:on:",
  1038. protocol: 'output',
  1039. fn: function (aPackage,aStream){
  1040. var self=this;
  1041. return smalltalk.withContext(function($ctx1) {
  1042. var $1;
  1043. _st(aStream)._nextPutAll_("define(\x22");
  1044. $ctx1.sendIdx["nextPutAll:"]=1;
  1045. _st(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
  1046. $ctx1.sendIdx["nextPutAll:"]=2;
  1047. _st(aStream)._nextPutAll_("/");
  1048. $ctx1.sendIdx["nextPutAll:"]=3;
  1049. _st(aStream)._nextPutAll_(_st(aPackage)._name());
  1050. $ctx1.sendIdx["nextPutAll:"]=4;
  1051. _st(aStream)._nextPutAll_("\x22, ");
  1052. $ctx1.sendIdx["nextPutAll:"]=5;
  1053. _st(aStream)._nextPutAll_(_st(["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st"].__comma(self._amdNamesOfPackages_(_st(aPackage)._loadDependencies())))._asJavascript());
  1054. $ctx1.sendIdx["nextPutAll:"]=6;
  1055. _st(aStream)._nextPutAll_(", function(smalltalk,nil,_st){");
  1056. $1=_st(aStream)._lf();
  1057. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter)})},
  1058. args: ["aPackage", "aStream"],
  1059. 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",
  1060. messageSends: ["nextPutAll:", "amdNamespaceOfPackage:", "name", "asJavascript", ",", "amdNamesOfPackages:", "loadDependencies", "lf"],
  1061. referencedClasses: []
  1062. }),
  1063. smalltalk.AmdExporter);
  1064. smalltalk.addClass('ChunkParser', smalltalk.Object, ['stream', 'last'], 'Kernel-ImportExport');
  1065. 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";
  1066. smalltalk.addMethod(
  1067. smalltalk.method({
  1068. selector: "last",
  1069. protocol: 'accessing',
  1070. fn: function (){
  1071. var self=this;
  1072. return smalltalk.withContext(function($ctx1) {
  1073. var $1;
  1074. $1=self["@last"];
  1075. return $1;
  1076. }, function($ctx1) {$ctx1.fill(self,"last",{},smalltalk.ChunkParser)})},
  1077. args: [],
  1078. source: "last\x0a\x09^ last",
  1079. messageSends: [],
  1080. referencedClasses: []
  1081. }),
  1082. smalltalk.ChunkParser);
  1083. smalltalk.addMethod(
  1084. smalltalk.method({
  1085. selector: "nextChunk",
  1086. protocol: 'reading',
  1087. fn: function (){
  1088. var self=this;
  1089. var char,result,chunk;
  1090. return smalltalk.withContext(function($ctx1) {
  1091. var $1,$2,$3,$4;
  1092. var $early={};
  1093. try {
  1094. result=""._writeStream();
  1095. _st((function(){
  1096. return smalltalk.withContext(function($ctx2) {
  1097. char=_st(self["@stream"])._next();
  1098. $ctx2.sendIdx["next"]=1;
  1099. char;
  1100. return _st(char)._notNil();
  1101. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  1102. return smalltalk.withContext(function($ctx2) {
  1103. $1=_st(char).__eq("!");
  1104. $ctx2.sendIdx["="]=1;
  1105. if(smalltalk.assert($1)){
  1106. $2=_st(_st(self["@stream"])._peek()).__eq("!");
  1107. if(smalltalk.assert($2)){
  1108. _st(self["@stream"])._next();
  1109. } else {
  1110. self["@last"]=_st(_st(result)._contents())._trimBoth();
  1111. $3=self["@last"];
  1112. throw $early=[$3];
  1113. };
  1114. };
  1115. return _st(result)._nextPut_(char);
  1116. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1117. self["@last"]=nil;
  1118. $4=self["@last"];
  1119. return $4;
  1120. }
  1121. catch(e) {if(e===$early)return e[0]; throw e}
  1122. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},smalltalk.ChunkParser)})},
  1123. args: [],
  1124. 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: [ ^ last := result contents trimBoth \x22chunk end marker found\x22 ]].\x0a\x09\x09\x09\x09result nextPut: char ].\x0a\x09^ last := nil \x22a chunk needs to end with !\x22",
  1125. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"],
  1126. referencedClasses: []
  1127. }),
  1128. smalltalk.ChunkParser);
  1129. smalltalk.addMethod(
  1130. smalltalk.method({
  1131. selector: "stream:",
  1132. protocol: 'accessing',
  1133. fn: function (aStream){
  1134. var self=this;
  1135. return smalltalk.withContext(function($ctx1) {
  1136. self["@stream"]=aStream;
  1137. return self}, function($ctx1) {$ctx1.fill(self,"stream:",{aStream:aStream},smalltalk.ChunkParser)})},
  1138. args: ["aStream"],
  1139. source: "stream: aStream\x0a\x09stream := aStream",
  1140. messageSends: [],
  1141. referencedClasses: []
  1142. }),
  1143. smalltalk.ChunkParser);
  1144. smalltalk.addMethod(
  1145. smalltalk.method({
  1146. selector: "on:",
  1147. protocol: 'instance creation',
  1148. fn: function (aStream){
  1149. var self=this;
  1150. return smalltalk.withContext(function($ctx1) {
  1151. var $1;
  1152. $1=_st(self._new())._stream_(aStream);
  1153. return $1;
  1154. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},smalltalk.ChunkParser.klass)})},
  1155. args: ["aStream"],
  1156. source: "on: aStream\x0a\x09^ self new stream: aStream",
  1157. messageSends: ["stream:", "new"],
  1158. referencedClasses: []
  1159. }),
  1160. smalltalk.ChunkParser.klass);
  1161. smalltalk.addClass('ExportMethodProtocol', smalltalk.Object, ['name', 'theClass'], 'Kernel-ImportExport');
  1162. 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.";
  1163. smalltalk.addMethod(
  1164. smalltalk.method({
  1165. selector: "methods",
  1166. protocol: 'accessing',
  1167. fn: function (){
  1168. var self=this;
  1169. return smalltalk.withContext(function($ctx1) {
  1170. var $2,$1;
  1171. $1=_st(_st(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  1172. return smalltalk.withContext(function($ctx2) {
  1173. $2=_st(a)._selector();
  1174. $ctx2.sendIdx["selector"]=1;
  1175. return _st($2).__lt_eq(_st(b)._selector());
  1176. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})}));
  1177. return $1;
  1178. }, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.ExportMethodProtocol)})},
  1179. args: [],
  1180. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  1181. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"],
  1182. referencedClasses: []
  1183. }),
  1184. smalltalk.ExportMethodProtocol);
  1185. smalltalk.addMethod(
  1186. smalltalk.method({
  1187. selector: "name",
  1188. protocol: 'accessing',
  1189. fn: function (){
  1190. var self=this;
  1191. return smalltalk.withContext(function($ctx1) {
  1192. var $1;
  1193. $1=self["@name"];
  1194. return $1;
  1195. }, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.ExportMethodProtocol)})},
  1196. args: [],
  1197. source: "name\x0a\x09^ name",
  1198. messageSends: [],
  1199. referencedClasses: []
  1200. }),
  1201. smalltalk.ExportMethodProtocol);
  1202. smalltalk.addMethod(
  1203. smalltalk.method({
  1204. selector: "name:",
  1205. protocol: 'accessing',
  1206. fn: function (aString){
  1207. var self=this;
  1208. return smalltalk.withContext(function($ctx1) {
  1209. self["@name"]=aString;
  1210. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.ExportMethodProtocol)})},
  1211. args: ["aString"],
  1212. source: "name: aString\x0a\x09name := aString",
  1213. messageSends: [],
  1214. referencedClasses: []
  1215. }),
  1216. smalltalk.ExportMethodProtocol);
  1217. smalltalk.addMethod(
  1218. smalltalk.method({
  1219. selector: "theClass",
  1220. protocol: 'accessing',
  1221. fn: function (){
  1222. var self=this;
  1223. return smalltalk.withContext(function($ctx1) {
  1224. var $1;
  1225. $1=self["@theClass"];
  1226. return $1;
  1227. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ExportMethodProtocol)})},
  1228. args: [],
  1229. source: "theClass\x0a\x09^ theClass",
  1230. messageSends: [],
  1231. referencedClasses: []
  1232. }),
  1233. smalltalk.ExportMethodProtocol);
  1234. smalltalk.addMethod(
  1235. smalltalk.method({
  1236. selector: "theClass:",
  1237. protocol: 'accessing',
  1238. fn: function (aClass){
  1239. var self=this;
  1240. return smalltalk.withContext(function($ctx1) {
  1241. self["@theClass"]=aClass;
  1242. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ExportMethodProtocol)})},
  1243. args: ["aClass"],
  1244. source: "theClass: aClass\x0a\x09theClass := aClass",
  1245. messageSends: [],
  1246. referencedClasses: []
  1247. }),
  1248. smalltalk.ExportMethodProtocol);
  1249. smalltalk.addMethod(
  1250. smalltalk.method({
  1251. selector: "name:theClass:",
  1252. protocol: 'instance creation',
  1253. fn: function (aString,aClass){
  1254. var self=this;
  1255. return smalltalk.withContext(function($ctx1) {
  1256. var $2,$3,$1;
  1257. $2=self._new();
  1258. _st($2)._name_(aString);
  1259. _st($2)._theClass_(aClass);
  1260. $3=_st($2)._yourself();
  1261. $1=$3;
  1262. return $1;
  1263. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},smalltalk.ExportMethodProtocol.klass)})},
  1264. args: ["aString", "aClass"],
  1265. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  1266. messageSends: ["name:", "new", "theClass:", "yourself"],
  1267. referencedClasses: []
  1268. }),
  1269. smalltalk.ExportMethodProtocol.klass);
  1270. smalltalk.addClass('Importer', smalltalk.Object, ['lastSection', 'lastChunk'], 'Kernel-ImportExport');
  1271. smalltalk.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "import:",
  1275. protocol: 'fileIn',
  1276. fn: function (aStream){
  1277. var self=this;
  1278. var chunk,result,parser,lastEmpty;
  1279. function $ChunkParser(){return smalltalk.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  1280. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  1281. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1282. return smalltalk.withContext(function($ctx1) {
  1283. var $1,$2;
  1284. parser=_st($ChunkParser())._on_(aStream);
  1285. lastEmpty=false;
  1286. self["@lastSection"]="n/a, not started";
  1287. self["@lastChunk"]=nil;
  1288. _st((function(){
  1289. return smalltalk.withContext(function($ctx2) {
  1290. _st((function(){
  1291. return smalltalk.withContext(function($ctx3) {
  1292. chunk=_st(parser)._nextChunk();
  1293. chunk;
  1294. return _st(chunk)._isNil();
  1295. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._whileFalse_((function(){
  1296. return smalltalk.withContext(function($ctx3) {
  1297. $1=_st(chunk)._isEmpty();
  1298. if(smalltalk.assert($1)){
  1299. lastEmpty=true;
  1300. return lastEmpty;
  1301. } else {
  1302. self["@lastSection"]=chunk;
  1303. self["@lastSection"];
  1304. result=_st(_st($Compiler())._new())._evaluateExpression_(chunk);
  1305. result;
  1306. $2=lastEmpty;
  1307. if(smalltalk.assert($2)){
  1308. lastEmpty=false;
  1309. lastEmpty;
  1310. return _st(result)._scanFrom_(parser);
  1311. };
  1312. };
  1313. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  1314. self["@lastSection"]="n/a, finished";
  1315. return self["@lastSection"];
  1316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(e){
  1317. return smalltalk.withContext(function($ctx2) {
  1318. self["@lastChunk"]=_st(parser)._last();
  1319. self["@lastChunk"];
  1320. return _st(e)._signal();
  1321. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)})}));
  1322. return self}, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},smalltalk.Importer)})},
  1323. args: ["aStream"],
  1324. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\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\x09lastSection := chunk.\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 ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e signal ].",
  1325. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "signal"],
  1326. referencedClasses: ["ChunkParser", "Compiler", "Error"]
  1327. }),
  1328. smalltalk.Importer);
  1329. smalltalk.addMethod(
  1330. smalltalk.method({
  1331. selector: "lastChunk",
  1332. protocol: 'accessing',
  1333. fn: function (){
  1334. var self=this;
  1335. return smalltalk.withContext(function($ctx1) {
  1336. var $1;
  1337. $1=self["@lastChunk"];
  1338. return $1;
  1339. }, function($ctx1) {$ctx1.fill(self,"lastChunk",{},smalltalk.Importer)})},
  1340. args: [],
  1341. source: "lastChunk\x0a\x09^ lastChunk",
  1342. messageSends: [],
  1343. referencedClasses: []
  1344. }),
  1345. smalltalk.Importer);
  1346. smalltalk.addMethod(
  1347. smalltalk.method({
  1348. selector: "lastSection",
  1349. protocol: 'accessing',
  1350. fn: function (){
  1351. var self=this;
  1352. return smalltalk.withContext(function($ctx1) {
  1353. var $1;
  1354. $1=self["@lastSection"];
  1355. return $1;
  1356. }, function($ctx1) {$ctx1.fill(self,"lastSection",{},smalltalk.Importer)})},
  1357. args: [],
  1358. source: "lastSection\x0a\x09^ lastSection",
  1359. messageSends: [],
  1360. referencedClasses: []
  1361. }),
  1362. smalltalk.Importer);
  1363. smalltalk.addClass('PackageHandler', smalltalk.InterfacingObject, [], 'Kernel-ImportExport');
  1364. 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.";
  1365. smalltalk.addMethod(
  1366. smalltalk.method({
  1367. selector: "ajaxPutAt:data:",
  1368. protocol: 'private',
  1369. fn: function (aURL,aString){
  1370. var self=this;
  1371. return smalltalk.withContext(function($ctx1) {
  1372. var $2,$3,$4,$5,$8,$7,$6,$1;
  1373. $2="url".__minus_gt(aURL);
  1374. $ctx1.sendIdx["->"]=1;
  1375. $3="type".__minus_gt("PUT");
  1376. $ctx1.sendIdx["->"]=2;
  1377. $4="data".__minus_gt(aString);
  1378. $ctx1.sendIdx["->"]=3;
  1379. $5="contentType".__minus_gt("text/plain;charset=UTF-8");
  1380. $ctx1.sendIdx["->"]=4;
  1381. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,"error".__minus_gt((function(xhr){
  1382. return smalltalk.withContext(function($ctx2) {
  1383. $8=_st("Commiting ".__comma(aURL)).__comma(" failed with reason: \x22");
  1384. $ctx2.sendIdx[","]=3;
  1385. $7=_st($8).__comma(_st(xhr)._responseText());
  1386. $ctx2.sendIdx[","]=2;
  1387. $6=_st($7).__comma("\x22");
  1388. $ctx2.sendIdx[","]=1;
  1389. return self._alert_($6);
  1390. }, function($ctx2) {$ctx2.fillBlock({xhr:xhr},$ctx1,1)})}))]);
  1391. self._ajax_($1);
  1392. return self}, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:",{aURL:aURL,aString:aString},smalltalk.PackageHandler)})},
  1393. args: ["aURL", "aString"],
  1394. 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 alert: 'Commiting ' , aURL , ' failed with reason: \x22' , (xhr responseText) , '\x22' ] }",
  1395. messageSends: ["ajax:", "->", "alert:", ",", "responseText"],
  1396. referencedClasses: []
  1397. }),
  1398. smalltalk.PackageHandler);
  1399. smalltalk.addMethod(
  1400. smalltalk.method({
  1401. selector: "chunkContentsFor:",
  1402. protocol: 'accessing',
  1403. fn: function (aPackage){
  1404. var self=this;
  1405. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1406. return smalltalk.withContext(function($ctx1) {
  1407. var $1;
  1408. $1=_st($String())._streamContents_((function(str){
  1409. return smalltalk.withContext(function($ctx2) {
  1410. return _st(self._chunkExporter())._exportPackage_on_(aPackage,str);
  1411. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  1412. return $1;
  1413. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1414. args: ["aPackage"],
  1415. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  1416. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"],
  1417. referencedClasses: ["String"]
  1418. }),
  1419. smalltalk.PackageHandler);
  1420. smalltalk.addMethod(
  1421. smalltalk.method({
  1422. selector: "chunkExporter",
  1423. protocol: 'factory',
  1424. fn: function (){
  1425. var self=this;
  1426. return smalltalk.withContext(function($ctx1) {
  1427. var $1;
  1428. $1=_st(self._chunkExporterClass())._new();
  1429. return $1;
  1430. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},smalltalk.PackageHandler)})},
  1431. args: [],
  1432. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  1433. messageSends: ["new", "chunkExporterClass"],
  1434. referencedClasses: []
  1435. }),
  1436. smalltalk.PackageHandler);
  1437. smalltalk.addMethod(
  1438. smalltalk.method({
  1439. selector: "chunkExporterClass",
  1440. protocol: 'accessing',
  1441. fn: function (){
  1442. var self=this;
  1443. function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  1444. return smalltalk.withContext(function($ctx1) {
  1445. return $ChunkExporter();
  1446. }, function($ctx1) {$ctx1.fill(self,"chunkExporterClass",{},smalltalk.PackageHandler)})},
  1447. args: [],
  1448. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  1449. messageSends: [],
  1450. referencedClasses: ["ChunkExporter"]
  1451. }),
  1452. smalltalk.PackageHandler);
  1453. smalltalk.addMethod(
  1454. smalltalk.method({
  1455. selector: "commit:",
  1456. protocol: 'committing',
  1457. fn: function (aPackage){
  1458. var self=this;
  1459. return smalltalk.withContext(function($ctx1) {
  1460. _st([(function(){
  1461. return smalltalk.withContext(function($ctx2) {
  1462. return self._commitStFileFor_(aPackage);
  1463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  1464. return smalltalk.withContext(function($ctx2) {
  1465. return self._commitJsFileFor_(aPackage);
  1466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})])._do_displayingProgress_((function(each){
  1467. return smalltalk.withContext(function($ctx2) {
  1468. return _st(each)._value();
  1469. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}),"Committing package ".__comma(_st(aPackage)._name()));
  1470. return self}, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1471. args: ["aPackage"],
  1472. 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",
  1473. messageSends: ["do:displayingProgress:", "commitStFileFor:", "commitJsFileFor:", "value", ",", "name"],
  1474. referencedClasses: []
  1475. }),
  1476. smalltalk.PackageHandler);
  1477. smalltalk.addMethod(
  1478. smalltalk.method({
  1479. selector: "commitJsFileFor:",
  1480. protocol: 'committing',
  1481. fn: function (aPackage){
  1482. var self=this;
  1483. return smalltalk.withContext(function($ctx1) {
  1484. var $2,$1;
  1485. $2=_st(_st(self._commitPathJsFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
  1486. $ctx1.sendIdx[","]=2;
  1487. $1=_st($2).__comma(".js");
  1488. $ctx1.sendIdx[","]=1;
  1489. self._ajaxPutAt_data_($1,self._contentsFor_(aPackage));
  1490. return self}, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1491. args: ["aPackage"],
  1492. source: "commitJsFileFor: aPackage\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathJsFor: aPackage), '/', aPackage name, '.js'\x0a\x09\x09data: (self contentsFor: aPackage)",
  1493. messageSends: ["ajaxPutAt:data:", ",", "commitPathJsFor:", "name", "contentsFor:"],
  1494. referencedClasses: []
  1495. }),
  1496. smalltalk.PackageHandler);
  1497. smalltalk.addMethod(
  1498. smalltalk.method({
  1499. selector: "commitPathJsFor:",
  1500. protocol: 'accessing',
  1501. fn: function (aPackage){
  1502. var self=this;
  1503. return smalltalk.withContext(function($ctx1) {
  1504. self._subclassResponsibility();
  1505. return self}, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1506. args: ["aPackage"],
  1507. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  1508. messageSends: ["subclassResponsibility"],
  1509. referencedClasses: []
  1510. }),
  1511. smalltalk.PackageHandler);
  1512. smalltalk.addMethod(
  1513. smalltalk.method({
  1514. selector: "commitPathStFor:",
  1515. protocol: 'accessing',
  1516. fn: function (aPackage){
  1517. var self=this;
  1518. return smalltalk.withContext(function($ctx1) {
  1519. self._subclassResponsibility();
  1520. return self}, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1521. args: ["aPackage"],
  1522. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  1523. messageSends: ["subclassResponsibility"],
  1524. referencedClasses: []
  1525. }),
  1526. smalltalk.PackageHandler);
  1527. smalltalk.addMethod(
  1528. smalltalk.method({
  1529. selector: "commitStFileFor:",
  1530. protocol: 'committing',
  1531. fn: function (aPackage){
  1532. var self=this;
  1533. return smalltalk.withContext(function($ctx1) {
  1534. var $2,$1;
  1535. $2=_st(_st(self._commitPathStFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
  1536. $ctx1.sendIdx[","]=2;
  1537. $1=_st($2).__comma(".st");
  1538. $ctx1.sendIdx[","]=1;
  1539. self._ajaxPutAt_data_($1,self._chunkContentsFor_(aPackage));
  1540. return self}, function($ctx1) {$ctx1.fill(self,"commitStFileFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1541. args: ["aPackage"],
  1542. source: "commitStFileFor: aPackage\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathStFor: aPackage), '/', aPackage name, '.st'\x0a\x09\x09data: (self chunkContentsFor: aPackage)",
  1543. messageSends: ["ajaxPutAt:data:", ",", "commitPathStFor:", "name", "chunkContentsFor:"],
  1544. referencedClasses: []
  1545. }),
  1546. smalltalk.PackageHandler);
  1547. smalltalk.addMethod(
  1548. smalltalk.method({
  1549. selector: "contentsFor:",
  1550. protocol: 'accessing',
  1551. fn: function (aPackage){
  1552. var self=this;
  1553. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1554. return smalltalk.withContext(function($ctx1) {
  1555. var $1;
  1556. $1=_st($String())._streamContents_((function(str){
  1557. return smalltalk.withContext(function($ctx2) {
  1558. return _st(self._exporter())._exportPackage_on_(aPackage,str);
  1559. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  1560. return $1;
  1561. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1562. args: ["aPackage"],
  1563. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  1564. messageSends: ["streamContents:", "exportPackage:on:", "exporter"],
  1565. referencedClasses: ["String"]
  1566. }),
  1567. smalltalk.PackageHandler);
  1568. smalltalk.addMethod(
  1569. smalltalk.method({
  1570. selector: "exporter",
  1571. protocol: 'factory',
  1572. fn: function (){
  1573. var self=this;
  1574. return smalltalk.withContext(function($ctx1) {
  1575. var $1;
  1576. $1=_st(self._exporterClass())._new();
  1577. return $1;
  1578. }, function($ctx1) {$ctx1.fill(self,"exporter",{},smalltalk.PackageHandler)})},
  1579. args: [],
  1580. source: "exporter\x0a\x09^ self exporterClass new",
  1581. messageSends: ["new", "exporterClass"],
  1582. referencedClasses: []
  1583. }),
  1584. smalltalk.PackageHandler);
  1585. smalltalk.addMethod(
  1586. smalltalk.method({
  1587. selector: "exporterClass",
  1588. protocol: 'accessing',
  1589. fn: function (){
  1590. var self=this;
  1591. function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  1592. return smalltalk.withContext(function($ctx1) {
  1593. return $Exporter();
  1594. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},smalltalk.PackageHandler)})},
  1595. args: [],
  1596. source: "exporterClass\x0a\x09^ Exporter",
  1597. messageSends: [],
  1598. referencedClasses: ["Exporter"]
  1599. }),
  1600. smalltalk.PackageHandler);
  1601. smalltalk.addMethod(
  1602. smalltalk.method({
  1603. selector: "load:",
  1604. protocol: 'loading',
  1605. fn: function (aPackage){
  1606. var self=this;
  1607. return smalltalk.withContext(function($ctx1) {
  1608. self._subclassResponsibility();
  1609. return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1610. args: ["aPackage"],
  1611. source: "load: aPackage\x0a\x09self subclassResponsibility",
  1612. messageSends: ["subclassResponsibility"],
  1613. referencedClasses: []
  1614. }),
  1615. smalltalk.PackageHandler);
  1616. smalltalk.addClass('AmdPackageHandler', smalltalk.PackageHandler, [], 'Kernel-ImportExport');
  1617. 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.";
  1618. smalltalk.addMethod(
  1619. smalltalk.method({
  1620. selector: "commitPathJsFor:",
  1621. protocol: 'accessing',
  1622. fn: function (aPackage){
  1623. var self=this;
  1624. return smalltalk.withContext(function($ctx1) {
  1625. var $1;
  1626. $1=self._toUrl_(self._namespaceFor_(aPackage));
  1627. return $1;
  1628. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  1629. args: ["aPackage"],
  1630. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  1631. messageSends: ["toUrl:", "namespaceFor:"],
  1632. referencedClasses: []
  1633. }),
  1634. smalltalk.AmdPackageHandler);
  1635. smalltalk.addMethod(
  1636. smalltalk.method({
  1637. selector: "commitPathStFor:",
  1638. protocol: 'accessing',
  1639. fn: function (aPackage){
  1640. var self=this;
  1641. return smalltalk.withContext(function($ctx1) {
  1642. var $1;
  1643. $1=self._toUrl_(_st(self._namespaceFor_(aPackage)).__comma("/_source"));
  1644. return $1;
  1645. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  1646. args: ["aPackage"],
  1647. source: "commitPathStFor: aPackage\x0a\x09\x22if _source is not mapped, .st commit will likely fail\x22\x0a\x09^ self toUrl: (self namespaceFor: aPackage), '/_source'.",
  1648. messageSends: ["toUrl:", ",", "namespaceFor:"],
  1649. referencedClasses: []
  1650. }),
  1651. smalltalk.AmdPackageHandler);
  1652. smalltalk.addMethod(
  1653. smalltalk.method({
  1654. selector: "exporterClass",
  1655. protocol: 'accessing',
  1656. fn: function (){
  1657. var self=this;
  1658. function $AmdExporter(){return smalltalk.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  1659. return smalltalk.withContext(function($ctx1) {
  1660. return $AmdExporter();
  1661. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},smalltalk.AmdPackageHandler)})},
  1662. args: [],
  1663. source: "exporterClass\x0a\x09^ AmdExporter",
  1664. messageSends: [],
  1665. referencedClasses: ["AmdExporter"]
  1666. }),
  1667. smalltalk.AmdPackageHandler);
  1668. smalltalk.addMethod(
  1669. smalltalk.method({
  1670. selector: "load:",
  1671. protocol: 'loading',
  1672. fn: function (aPackage){
  1673. var self=this;
  1674. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1675. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  1676. return smalltalk.withContext(function($ctx1) {
  1677. var $1,$3,$2;
  1678. $1=_st(_st($Smalltalk())._current())._amdRequire();
  1679. if(($receiver = $1) == nil || $receiver == null){
  1680. self._error_("AMD loader not present");
  1681. } else {
  1682. var require;
  1683. require=$receiver;
  1684. $3=_st(_st(self._namespaceFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
  1685. $ctx1.sendIdx[","]=1;
  1686. $2=_st($Array())._new_($3);
  1687. _st(require)._value_($2);
  1688. };
  1689. return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  1690. args: ["aPackage"],
  1691. source: "load: aPackage\x0a\x09Smalltalk current amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array new: (self namespaceFor: aPackage), '/', aPackage name ) ]",
  1692. messageSends: ["ifNil:ifNotNil:", "amdRequire", "current", "error:", "value:", "new:", ",", "namespaceFor:", "name"],
  1693. referencedClasses: ["Smalltalk", "Array"]
  1694. }),
  1695. smalltalk.AmdPackageHandler);
  1696. smalltalk.addMethod(
  1697. smalltalk.method({
  1698. selector: "namespaceFor:",
  1699. protocol: 'committing',
  1700. fn: function (aPackage){
  1701. var self=this;
  1702. return smalltalk.withContext(function($ctx1) {
  1703. var $1;
  1704. $1=_st(_st(aPackage)._transport())._namespace();
  1705. return $1;
  1706. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  1707. args: ["aPackage"],
  1708. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  1709. messageSends: ["namespace", "transport"],
  1710. referencedClasses: []
  1711. }),
  1712. smalltalk.AmdPackageHandler);
  1713. smalltalk.addMethod(
  1714. smalltalk.method({
  1715. selector: "toUrl:",
  1716. protocol: 'private',
  1717. fn: function (aString){
  1718. var self=this;
  1719. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1720. return smalltalk.withContext(function($ctx1) {
  1721. var $2,$1;
  1722. $2=_st(_st($Smalltalk())._current())._amdRequire();
  1723. if(($receiver = $2) == nil || $receiver == null){
  1724. $1=self._error_("AMD loader not present");
  1725. } else {
  1726. var require;
  1727. require=$receiver;
  1728. $1=_st(_st(require)._basicAt_("toUrl"))._value_(aString);
  1729. };
  1730. return $1;
  1731. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},smalltalk.AmdPackageHandler)})},
  1732. args: ["aString"],
  1733. 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 ]",
  1734. messageSends: ["ifNil:ifNotNil:", "amdRequire", "current", "error:", "value:", "basicAt:"],
  1735. referencedClasses: ["Smalltalk"]
  1736. }),
  1737. smalltalk.AmdPackageHandler);
  1738. smalltalk.addMethod(
  1739. smalltalk.method({
  1740. selector: "defaultNamespace",
  1741. protocol: 'commit paths',
  1742. fn: function (){
  1743. var self=this;
  1744. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1745. return smalltalk.withContext(function($ctx1) {
  1746. var $1;
  1747. $1=_st(_st($Smalltalk())._current())._defaultAmdNamespace();
  1748. return $1;
  1749. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},smalltalk.AmdPackageHandler.klass)})},
  1750. args: [],
  1751. source: "defaultNamespace\x0a\x09^ Smalltalk current defaultAmdNamespace",
  1752. messageSends: ["defaultAmdNamespace", "current"],
  1753. referencedClasses: ["Smalltalk"]
  1754. }),
  1755. smalltalk.AmdPackageHandler.klass);
  1756. smalltalk.addMethod(
  1757. smalltalk.method({
  1758. selector: "defaultNamespace:",
  1759. protocol: 'commit paths',
  1760. fn: function (aString){
  1761. var self=this;
  1762. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1763. return smalltalk.withContext(function($ctx1) {
  1764. _st(_st($Smalltalk())._current())._defaultAmdNamespace_(aString);
  1765. return self}, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},smalltalk.AmdPackageHandler.klass)})},
  1766. args: ["aString"],
  1767. source: "defaultNamespace: aString\x0a\x09Smalltalk current defaultAmdNamespace: aString",
  1768. messageSends: ["defaultAmdNamespace:", "current"],
  1769. referencedClasses: ["Smalltalk"]
  1770. }),
  1771. smalltalk.AmdPackageHandler.klass);
  1772. smalltalk.addClass('PackageTransport', smalltalk.Object, ['package'], 'Kernel-ImportExport');
  1773. 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.";
  1774. smalltalk.addMethod(
  1775. smalltalk.method({
  1776. selector: "asJSON",
  1777. protocol: 'converting',
  1778. fn: function (){
  1779. var self=this;
  1780. return smalltalk.withContext(function($ctx1) {
  1781. var $1;
  1782. $1=smalltalk.HashedCollection._from_(["type".__minus_gt(self._type())]);
  1783. return $1;
  1784. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.PackageTransport)})},
  1785. args: [],
  1786. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  1787. messageSends: ["->", "type"],
  1788. referencedClasses: []
  1789. }),
  1790. smalltalk.PackageTransport);
  1791. smalltalk.addMethod(
  1792. smalltalk.method({
  1793. selector: "commit",
  1794. protocol: 'committing',
  1795. fn: function (){
  1796. var self=this;
  1797. return smalltalk.withContext(function($ctx1) {
  1798. _st(self._commitHandler())._commit_(self._package());
  1799. return self}, function($ctx1) {$ctx1.fill(self,"commit",{},smalltalk.PackageTransport)})},
  1800. args: [],
  1801. source: "commit\x0a\x09self commitHandler commit: self package",
  1802. messageSends: ["commit:", "commitHandler", "package"],
  1803. referencedClasses: []
  1804. }),
  1805. smalltalk.PackageTransport);
  1806. smalltalk.addMethod(
  1807. smalltalk.method({
  1808. selector: "commitHandler",
  1809. protocol: 'factory',
  1810. fn: function (){
  1811. var self=this;
  1812. return smalltalk.withContext(function($ctx1) {
  1813. var $1;
  1814. $1=_st(self._commitHandlerClass())._new();
  1815. return $1;
  1816. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},smalltalk.PackageTransport)})},
  1817. args: [],
  1818. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  1819. messageSends: ["new", "commitHandlerClass"],
  1820. referencedClasses: []
  1821. }),
  1822. smalltalk.PackageTransport);
  1823. smalltalk.addMethod(
  1824. smalltalk.method({
  1825. selector: "commitHandlerClass",
  1826. protocol: 'accessing',
  1827. fn: function (){
  1828. var self=this;
  1829. return smalltalk.withContext(function($ctx1) {
  1830. self._subclassResponsibility();
  1831. return self}, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},smalltalk.PackageTransport)})},
  1832. args: [],
  1833. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  1834. messageSends: ["subclassResponsibility"],
  1835. referencedClasses: []
  1836. }),
  1837. smalltalk.PackageTransport);
  1838. smalltalk.addMethod(
  1839. smalltalk.method({
  1840. selector: "definition",
  1841. protocol: 'accessing',
  1842. fn: function (){
  1843. var self=this;
  1844. return smalltalk.withContext(function($ctx1) {
  1845. return "";
  1846. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.PackageTransport)})},
  1847. args: [],
  1848. source: "definition\x0a\x09^ ''",
  1849. messageSends: [],
  1850. referencedClasses: []
  1851. }),
  1852. smalltalk.PackageTransport);
  1853. smalltalk.addMethod(
  1854. smalltalk.method({
  1855. selector: "load",
  1856. protocol: 'loading',
  1857. fn: function (){
  1858. var self=this;
  1859. return smalltalk.withContext(function($ctx1) {
  1860. _st(self._commitHandler())._load_(self._package());
  1861. return self}, function($ctx1) {$ctx1.fill(self,"load",{},smalltalk.PackageTransport)})},
  1862. args: [],
  1863. source: "load\x0a\x09self commitHandler load: self package",
  1864. messageSends: ["load:", "commitHandler", "package"],
  1865. referencedClasses: []
  1866. }),
  1867. smalltalk.PackageTransport);
  1868. smalltalk.addMethod(
  1869. smalltalk.method({
  1870. selector: "package",
  1871. protocol: 'accessing',
  1872. fn: function (){
  1873. var self=this;
  1874. return smalltalk.withContext(function($ctx1) {
  1875. var $1;
  1876. $1=self["@package"];
  1877. return $1;
  1878. }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.PackageTransport)})},
  1879. args: [],
  1880. source: "package\x0a\x09^ package",
  1881. messageSends: [],
  1882. referencedClasses: []
  1883. }),
  1884. smalltalk.PackageTransport);
  1885. smalltalk.addMethod(
  1886. smalltalk.method({
  1887. selector: "package:",
  1888. protocol: 'accessing',
  1889. fn: function (aPackage){
  1890. var self=this;
  1891. return smalltalk.withContext(function($ctx1) {
  1892. self["@package"]=aPackage;
  1893. return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage},smalltalk.PackageTransport)})},
  1894. args: ["aPackage"],
  1895. source: "package: aPackage\x0a\x09package := aPackage",
  1896. messageSends: [],
  1897. referencedClasses: []
  1898. }),
  1899. smalltalk.PackageTransport);
  1900. smalltalk.addMethod(
  1901. smalltalk.method({
  1902. selector: "setupFromJson:",
  1903. protocol: 'initialization',
  1904. fn: function (anObject){
  1905. var self=this;
  1906. return smalltalk.withContext(function($ctx1) {
  1907. return self}, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},smalltalk.PackageTransport)})},
  1908. args: ["anObject"],
  1909. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  1910. messageSends: [],
  1911. referencedClasses: []
  1912. }),
  1913. smalltalk.PackageTransport);
  1914. smalltalk.addMethod(
  1915. smalltalk.method({
  1916. selector: "type",
  1917. protocol: 'accessing',
  1918. fn: function (){
  1919. var self=this;
  1920. return smalltalk.withContext(function($ctx1) {
  1921. var $1;
  1922. $1=_st(self._class())._type();
  1923. return $1;
  1924. }, function($ctx1) {$ctx1.fill(self,"type",{},smalltalk.PackageTransport)})},
  1925. args: [],
  1926. source: "type\x0a\x09^ self class type",
  1927. messageSends: ["type", "class"],
  1928. referencedClasses: []
  1929. }),
  1930. smalltalk.PackageTransport);
  1931. smalltalk.PackageTransport.klass.iVarNames = ['registry'];
  1932. smalltalk.addMethod(
  1933. smalltalk.method({
  1934. selector: "classRegisteredFor:",
  1935. protocol: 'accessing',
  1936. fn: function (aString){
  1937. var self=this;
  1938. return smalltalk.withContext(function($ctx1) {
  1939. var $1;
  1940. $1=_st(self["@registry"])._at_(aString);
  1941. return $1;
  1942. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},smalltalk.PackageTransport.klass)})},
  1943. args: ["aString"],
  1944. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  1945. messageSends: ["at:"],
  1946. referencedClasses: []
  1947. }),
  1948. smalltalk.PackageTransport.klass);
  1949. smalltalk.addMethod(
  1950. smalltalk.method({
  1951. selector: "defaultType",
  1952. protocol: 'accessing',
  1953. fn: function (){
  1954. var self=this;
  1955. function $AmdPackageTransport(){return smalltalk.AmdPackageTransport||(typeof AmdPackageTransport=="undefined"?nil:AmdPackageTransport)}
  1956. return smalltalk.withContext(function($ctx1) {
  1957. var $1;
  1958. $1=_st($AmdPackageTransport())._type();
  1959. return $1;
  1960. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},smalltalk.PackageTransport.klass)})},
  1961. args: [],
  1962. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  1963. messageSends: ["type"],
  1964. referencedClasses: ["AmdPackageTransport"]
  1965. }),
  1966. smalltalk.PackageTransport.klass);
  1967. smalltalk.addMethod(
  1968. smalltalk.method({
  1969. selector: "for:",
  1970. protocol: 'instance creation',
  1971. fn: function (aString){
  1972. var self=this;
  1973. return smalltalk.withContext(function($ctx1) {
  1974. var $1;
  1975. $1=_st(self._classRegisteredFor_(aString))._new();
  1976. return $1;
  1977. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},smalltalk.PackageTransport.klass)})},
  1978. args: ["aString"],
  1979. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  1980. messageSends: ["new", "classRegisteredFor:"],
  1981. referencedClasses: []
  1982. }),
  1983. smalltalk.PackageTransport.klass);
  1984. smalltalk.addMethod(
  1985. smalltalk.method({
  1986. selector: "fromJson:",
  1987. protocol: 'instance creation',
  1988. fn: function (anObject){
  1989. var self=this;
  1990. return smalltalk.withContext(function($ctx1) {
  1991. var $1,$3,$4,$2;
  1992. if(($receiver = anObject) == nil || $receiver == null){
  1993. $1=self._for_(self._defaultType());
  1994. $ctx1.sendIdx["for:"]=1;
  1995. return $1;
  1996. } else {
  1997. anObject;
  1998. };
  1999. $3=self._for_(_st(anObject)._type());
  2000. _st($3)._setupFromJson_(anObject);
  2001. $4=_st($3)._yourself();
  2002. $2=$4;
  2003. return $2;
  2004. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},smalltalk.PackageTransport.klass)})},
  2005. args: ["anObject"],
  2006. 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",
  2007. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"],
  2008. referencedClasses: []
  2009. }),
  2010. smalltalk.PackageTransport.klass);
  2011. smalltalk.addMethod(
  2012. smalltalk.method({
  2013. selector: "initialize",
  2014. protocol: 'initialization',
  2015. fn: function (){
  2016. var self=this;
  2017. return smalltalk.withContext(function($ctx1) {
  2018. smalltalk.PackageTransport.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  2019. self["@registry"]=smalltalk.HashedCollection._from_([]);
  2020. self._register();
  2021. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.PackageTransport.klass)})},
  2022. args: [],
  2023. source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}.\x0a\x09self register",
  2024. messageSends: ["initialize", "register"],
  2025. referencedClasses: []
  2026. }),
  2027. smalltalk.PackageTransport.klass);
  2028. smalltalk.addMethod(
  2029. smalltalk.method({
  2030. selector: "register",
  2031. protocol: 'registration',
  2032. fn: function (){
  2033. var self=this;
  2034. function $PackageTransport(){return smalltalk.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  2035. return smalltalk.withContext(function($ctx1) {
  2036. _st($PackageTransport())._register_(self);
  2037. return self}, function($ctx1) {$ctx1.fill(self,"register",{},smalltalk.PackageTransport.klass)})},
  2038. args: [],
  2039. source: "register\x0a\x09PackageTransport register: self",
  2040. messageSends: ["register:"],
  2041. referencedClasses: ["PackageTransport"]
  2042. }),
  2043. smalltalk.PackageTransport.klass);
  2044. smalltalk.addMethod(
  2045. smalltalk.method({
  2046. selector: "register:",
  2047. protocol: 'registration',
  2048. fn: function (aClass){
  2049. var self=this;
  2050. return smalltalk.withContext(function($ctx1) {
  2051. var $1;
  2052. $1=_st(aClass)._type();
  2053. $ctx1.sendIdx["type"]=1;
  2054. if(($receiver = $1) == nil || $receiver == null){
  2055. $1;
  2056. } else {
  2057. _st(self["@registry"])._at_put_(_st(aClass)._type(),aClass);
  2058. };
  2059. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},smalltalk.PackageTransport.klass)})},
  2060. args: ["aClass"],
  2061. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  2062. messageSends: ["ifNotNil:", "type", "at:put:"],
  2063. referencedClasses: []
  2064. }),
  2065. smalltalk.PackageTransport.klass);
  2066. smalltalk.addMethod(
  2067. smalltalk.method({
  2068. selector: "type",
  2069. protocol: 'accessing',
  2070. fn: function (){
  2071. var self=this;
  2072. return smalltalk.withContext(function($ctx1) {
  2073. return nil;
  2074. }, function($ctx1) {$ctx1.fill(self,"type",{},smalltalk.PackageTransport.klass)})},
  2075. args: [],
  2076. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  2077. messageSends: [],
  2078. referencedClasses: []
  2079. }),
  2080. smalltalk.PackageTransport.klass);
  2081. smalltalk.addClass('AmdPackageTransport', smalltalk.PackageTransport, ['namespace'], 'Kernel-ImportExport');
  2082. smalltalk.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  2083. smalltalk.addMethod(
  2084. smalltalk.method({
  2085. selector: "asJSON",
  2086. protocol: 'converting',
  2087. fn: function (){
  2088. var self=this;
  2089. return smalltalk.withContext(function($ctx1) {
  2090. var $2,$3,$1;
  2091. $2=smalltalk.AmdPackageTransport.superclass.fn.prototype._asJSON.apply(_st(self), []);
  2092. _st($2)._at_put_("amdNamespace",self._namespace());
  2093. $3=_st($2)._yourself();
  2094. $1=$3;
  2095. return $1;
  2096. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},smalltalk.AmdPackageTransport)})},
  2097. args: [],
  2098. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  2099. messageSends: ["at:put:", "asJSON", "namespace", "yourself"],
  2100. referencedClasses: []
  2101. }),
  2102. smalltalk.AmdPackageTransport);
  2103. smalltalk.addMethod(
  2104. smalltalk.method({
  2105. selector: "commitHandlerClass",
  2106. protocol: 'accessing',
  2107. fn: function (){
  2108. var self=this;
  2109. function $AmdPackageHandler(){return smalltalk.AmdPackageHandler||(typeof AmdPackageHandler=="undefined"?nil:AmdPackageHandler)}
  2110. return smalltalk.withContext(function($ctx1) {
  2111. return $AmdPackageHandler();
  2112. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},smalltalk.AmdPackageTransport)})},
  2113. args: [],
  2114. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  2115. messageSends: [],
  2116. referencedClasses: ["AmdPackageHandler"]
  2117. }),
  2118. smalltalk.AmdPackageTransport);
  2119. smalltalk.addMethod(
  2120. smalltalk.method({
  2121. selector: "defaultNamespace",
  2122. protocol: 'defaults',
  2123. fn: function (){
  2124. var self=this;
  2125. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2126. return smalltalk.withContext(function($ctx1) {
  2127. var $1;
  2128. $1=_st(_st($Smalltalk())._current())._defaultAmdNamespace();
  2129. return $1;
  2130. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},smalltalk.AmdPackageTransport)})},
  2131. args: [],
  2132. source: "defaultNamespace\x0a\x09^ Smalltalk current defaultAmdNamespace",
  2133. messageSends: ["defaultAmdNamespace", "current"],
  2134. referencedClasses: ["Smalltalk"]
  2135. }),
  2136. smalltalk.AmdPackageTransport);
  2137. smalltalk.addMethod(
  2138. smalltalk.method({
  2139. selector: "definition",
  2140. protocol: 'accessing',
  2141. fn: function (){
  2142. var self=this;
  2143. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  2144. return smalltalk.withContext(function($ctx1) {
  2145. var $3,$2,$1;
  2146. $1=_st($String())._streamContents_((function(stream){
  2147. return smalltalk.withContext(function($ctx2) {
  2148. _st(stream)._nextPutAll_(_st(self._class())._name());
  2149. $ctx2.sendIdx["nextPutAll:"]=1;
  2150. _st(stream)._nextPutAll_(" namespace: ");
  2151. $ctx2.sendIdx["nextPutAll:"]=2;
  2152. $3=_st("'".__comma(self._namespace())).__comma("'");
  2153. $ctx2.sendIdx[","]=1;
  2154. $2=_st(stream)._nextPutAll_($3);
  2155. return $2;
  2156. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  2157. return $1;
  2158. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.AmdPackageTransport)})},
  2159. args: [],
  2160. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: ' namespace: ';\x0a\x09\x09\x09nextPutAll: '''', self namespace, '''' ]",
  2161. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"],
  2162. referencedClasses: ["String"]
  2163. }),
  2164. smalltalk.AmdPackageTransport);
  2165. smalltalk.addMethod(
  2166. smalltalk.method({
  2167. selector: "namespace",
  2168. protocol: 'accessing',
  2169. fn: function (){
  2170. var self=this;
  2171. return smalltalk.withContext(function($ctx1) {
  2172. var $2,$1;
  2173. $2=self["@namespace"];
  2174. if(($receiver = $2) == nil || $receiver == null){
  2175. $1=self._defaultNamespace();
  2176. } else {
  2177. $1=$2;
  2178. };
  2179. return $1;
  2180. }, function($ctx1) {$ctx1.fill(self,"namespace",{},smalltalk.AmdPackageTransport)})},
  2181. args: [],
  2182. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  2183. messageSends: ["ifNil:", "defaultNamespace"],
  2184. referencedClasses: []
  2185. }),
  2186. smalltalk.AmdPackageTransport);
  2187. smalltalk.addMethod(
  2188. smalltalk.method({
  2189. selector: "namespace:",
  2190. protocol: 'accessing',
  2191. fn: function (aString){
  2192. var self=this;
  2193. return smalltalk.withContext(function($ctx1) {
  2194. self["@namespace"]=aString;
  2195. return self}, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},smalltalk.AmdPackageTransport)})},
  2196. args: ["aString"],
  2197. source: "namespace: aString\x0a\x09namespace := aString",
  2198. messageSends: [],
  2199. referencedClasses: []
  2200. }),
  2201. smalltalk.AmdPackageTransport);
  2202. smalltalk.addMethod(
  2203. smalltalk.method({
  2204. selector: "printOn:",
  2205. protocol: 'printing',
  2206. fn: function (aStream){
  2207. var self=this;
  2208. return smalltalk.withContext(function($ctx1) {
  2209. var $1;
  2210. smalltalk.AmdPackageTransport.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  2211. _st(aStream)._nextPutAll_(" (AMD Namespace: ");
  2212. $ctx1.sendIdx["nextPutAll:"]=1;
  2213. _st(aStream)._nextPutAll_(self._namespace());
  2214. $ctx1.sendIdx["nextPutAll:"]=2;
  2215. $1=_st(aStream)._nextPutAll_(")");
  2216. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.AmdPackageTransport)})},
  2217. args: ["aStream"],
  2218. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  2219. messageSends: ["printOn:", "nextPutAll:", "namespace"],
  2220. referencedClasses: []
  2221. }),
  2222. smalltalk.AmdPackageTransport);
  2223. smalltalk.addMethod(
  2224. smalltalk.method({
  2225. selector: "setupFromJson:",
  2226. protocol: 'initialization',
  2227. fn: function (anObject){
  2228. var self=this;
  2229. return smalltalk.withContext(function($ctx1) {
  2230. self._namespace_(_st(anObject)._at_("amdNamespace"));
  2231. return self}, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},smalltalk.AmdPackageTransport)})},
  2232. args: ["anObject"],
  2233. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  2234. messageSends: ["namespace:", "at:"],
  2235. referencedClasses: []
  2236. }),
  2237. smalltalk.AmdPackageTransport);
  2238. smalltalk.addMethod(
  2239. smalltalk.method({
  2240. selector: "namespace:",
  2241. protocol: 'instance creation',
  2242. fn: function (aString){
  2243. var self=this;
  2244. return smalltalk.withContext(function($ctx1) {
  2245. var $2,$3,$1;
  2246. $2=self._new();
  2247. _st($2)._namespace_(aString);
  2248. $3=_st($2)._yourself();
  2249. $1=$3;
  2250. return $1;
  2251. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},smalltalk.AmdPackageTransport.klass)})},
  2252. args: ["aString"],
  2253. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  2254. messageSends: ["namespace:", "new", "yourself"],
  2255. referencedClasses: []
  2256. }),
  2257. smalltalk.AmdPackageTransport.klass);
  2258. smalltalk.addMethod(
  2259. smalltalk.method({
  2260. selector: "type",
  2261. protocol: 'accessing',
  2262. fn: function (){
  2263. var self=this;
  2264. return smalltalk.withContext(function($ctx1) {
  2265. return "amd";
  2266. }, function($ctx1) {$ctx1.fill(self,"type",{},smalltalk.AmdPackageTransport.klass)})},
  2267. args: [],
  2268. source: "type\x0a\x09^ 'amd'",
  2269. messageSends: [],
  2270. referencedClasses: []
  2271. }),
  2272. smalltalk.AmdPackageTransport.klass);
  2273. smalltalk.addMethod(
  2274. smalltalk.method({
  2275. selector: "commit",
  2276. protocol: '*Kernel-ImportExport',
  2277. fn: function (){
  2278. var self=this;
  2279. return smalltalk.withContext(function($ctx1) {
  2280. var $1;
  2281. $1=_st(self._transport())._commit();
  2282. return $1;
  2283. }, function($ctx1) {$ctx1.fill(self,"commit",{},smalltalk.Package)})},
  2284. args: [],
  2285. source: "commit\x0a\x09^ self transport commit",
  2286. messageSends: ["commit", "transport"],
  2287. referencedClasses: []
  2288. }),
  2289. smalltalk.Package);
  2290. smalltalk.addMethod(
  2291. smalltalk.method({
  2292. selector: "load",
  2293. protocol: '*Kernel-ImportExport',
  2294. fn: function (){
  2295. var self=this;
  2296. return smalltalk.withContext(function($ctx1) {
  2297. var $1;
  2298. $1=_st(self._transport())._load();
  2299. return $1;
  2300. }, function($ctx1) {$ctx1.fill(self,"load",{},smalltalk.Package)})},
  2301. args: [],
  2302. source: "load\x0a\x09^ self transport load",
  2303. messageSends: ["load", "transport"],
  2304. referencedClasses: []
  2305. }),
  2306. smalltalk.Package);
  2307. smalltalk.addMethod(
  2308. smalltalk.method({
  2309. selector: "loadFromNamespace:",
  2310. protocol: '*Kernel-ImportExport',
  2311. fn: function (aString){
  2312. var self=this;
  2313. return smalltalk.withContext(function($ctx1) {
  2314. var $2,$3,$1;
  2315. $2=self._transport();
  2316. _st($2)._namespace_(aString);
  2317. $3=_st($2)._load();
  2318. $1=$3;
  2319. return $1;
  2320. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},smalltalk.Package)})},
  2321. args: ["aString"],
  2322. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  2323. messageSends: ["namespace:", "transport", "load"],
  2324. referencedClasses: []
  2325. }),
  2326. smalltalk.Package);
  2327. smalltalk.addMethod(
  2328. smalltalk.method({
  2329. selector: "load:",
  2330. protocol: '*Kernel-ImportExport',
  2331. fn: function (aPackageName){
  2332. var self=this;
  2333. return smalltalk.withContext(function($ctx1) {
  2334. _st(self._named_(aPackageName))._load();
  2335. return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},smalltalk.Package.klass)})},
  2336. args: ["aPackageName"],
  2337. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  2338. messageSends: ["load", "named:"],
  2339. referencedClasses: []
  2340. }),
  2341. smalltalk.Package.klass);
  2342. smalltalk.addMethod(
  2343. smalltalk.method({
  2344. selector: "load:fromNamespace:",
  2345. protocol: '*Kernel-ImportExport',
  2346. fn: function (aPackageName,aString){
  2347. var self=this;
  2348. return smalltalk.withContext(function($ctx1) {
  2349. _st(self._named_(aPackageName))._loadFromNamespace_(aString);
  2350. return self}, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},smalltalk.Package.klass)})},
  2351. args: ["aPackageName", "aString"],
  2352. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  2353. messageSends: ["loadFromNamespace:", "named:"],
  2354. referencedClasses: []
  2355. }),
  2356. smalltalk.Package.klass);
  2357. });