Kernel-ImportExport.js 99 KB

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