Importer-Exporter.js 99 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250
  1. define("amber/Importer-Exporter", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber/Kernel-Objects", "amber/Kernel-Infrastructure"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Importer-Exporter');
  3. smalltalk.packages["Importer-Exporter"].transport = {"type":"amd","amdNamespace":"amber"};
  4. smalltalk.addClass('AbstractExporter', smalltalk.Object, [], 'Importer-Exporter');
  5. smalltalk.AbstractExporter.comment="I am an abstract exporter for Amber source code.";
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "chunkEscape:",
  9. category: 'convenience',
  10. fn: function (aString){
  11. var self=this;
  12. return smalltalk.withContext(function($ctx1) {
  13. var $1;
  14. $1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
  15. return $1;
  16. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},smalltalk.AbstractExporter)})},
  17. args: ["aString"],
  18. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^(aString replace: '!' with: '!!') trimBoth",
  19. messageSends: ["trimBoth", "replace:with:"],
  20. referencedClasses: []
  21. }),
  22. smalltalk.AbstractExporter);
  23. smalltalk.addMethod(
  24. smalltalk.method({
  25. selector: "classNameFor:",
  26. category: 'convenience',
  27. fn: function (aClass){
  28. var self=this;
  29. return smalltalk.withContext(function($ctx1) {
  30. var $2,$3,$1;
  31. $2=_st(aClass)._isMetaclass();
  32. if(smalltalk.assert($2)){
  33. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(" class");
  34. } else {
  35. $3=_st(aClass)._isNil();
  36. if(smalltalk.assert($3)){
  37. $1="nil";
  38. } else {
  39. $1=_st(aClass)._name();
  40. };
  41. };
  42. return $1;
  43. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.AbstractExporter)})},
  44. args: ["aClass"],
  45. source: "classNameFor: aClass\x0a\x09^aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, ' class' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass isNil\x0a\x09\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09\x09ifFalse: [ aClass name ] ]",
  46. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"],
  47. referencedClasses: []
  48. }),
  49. smalltalk.AbstractExporter);
  50. smalltalk.addMethod(
  51. smalltalk.method({
  52. selector: "recipe",
  53. category: 'fileOut',
  54. fn: function (){
  55. var self=this;
  56. return smalltalk.withContext(function($ctx1) {
  57. self._subclassResponsibility();
  58. return self}, function($ctx1) {$ctx1.fill(self,"recipe",{},smalltalk.AbstractExporter)})},
  59. args: [],
  60. source: "recipe\x0a\x09\x22Recipe to export a given package.\x22\x0a\x0a\x09self subclassResponsibility",
  61. messageSends: ["subclassResponsibility"],
  62. referencedClasses: []
  63. }),
  64. smalltalk.AbstractExporter);
  65. smalltalk.AbstractExporter.klass.iVarNames = ['default'];
  66. smalltalk.addMethod(
  67. smalltalk.method({
  68. selector: "default",
  69. category: 'instance creation',
  70. fn: function (){
  71. var self=this;
  72. return smalltalk.withContext(function($ctx1) {
  73. var $2,$1;
  74. $2=self["@default"];
  75. if(($receiver = $2) == nil || $receiver == undefined){
  76. self["@default"]=self._new();
  77. $1=self["@default"];
  78. } else {
  79. $1=$2;
  80. };
  81. return $1;
  82. }, function($ctx1) {$ctx1.fill(self,"default",{},smalltalk.AbstractExporter.klass)})},
  83. args: [],
  84. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  85. messageSends: ["ifNil:", "new"],
  86. referencedClasses: []
  87. }),
  88. smalltalk.AbstractExporter.klass);
  89. smalltalk.addClass('ChunkExporter', smalltalk.AbstractExporter, [], 'Importer-Exporter');
  90. smalltalk.ChunkExporter.comment="I am an exporter dedicated to outputting Amber source code in the classic Smalltalk chunk format.\x0a\x0aI do not output any compiled code.";
  91. smalltalk.addMethod(
  92. smalltalk.method({
  93. selector: "exportCategoryEpilogueOf:on:",
  94. category: 'output',
  95. fn: function (aCategory,aStream){
  96. var self=this;
  97. return smalltalk.withContext(function($ctx1) {
  98. var $1,$2;
  99. $1=aStream;
  100. _st($1)._nextPutAll_(" !");
  101. _st($1)._lf();
  102. $2=_st($1)._lf();
  103. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},smalltalk.ChunkExporter)})},
  104. args: ["aCategory", "aStream"],
  105. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  106. messageSends: ["nextPutAll:", "lf"],
  107. referencedClasses: []
  108. }),
  109. smalltalk.ChunkExporter);
  110. smalltalk.addMethod(
  111. smalltalk.method({
  112. selector: "exportCategoryPrologueOf:on:",
  113. category: 'output',
  114. fn: function (aCategory,aStream){
  115. var self=this;
  116. return smalltalk.withContext(function($ctx1) {
  117. var $1,$2;
  118. $1=aStream;
  119. _st($1)._nextPutAll_("!".__comma(self._classNameFor_(_st(aCategory)._theClass())));
  120. $2=_st($1)._nextPutAll_(_st(" methodsFor: '".__comma(_st(aCategory)._name())).__comma("'!"));
  121. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},smalltalk.ChunkExporter)})},
  122. args: ["aCategory", "aStream"],
  123. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  124. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"],
  125. referencedClasses: []
  126. }),
  127. smalltalk.ChunkExporter);
  128. smalltalk.addMethod(
  129. smalltalk.method({
  130. selector: "exportDefinitionOf:on:",
  131. category: 'output',
  132. fn: function (aClass,aStream){
  133. var self=this;
  134. return smalltalk.withContext(function($ctx1) {
  135. var $1,$2,$3,$4,$5,$6,$7;
  136. $1=aStream;
  137. _st($1)._nextPutAll_(self._classNameFor_(_st(aClass)._superclass()));
  138. _st($1)._nextPutAll_(" subclass: #".__comma(self._classNameFor_(aClass)));
  139. _st($1)._lf();
  140. _st($1)._tab();
  141. $2=_st($1)._nextPutAll_("instanceVariableNames: '");
  142. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  143. return smalltalk.withContext(function($ctx2) {
  144. return _st(aStream)._nextPutAll_(each);
  145. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  146. return smalltalk.withContext(function($ctx2) {
  147. return _st(aStream)._nextPutAll_(" ");
  148. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  149. $3=aStream;
  150. _st($3)._nextPutAll_("'");
  151. _st($3)._lf();
  152. _st($3)._tab();
  153. _st($3)._nextPutAll_(_st("package: '".__comma(_st(aClass)._category())).__comma("'!"));
  154. $4=_st($3)._lf();
  155. $5=_st(_st(aClass)._comment())._notEmpty();
  156. if(smalltalk.assert($5)){
  157. $6=aStream;
  158. _st($6)._nextPutAll_(_st("!".__comma(self._classNameFor_(aClass))).__comma(" commentStamp!"));
  159. _st($6)._lf();
  160. _st($6)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
  161. $7=_st($6)._lf();
  162. $7;
  163. };
  164. _st(aStream)._lf();
  165. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  166. args: ["aClass", "aStream"],
  167. 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",
  168. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "chunkEscape:", "comment", "notEmpty"],
  169. referencedClasses: []
  170. }),
  171. smalltalk.ChunkExporter);
  172. smalltalk.addMethod(
  173. smalltalk.method({
  174. selector: "exportMetaDefinitionOf:on:",
  175. category: 'output',
  176. fn: function (aClass,aStream){
  177. var self=this;
  178. return smalltalk.withContext(function($ctx1) {
  179. var $1,$2,$3,$4,$5;
  180. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  181. if(! smalltalk.assert($1)){
  182. $2=aStream;
  183. _st($2)._nextPutAll_(self._classNameFor_(_st(aClass)._class()));
  184. $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
  185. $3;
  186. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  187. return smalltalk.withContext(function($ctx2) {
  188. return _st(aStream)._nextPutAll_(each);
  189. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  190. return smalltalk.withContext(function($ctx2) {
  191. return _st(aStream)._nextPutAll_(" ");
  192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  193. $4=aStream;
  194. _st($4)._nextPutAll_("'!");
  195. _st($4)._lf();
  196. $5=_st($4)._lf();
  197. $5;
  198. };
  199. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  200. args: ["aClass", "aStream"],
  201. 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]",
  202. messageSends: ["ifFalse:", "nextPutAll:", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"],
  203. referencedClasses: []
  204. }),
  205. smalltalk.ChunkExporter);
  206. smalltalk.addMethod(
  207. smalltalk.method({
  208. selector: "exportMethod:on:",
  209. category: 'output',
  210. fn: function (aMethod,aStream){
  211. var self=this;
  212. return smalltalk.withContext(function($ctx1) {
  213. var $1,$2;
  214. $1=aStream;
  215. _st($1)._lf();
  216. _st($1)._lf();
  217. _st($1)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
  218. _st($1)._lf();
  219. $2=_st($1)._nextPutAll_("!");
  220. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.ChunkExporter)})},
  221. args: ["aMethod", "aStream"],
  222. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  223. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"],
  224. referencedClasses: []
  225. }),
  226. smalltalk.ChunkExporter);
  227. smalltalk.addMethod(
  228. smalltalk.method({
  229. selector: "exportPackageDefinitionOf:on:",
  230. category: 'output',
  231. fn: function (aPackage,aStream){
  232. var self=this;
  233. return smalltalk.withContext(function($ctx1) {
  234. var $1,$2;
  235. $1=aStream;
  236. _st($1)._nextPutAll_(_st("Smalltalk current createPackage: '".__comma(_st(aPackage)._name())).__comma("'!"));
  237. $2=_st($1)._lf();
  238. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.ChunkExporter)})},
  239. args: ["aPackage", "aStream"],
  240. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk current createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  241. messageSends: ["nextPutAll:", ",", "name", "lf"],
  242. referencedClasses: []
  243. }),
  244. smalltalk.ChunkExporter);
  245. smalltalk.addMethod(
  246. smalltalk.method({
  247. selector: "extensionCategoriesOfPackage:",
  248. category: 'accessing',
  249. fn: function (aPackage){
  250. var self=this;
  251. var name,map,result;
  252. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  253. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  254. function $MethodCategory(){return smalltalk.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  255. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  256. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  257. return smalltalk.withContext(function($ctx1) {
  258. var $1,$2;
  259. name=_st(aPackage)._name();
  260. result=_st($OrderedCollection())._new();
  261. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  262. return smalltalk.withContext(function($ctx2) {
  263. return _st([each,_st(each)._class()])._do_((function(aClass){
  264. return smalltalk.withContext(function($ctx3) {
  265. map=_st($Dictionary())._new();
  266. map;
  267. _st(aClass)._protocolsDo_((function(category,methods){
  268. return smalltalk.withContext(function($ctx4) {
  269. $1=_st(category)._match_("^\x5c*".__comma(name));
  270. if(smalltalk.assert($1)){
  271. return _st(map)._at_put_(category,methods);
  272. };
  273. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3)})}));
  274. return _st(result)._addAll_(_st(_st(_st(map)._keys())._sorted_((function(a,b){
  275. return smalltalk.withContext(function($ctx4) {
  276. return _st(a).__lt_eq(b);
  277. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._collect_((function(category){
  278. return smalltalk.withContext(function($ctx4) {
  279. return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
  280. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3)})})));
  281. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  282. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  283. $2=result;
  284. return $2;
  285. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},smalltalk.ChunkExporter)})},
  286. args: ["aPackage"],
  287. source: "extensionCategoriesOfPackage: aPackage\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk current classes) do: [:each |\x0a\x09\x09{each. each class} do: [:aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [:category :methods |\x0a\x09\x09\x09\x09(category match: '^\x5c*', 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",
  288. messageSends: ["name", "new", "do:", "protocolsDo:", "ifTrue:", "at:put:", "match:", ",", "addAll:", "collect:", "name:theClass:methods:", "at:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"],
  289. referencedClasses: ["OrderedCollection", "Dictionary", "MethodCategory", "Smalltalk", "Package"]
  290. }),
  291. smalltalk.ChunkExporter);
  292. smalltalk.addMethod(
  293. smalltalk.method({
  294. selector: "methodsOfCategory:",
  295. category: 'accessing',
  296. fn: function (aCategory){
  297. var self=this;
  298. return smalltalk.withContext(function($ctx1) {
  299. var $1;
  300. $1=_st(_st(aCategory)._methods())._sorted_((function(a,b){
  301. return smalltalk.withContext(function($ctx2) {
  302. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  303. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}));
  304. return $1;
  305. }, function($ctx1) {$ctx1.fill(self,"methodsOfCategory:",{aCategory:aCategory},smalltalk.ChunkExporter)})},
  306. args: ["aCategory"],
  307. source: "methodsOfCategory: aCategory\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^(aCategory methods) sorted: [:a :b | a selector <= b selector]",
  308. messageSends: ["sorted:", "<=", "selector", "methods"],
  309. referencedClasses: []
  310. }),
  311. smalltalk.ChunkExporter);
  312. smalltalk.addMethod(
  313. smalltalk.method({
  314. selector: "ownCategoriesOfClass:",
  315. category: 'accessing',
  316. fn: function (aClass){
  317. var self=this;
  318. var map;
  319. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  320. function $MethodCategory(){return smalltalk.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  321. return smalltalk.withContext(function($ctx1) {
  322. var $1,$2;
  323. map=_st($Dictionary())._new();
  324. _st(aClass)._protocolsDo_((function(category,methods){
  325. return smalltalk.withContext(function($ctx2) {
  326. $1=_st(category)._match_("^\x5c*");
  327. if(! smalltalk.assert($1)){
  328. return _st(map)._at_put_(category,methods);
  329. };
  330. }, function($ctx2) {$ctx2.fillBlock({category:category,methods:methods},$ctx1)})}));
  331. $2=_st(_st(_st(map)._keys())._sorted_((function(a,b){
  332. return smalltalk.withContext(function($ctx2) {
  333. return _st(a).__lt_eq(b);
  334. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._collect_((function(category){
  335. return smalltalk.withContext(function($ctx2) {
  336. return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
  337. }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1)})}));
  338. return $2;
  339. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},smalltalk.ChunkExporter)})},
  340. args: ["aClass"],
  341. source: "ownCategoriesOfClass: aClass\x0a\x09\x22Answer the protocols of aClassthat 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: [:category :methods |\x0a\x09\x09(category match: '^\x5c*') ifFalse: [ map at: category put: methods ]].\x0a\x09^(map keys sorted: [:a :b | a <= b ]) collect: [:category |\x0a\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category) ]",
  342. messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "collect:", "name:theClass:methods:", "at:", "sorted:", "<=", "keys"],
  343. referencedClasses: ["Dictionary", "MethodCategory"]
  344. }),
  345. smalltalk.ChunkExporter);
  346. smalltalk.addMethod(
  347. smalltalk.method({
  348. selector: "ownCategoriesOfMetaClass:",
  349. category: 'accessing',
  350. fn: function (aClass){
  351. var self=this;
  352. return smalltalk.withContext(function($ctx1) {
  353. var $1;
  354. $1=self._ownCategoriesOfClass_(_st(aClass)._class());
  355. return $1;
  356. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},smalltalk.ChunkExporter)})},
  357. args: ["aClass"],
  358. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^self ownCategoriesOfClass: aClass class",
  359. messageSends: ["ownCategoriesOfClass:", "class"],
  360. referencedClasses: []
  361. }),
  362. smalltalk.ChunkExporter);
  363. smalltalk.addMethod(
  364. smalltalk.method({
  365. selector: "recipe",
  366. category: 'fileOut',
  367. fn: function (){
  368. var self=this;
  369. var exportCategoryRecipe;
  370. function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
  371. return smalltalk.withContext(function($ctx1) {
  372. var $1;
  373. exportCategoryRecipe=[self.__minus_gt("exportCategoryPrologueOf:on:"),[self.__minus_gt("methodsOfCategory:"),self.__minus_gt("exportMethod:on:")],self.__minus_gt("exportCategoryEpilogueOf:on:")];
  374. $1=[self.__minus_gt("exportPackageDefinitionOf:on:"),[_st($PluggableExporter()).__minus_gt("ownClassesOfPackage:"),self.__minus_gt("exportDefinitionOf:on:"),_st([self.__minus_gt("ownCategoriesOfClass:")]).__comma(exportCategoryRecipe),self.__minus_gt("exportMetaDefinitionOf:on:"),_st([self.__minus_gt("ownCategoriesOfMetaClass:")]).__comma(exportCategoryRecipe)],_st([self.__minus_gt("extensionCategoriesOfPackage:")]).__comma(exportCategoryRecipe)];
  375. return $1;
  376. }, function($ctx1) {$ctx1.fill(self,"recipe",{exportCategoryRecipe:exportCategoryRecipe},smalltalk.ChunkExporter)})},
  377. args: [],
  378. source: "recipe\x0a\x09\x22Export a given package.\x22\x0a\x0a\x09| exportCategoryRecipe |\x0a\x09exportCategoryRecipe := {\x0a\x09\x09self -> #exportCategoryPrologueOf:on:.\x0a\x09\x09{\x0a\x09\x09\x09self -> #methodsOfCategory:.\x0a\x09\x09\x09self -> #exportMethod:on: }.\x0a\x09\x09self -> #exportCategoryEpilogueOf:on: }.\x0a\x0a\x09^{\x0a\x09\x09self -> #exportPackageDefinitionOf:on:.\x0a\x09\x09{\x0a\x09\x09\x09PluggableExporter -> #ownClassesOfPackage:.\x0a\x09\x09\x09self -> #exportDefinitionOf:on:.\x0a\x09\x09\x09{ self -> #ownCategoriesOfClass: }, exportCategoryRecipe.\x0a\x09\x09\x09self -> #exportMetaDefinitionOf:on:.\x0a\x09\x09\x09{ self -> #ownCategoriesOfMetaClass: }, exportCategoryRecipe }.\x0a\x09\x09{ self -> #extensionCategoriesOfPackage: }, exportCategoryRecipe\x0a\x09}",
  379. messageSends: ["->", ","],
  380. referencedClasses: ["PluggableExporter"]
  381. }),
  382. smalltalk.ChunkExporter);
  383. smalltalk.addClass('Exporter', smalltalk.AbstractExporter, [], 'Importer-Exporter');
  384. smalltalk.Exporter.comment="I am responsible for outputting Amber code into a JavaScript string.\x0a\x0aThe generated output is enough to reconstruct the exported data, including Smalltalk source code and other metadata.\x0a\x0a## Use case\x0a\x0aI am typically used to save code outside of the Amber runtime (committing to disk, etc.).\x0a\x0a## API\x0a\x0aUse `#exportAll`, `#exportClass:` or `#exportPackage:` methods.";
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "amdRecipe",
  388. category: 'fileOut',
  389. fn: function (){
  390. var self=this;
  391. var legacy,result;
  392. function $AmdExporter(){return smalltalk.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  393. return smalltalk.withContext(function($ctx1) {
  394. var $1;
  395. legacy=self._recipe();
  396. result=_st(_st(_st(legacy)._copyFrom_to_((1),(2))).__comma([_st($AmdExporter()).__minus_gt("exportPackageTransportOf:on:")])).__comma(_st(legacy)._copyFrom_to_((3),_st(legacy)._size()));
  397. _st(_st(result)._first())._key_($AmdExporter());
  398. _st(_st(result)._last())._key_($AmdExporter());
  399. $1=result;
  400. return $1;
  401. }, function($ctx1) {$ctx1.fill(self,"amdRecipe",{legacy:legacy,result:result},smalltalk.Exporter)})},
  402. args: [],
  403. source: "amdRecipe\x0a\x09\x22Export a given package with amd transport type.\x22\x0a\x0a\x09| legacy result |\x0a\x09legacy := self recipe.\x0a\x09result := (legacy copyFrom: 1 to: 2),\x0a\x09{ AmdExporter -> #exportPackageTransportOf:on: },\x0a\x09(legacy copyFrom: 3 to: legacy size).\x0a\x09result first key: AmdExporter.\x0a\x09result last key: AmdExporter.\x0a\x09^result",
  404. messageSends: ["recipe", ",", "copyFrom:to:", "size", "->", "key:", "first", "last"],
  405. referencedClasses: ["AmdExporter"]
  406. }),
  407. smalltalk.Exporter);
  408. smalltalk.addMethod(
  409. smalltalk.method({
  410. selector: "classNameFor:",
  411. category: 'convenience',
  412. fn: function (aClass){
  413. var self=this;
  414. return smalltalk.withContext(function($ctx1) {
  415. var $2,$3,$1;
  416. $2=_st(aClass)._isMetaclass();
  417. if(smalltalk.assert($2)){
  418. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(".klass");
  419. } else {
  420. $3=_st(aClass)._isNil();
  421. if(smalltalk.assert($3)){
  422. $1="nil";
  423. } else {
  424. $1=_st(aClass)._name();
  425. };
  426. };
  427. return $1;
  428. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.Exporter)})},
  429. args: ["aClass"],
  430. 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 ] ]",
  431. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"],
  432. referencedClasses: []
  433. }),
  434. smalltalk.Exporter);
  435. smalltalk.addMethod(
  436. smalltalk.method({
  437. selector: "exportDefinitionOf:on:",
  438. category: 'output',
  439. fn: function (aClass,aStream){
  440. var self=this;
  441. return smalltalk.withContext(function($ctx1) {
  442. var $1,$2,$3,$4,$5,$6,$7;
  443. $1=aStream;
  444. _st($1)._lf();
  445. _st($1)._nextPutAll_("smalltalk.addClass(");
  446. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  447. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  448. $2=_st($1)._nextPutAll_(", [");
  449. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  450. return smalltalk.withContext(function($ctx2) {
  451. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  452. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  453. return smalltalk.withContext(function($ctx2) {
  454. return _st(aStream)._nextPutAll_(", ");
  455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  456. $3=aStream;
  457. _st($3)._nextPutAll_("], '");
  458. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  459. $4=_st($3)._nextPutAll_(");");
  460. $5=_st(_st(aClass)._comment())._notEmpty();
  461. if(smalltalk.assert($5)){
  462. $6=aStream;
  463. _st($6)._lf();
  464. _st($6)._nextPutAll_("smalltalk.");
  465. _st($6)._nextPutAll_(self._classNameFor_(aClass));
  466. _st($6)._nextPutAll_(".comment=");
  467. _st($6)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
  468. $7=_st($6)._nextPutAll_(";");
  469. $7;
  470. };
  471. _st(aStream)._lf();
  472. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  473. args: ["aClass", "aStream"],
  474. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'smalltalk.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09\x09separatedBy: [aStream nextPutAll: ', '].\x0a\x09aStream\x0a\x09\x09nextPutAll: '], ''';\x0a\x09\x09nextPutAll: aClass category, '''';\x0a\x09\x09nextPutAll: ');'.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09nextPutAll: 'smalltalk.';\x0a\x09\x09nextPutAll: (self classNameFor: aClass);\x0a\x09\x09nextPutAll: '.comment=';\x0a\x09\x09nextPutAll: aClass comment asJavascript;\x0a\x09\x09nextPutAll: ';'].\x0a\x09aStream lf",
  475. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "asJavascript", "comment", "notEmpty"],
  476. referencedClasses: []
  477. }),
  478. smalltalk.Exporter);
  479. smalltalk.addMethod(
  480. smalltalk.method({
  481. selector: "exportMetaDefinitionOf:on:",
  482. category: 'output',
  483. fn: function (aClass,aStream){
  484. var self=this;
  485. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  486. return smalltalk.withContext(function($ctx1) {
  487. var $1,$2,$3;
  488. _st(aStream)._lf();
  489. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  490. if(! smalltalk.assert($1)){
  491. $2=aStream;
  492. _st($2)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._class())));
  493. $3=_st($2)._nextPutAll_(".iVarNames = [");
  494. $3;
  495. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  496. return smalltalk.withContext(function($ctx2) {
  497. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  498. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  499. return smalltalk.withContext(function($ctx2) {
  500. return _st(aStream)._nextPutAll_(",");
  501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  502. _st(aStream)._nextPutAll_("];".__comma(_st($String())._lf()));
  503. };
  504. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  505. args: ["aClass", "aStream"],
  506. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass class);\x0a\x09\x09nextPutAll: '.iVarNames = ['.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09\x09separatedBy: [aStream nextPutAll: ','].\x0a\x09\x09aStream nextPutAll: '];', String lf]",
  507. messageSends: ["lf", "ifFalse:", "nextPutAll:", ",", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "isEmpty"],
  508. referencedClasses: ["String"]
  509. }),
  510. smalltalk.Exporter);
  511. smalltalk.addMethod(
  512. smalltalk.method({
  513. selector: "exportMethod:on:",
  514. category: 'output',
  515. fn: function (aMethod,aStream){
  516. var self=this;
  517. return smalltalk.withContext(function($ctx1) {
  518. var $1,$2,$3,$4;
  519. $1=aStream;
  520. _st($1)._nextPutAll_("smalltalk.addMethod(");
  521. _st($1)._lf();
  522. _st($1)._nextPutAll_("smalltalk.method({");
  523. _st($1)._lf();
  524. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  525. _st($1)._lf();
  526. _st($1)._nextPutAll_(_st("category: '".__comma(_st(aMethod)._category())).__comma("',"));
  527. _st($1)._lf();
  528. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  529. _st($1)._lf();
  530. _st($1)._nextPutAll_(_st("args: ".__comma(_st(_st(aMethod)._arguments())._asJavascript())).__comma(","));
  531. _st($1)._lf();
  532. _st($1)._nextPutAll_(_st("source: ".__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
  533. _st($1)._lf();
  534. _st($1)._nextPutAll_(_st("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript())).__comma(","));
  535. _st($1)._lf();
  536. $2=_st($1)._nextPutAll_("referencedClasses: ".__comma(_st(_st(aMethod)._referencedClasses())._asJavascript()));
  537. $3=aStream;
  538. _st($3)._lf();
  539. _st($3)._nextPutAll_("}),");
  540. _st($3)._lf();
  541. _st($3)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
  542. _st($3)._nextPutAll_(");");
  543. _st($3)._lf();
  544. $4=_st($3)._lf();
  545. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.Exporter)})},
  546. args: ["aMethod", "aStream"],
  547. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addMethod(';lf;\x0a\x09\x09\x22nextPutAll: aMethod selector asSelector asJavascript, ',';lf;\x22\x0a\x09\x09nextPutAll: 'smalltalk.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'category: ''', aMethod category, ''',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript.\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aMethod methodClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
  548. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "category", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:", "methodClass"],
  549. referencedClasses: []
  550. }),
  551. smalltalk.Exporter);
  552. smalltalk.addMethod(
  553. smalltalk.method({
  554. selector: "exportPackageDefinitionOf:on:",
  555. category: 'output',
  556. fn: function (aPackage,aStream){
  557. var self=this;
  558. return smalltalk.withContext(function($ctx1) {
  559. var $1,$2;
  560. $1=aStream;
  561. _st($1)._nextPutAll_("smalltalk.addPackage(");
  562. _st($1)._nextPutAll_(_st("'".__comma(_st(aPackage)._name())).__comma("');"));
  563. $2=_st($1)._lf();
  564. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  565. args: ["aPackage", "aStream"],
  566. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  567. messageSends: ["nextPutAll:", ",", "name", "lf"],
  568. referencedClasses: []
  569. }),
  570. smalltalk.Exporter);
  571. smalltalk.addMethod(
  572. smalltalk.method({
  573. selector: "exportPackageEpilogueOf:on:",
  574. category: 'output',
  575. fn: function (aPackage,aStream){
  576. var self=this;
  577. return smalltalk.withContext(function($ctx1) {
  578. var $1,$2;
  579. $1=aStream;
  580. _st($1)._nextPutAll_("})(global_smalltalk,global_nil,global__st);");
  581. $2=_st($1)._lf();
  582. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  583. args: ["aPackage", "aStream"],
  584. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '})(global_smalltalk,global_nil,global__st);';\x0a\x09\x09lf",
  585. messageSends: ["nextPutAll:", "lf"],
  586. referencedClasses: []
  587. }),
  588. smalltalk.Exporter);
  589. smalltalk.addMethod(
  590. smalltalk.method({
  591. selector: "exportPackagePrologueOf:on:",
  592. category: 'output',
  593. fn: function (aPackage,aStream){
  594. var self=this;
  595. return smalltalk.withContext(function($ctx1) {
  596. var $1,$2;
  597. $1=aStream;
  598. _st($1)._nextPutAll_("(function(smalltalk,nil,_st){");
  599. $2=_st($1)._lf();
  600. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  601. args: ["aPackage", "aStream"],
  602. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '(function(smalltalk,nil,_st){';\x0a\x09\x09lf",
  603. messageSends: ["nextPutAll:", "lf"],
  604. referencedClasses: []
  605. }),
  606. smalltalk.Exporter);
  607. smalltalk.addMethod(
  608. smalltalk.method({
  609. selector: "extensionMethodsOfPackage:",
  610. category: 'accessing',
  611. fn: function (aPackage){
  612. var self=this;
  613. var name,result;
  614. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  615. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  616. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  617. return smalltalk.withContext(function($ctx1) {
  618. var $1;
  619. name=_st(aPackage)._name();
  620. result=_st($OrderedCollection())._new();
  621. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  622. return smalltalk.withContext(function($ctx2) {
  623. return _st([each,_st(each)._class()])._do_((function(aClass){
  624. return smalltalk.withContext(function($ctx3) {
  625. return _st(result)._addAll_(_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  626. return smalltalk.withContext(function($ctx4) {
  627. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  628. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._select_((function(method){
  629. return smalltalk.withContext(function($ctx4) {
  630. return _st(_st(method)._category())._match_("^\x5c*".__comma(name));
  631. }, function($ctx4) {$ctx4.fillBlock({method:method},$ctx3)})})));
  632. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  633. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  634. $1=result;
  635. return $1;
  636. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,name:name,result:result},smalltalk.Exporter)})},
  637. args: ["aPackage"],
  638. source: "extensionMethodsOfPackage: aPackage\x0a\x09\x22Issue #143: sort classes and methods alphabetically\x22\x0a\x0a\x09| name result |\x0a\x09name := aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk current classes) do: [:each |\x0a\x09\x09{each. each class} do: [:aClass |\x0a\x09\x09\x09result addAll: (((aClass methodDictionary values)\x0a\x09\x09\x09\x09sorted: [:a :b | a selector <= b selector])\x0a\x09\x09\x09\x09select: [:method | method category match: '^\x5c*', name]) ]].\x0a\x09^result",
  639. messageSends: ["name", "new", "do:", "addAll:", "select:", "match:", ",", "category", "sorted:", "<=", "selector", "values", "methodDictionary", "class", "sortedClasses:", "classes", "current"],
  640. referencedClasses: ["OrderedCollection", "Smalltalk", "Package"]
  641. }),
  642. smalltalk.Exporter);
  643. smalltalk.addMethod(
  644. smalltalk.method({
  645. selector: "ownMethodsOfClass:",
  646. category: 'accessing',
  647. fn: function (aClass){
  648. var self=this;
  649. return smalltalk.withContext(function($ctx1) {
  650. var $1;
  651. $1=_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  652. return smalltalk.withContext(function($ctx2) {
  653. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  654. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._reject_((function(each){
  655. return smalltalk.withContext(function($ctx2) {
  656. return _st(_st(each)._category())._match_("^\x5c*");
  657. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  658. return $1;
  659. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},smalltalk.Exporter)})},
  660. args: ["aClass"],
  661. source: "ownMethodsOfClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^((aClass methodDictionary values) sorted: [:a :b | a selector <= b selector])\x0a\x09\x09reject: [:each | (each category match: '^\x5c*')]",
  662. messageSends: ["reject:", "match:", "category", "sorted:", "<=", "selector", "values", "methodDictionary"],
  663. referencedClasses: []
  664. }),
  665. smalltalk.Exporter);
  666. smalltalk.addMethod(
  667. smalltalk.method({
  668. selector: "ownMethodsOfMetaClass:",
  669. category: 'accessing',
  670. fn: function (aClass){
  671. var self=this;
  672. return smalltalk.withContext(function($ctx1) {
  673. var $1;
  674. $1=self._ownMethodsOfClass_(_st(aClass)._class());
  675. return $1;
  676. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},smalltalk.Exporter)})},
  677. args: ["aClass"],
  678. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^self ownMethodsOfClass: aClass class",
  679. messageSends: ["ownMethodsOfClass:", "class"],
  680. referencedClasses: []
  681. }),
  682. smalltalk.Exporter);
  683. smalltalk.addMethod(
  684. smalltalk.method({
  685. selector: "recipe",
  686. category: 'fileOut',
  687. fn: function (){
  688. var self=this;
  689. function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
  690. return smalltalk.withContext(function($ctx1) {
  691. var $1;
  692. $1=[self.__minus_gt("exportPackagePrologueOf:on:"),self.__minus_gt("exportPackageDefinitionOf:on:"),[_st($PluggableExporter()).__minus_gt("ownClassesOfPackage:"),self.__minus_gt("exportDefinitionOf:on:"),[self.__minus_gt("ownMethodsOfClass:"),self.__minus_gt("exportMethod:on:")],self.__minus_gt("exportMetaDefinitionOf:on:"),[self.__minus_gt("ownMethodsOfMetaClass:"),self.__minus_gt("exportMethod:on:")]],[self.__minus_gt("extensionMethodsOfPackage:"),self.__minus_gt("exportMethod:on:")],self.__minus_gt("exportPackageEpilogueOf:on:")];
  693. return $1;
  694. }, function($ctx1) {$ctx1.fill(self,"recipe",{},smalltalk.Exporter)})},
  695. args: [],
  696. source: "recipe\x0a\x09\x22Export a given package.\x22\x0a\x0a\x09^{\x0a\x09\x09self -> #exportPackagePrologueOf:on:.\x0a\x09\x09self -> #exportPackageDefinitionOf:on:.\x0a\x09\x09{\x0a\x09\x09\x09PluggableExporter -> #ownClassesOfPackage:.\x0a\x09\x09\x09self -> #exportDefinitionOf:on:.\x0a\x09\x09\x09{\x0a\x09\x09\x09\x09self -> #ownMethodsOfClass:.\x0a\x09\x09\x09\x09self -> #exportMethod:on: }.\x0a\x09\x09\x09self -> #exportMetaDefinitionOf:on:.\x0a\x09\x09\x09{\x0a\x09\x09\x09\x09self -> #ownMethodsOfMetaClass:.\x0a\x09\x09\x09\x09self -> #exportMethod:on: } }.\x0a\x09\x09{\x0a\x09\x09\x09self -> #extensionMethodsOfPackage:.\x0a\x09\x09\x09self -> #exportMethod:on: }.\x0a\x09\x09self -> #exportPackageEpilogueOf:on:\x0a\x09}",
  697. messageSends: ["->"],
  698. referencedClasses: ["PluggableExporter"]
  699. }),
  700. smalltalk.Exporter);
  701. smalltalk.addClass('StrippedExporter', smalltalk.Exporter, [], 'Importer-Exporter');
  702. smalltalk.StrippedExporter.comment="I export Amber code into a JavaScript string, but without any optional associated data like the Amber source code.";
  703. smalltalk.addMethod(
  704. smalltalk.method({
  705. selector: "exportDefinitionOf:on:",
  706. category: 'output',
  707. fn: function (aClass,aStream){
  708. var self=this;
  709. return smalltalk.withContext(function($ctx1) {
  710. var $1,$2,$3,$4;
  711. $1=aStream;
  712. _st($1)._lf();
  713. _st($1)._nextPutAll_("smalltalk.addClass(");
  714. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  715. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  716. $2=_st($1)._nextPutAll_(", [");
  717. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  718. return smalltalk.withContext(function($ctx2) {
  719. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  720. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  721. return smalltalk.withContext(function($ctx2) {
  722. return _st(aStream)._nextPutAll_(", ");
  723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  724. $3=aStream;
  725. _st($3)._nextPutAll_("], '");
  726. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  727. $4=_st($3)._nextPutAll_(");");
  728. _st(aStream)._lf();
  729. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.StrippedExporter)})},
  730. args: ["aClass", "aStream"],
  731. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'smalltalk.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09\x09separatedBy: [aStream nextPutAll: ', '].\x0a\x09aStream\x0a\x09\x09nextPutAll: '], ''';\x0a\x09\x09nextPutAll: aClass category, '''';\x0a\x09\x09nextPutAll: ');'.\x0a\x09aStream lf",
  732. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category"],
  733. referencedClasses: []
  734. }),
  735. smalltalk.StrippedExporter);
  736. smalltalk.addMethod(
  737. smalltalk.method({
  738. selector: "exportMethod:on:",
  739. category: 'output',
  740. fn: function (aMethod,aStream){
  741. var self=this;
  742. return smalltalk.withContext(function($ctx1) {
  743. var $1,$2;
  744. $1=aStream;
  745. _st($1)._nextPutAll_("smalltalk.addMethod(");
  746. _st($1)._lf();
  747. _st($1)._nextPutAll_("smalltalk.method({");
  748. _st($1)._lf();
  749. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  750. _st($1)._lf();
  751. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  752. _st($1)._lf();
  753. _st($1)._nextPutAll_("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript()));
  754. _st($1)._nextPutAll_("}),");
  755. _st($1)._lf();
  756. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
  757. _st($1)._nextPutAll_(");");
  758. _st($1)._lf();
  759. $2=_st($1)._lf();
  760. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.StrippedExporter)})},
  761. args: ["aMethod", "aStream"],
  762. 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: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aMethod methodClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
  763. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "compiledSource", "fn", "messageSends", "classNameFor:", "methodClass"],
  764. referencedClasses: []
  765. }),
  766. smalltalk.StrippedExporter);
  767. smalltalk.addClass('AmdExporter', smalltalk.Object, [], 'Importer-Exporter');
  768. smalltalk.addMethod(
  769. smalltalk.method({
  770. selector: "amdNamesOfPackages:",
  771. category: 'private',
  772. fn: function (anArray){
  773. var self=this;
  774. var deps,depNames;
  775. return smalltalk.withContext(function($ctx1) {
  776. var $1;
  777. $1=_st(_st(anArray)._select_((function(each){
  778. return smalltalk.withContext(function($ctx2) {
  779. return _st(_st(each)._amdNamespace())._notNil();
  780. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._collect_((function(each){
  781. return smalltalk.withContext(function($ctx2) {
  782. return _st(_st(_st(each)._amdNamespace()).__comma("/")).__comma(_st(each)._name());
  783. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  784. return $1;
  785. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray,deps:deps,depNames:depNames},smalltalk.AmdExporter.klass)})},
  786. args: ["anArray"],
  787. source: "amdNamesOfPackages: anArray\x0a\x09| deps depNames |\x0a\x09^(anArray\x0a\x09\x09select: [ :each | each amdNamespace notNil ])\x0a\x09\x09collect: [ :each | each amdNamespace, '/', each name ]",
  788. messageSends: ["collect:", ",", "name", "amdNamespace", "select:", "notNil"],
  789. referencedClasses: []
  790. }),
  791. smalltalk.AmdExporter.klass);
  792. smalltalk.addMethod(
  793. smalltalk.method({
  794. selector: "exportPackageEpilogueOf:on:",
  795. category: 'exporting-output',
  796. fn: function (aPackage,aStream){
  797. var self=this;
  798. return smalltalk.withContext(function($ctx1) {
  799. var $1,$2;
  800. $1=aStream;
  801. _st($1)._nextPutAll_("});");
  802. $2=_st($1)._lf();
  803. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter.klass)})},
  804. args: ["aPackage", "aStream"],
  805. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  806. messageSends: ["nextPutAll:", "lf"],
  807. referencedClasses: []
  808. }),
  809. smalltalk.AmdExporter.klass);
  810. smalltalk.addMethod(
  811. smalltalk.method({
  812. selector: "exportPackagePrologueOf:on:",
  813. category: 'exporting-output',
  814. fn: function (aPackage,aStream){
  815. var self=this;
  816. return smalltalk.withContext(function($ctx1) {
  817. var $1,$2,$4,$3,$5;
  818. $1=aStream;
  819. _st($1)._nextPutAll_("define(\x22");
  820. $2=$1;
  821. $4=_st(aPackage)._amdNamespace();
  822. if(($receiver = $4) == nil || $receiver == undefined){
  823. $3="amber";
  824. } else {
  825. $3=$4;
  826. };
  827. _st($2)._nextPutAll_($3);
  828. _st($1)._nextPutAll_("/");
  829. _st($1)._nextPutAll_(_st(aPackage)._name());
  830. _st($1)._nextPutAll_("\x22, ");
  831. _st($1)._nextPutAll_(_st(["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st"].__comma(self._amdNamesOfPackages_(_st(aPackage)._loadDependencies())))._asJavascript());
  832. _st($1)._nextPutAll_(", function(smalltalk,nil,_st){");
  833. $5=_st($1)._lf();
  834. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter.klass)})},
  835. args: ["aPackage", "aStream"],
  836. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'define(\x22';\x0a\x09\x09nextPutAll: (aPackage amdNamespace ifNil: [ 'amber' ]); \x22ifNil: only for LegacyPH, it should not happen with AmdPH\x22\x0a\x09\x09nextPutAll: '/';\x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, ';\x0a\x09\x09nextPutAll: (#('amber_vm/smalltalk' 'amber_vm/nil' 'amber_vm/_st'), (self amdNamesOfPackages: aPackage loadDependencies)) asJavascript;\x0a\x09\x09nextPutAll: ', function(smalltalk,nil,_st){';\x0a\x09\x09lf",
  837. messageSends: ["nextPutAll:", "ifNil:", "amdNamespace", "name", "asJavascript", ",", "amdNamesOfPackages:", "loadDependencies", "lf"],
  838. referencedClasses: []
  839. }),
  840. smalltalk.AmdExporter.klass);
  841. smalltalk.addMethod(
  842. smalltalk.method({
  843. selector: "exportPackageTransportOf:on:",
  844. category: 'exporting-output',
  845. fn: function (aPackage,aStream){
  846. var self=this;
  847. return smalltalk.withContext(function($ctx1) {
  848. var $1,$2;
  849. $1=aStream;
  850. _st($1)._nextPutAll_("smalltalk.packages[");
  851. _st($1)._nextPutAll_(_st(_st(aPackage)._name())._asJavascript());
  852. _st($1)._nextPutAll_("].transport = ");
  853. _st($1)._nextPutAll_(_st(aPackage)._transportJson());
  854. _st($1)._nextPutAll_(";");
  855. $2=_st($1)._lf();
  856. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter.klass)})},
  857. args: ["aPackage", "aStream"],
  858. 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 transportJson;\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf",
  859. messageSends: ["nextPutAll:", "asJavascript", "name", "transportJson", "lf"],
  860. referencedClasses: []
  861. }),
  862. smalltalk.AmdExporter.klass);
  863. smalltalk.addClass('ChunkParser', smalltalk.Object, ['stream'], 'Importer-Exporter');
  864. smalltalk.ChunkParser.comment="I am responsible for parsing aStream contents in the chunk format.\x0a\x0a## API\x0a\x0a ChunkParser new\x0a stream: aStream;\x0a nextChunk";
  865. smalltalk.addMethod(
  866. smalltalk.method({
  867. selector: "nextChunk",
  868. category: 'reading',
  869. fn: function (){
  870. var self=this;
  871. var char,result,chunk;
  872. return smalltalk.withContext(function($ctx1) {
  873. var $1,$2,$3;
  874. var $early={};
  875. try {
  876. result=""._writeStream();
  877. _st((function(){
  878. return smalltalk.withContext(function($ctx2) {
  879. char=_st(self["@stream"])._next();
  880. char;
  881. return _st(char)._notNil();
  882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  883. return smalltalk.withContext(function($ctx2) {
  884. $1=_st(char).__eq("!");
  885. if(smalltalk.assert($1)){
  886. $2=_st(_st(self["@stream"])._peek()).__eq("!");
  887. if(smalltalk.assert($2)){
  888. _st(self["@stream"])._next();
  889. } else {
  890. $3=_st(_st(result)._contents())._trimBoth();
  891. throw $early=[$3];
  892. };
  893. };
  894. return _st(result)._nextPut_(char);
  895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  896. return nil;
  897. }
  898. catch(e) {if(e===$early)return e[0]; throw e}
  899. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},smalltalk.ChunkParser)})},
  900. args: [],
  901. 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 metod returns next chunk as a String (trimmed), empty String (all whitespace) or nil.\x22\x0a\x0a\x09| char result chunk |\x0a\x09result := '' writeStream.\x0a\x09\x09[char := stream next.\x0a\x09\x09char notNil] whileTrue: [\x0a\x09\x09\x09\x09char = '!' ifTrue: [\x0a\x09\x09\x09\x09\x09\x09stream peek = '!'\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifTrue: [stream next \x22skipping the escape double\x22]\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifFalse: [^result contents trimBoth \x22chunk end marker found\x22]].\x0a\x09\x09\x09\x09result nextPut: char].\x0a\x09^nil \x22a chunk needs to end with !\x22",
  902. messageSends: ["writeStream", "whileTrue:", "ifTrue:", "ifTrue:ifFalse:", "next", "trimBoth", "contents", "=", "peek", "nextPut:", "notNil"],
  903. referencedClasses: []
  904. }),
  905. smalltalk.ChunkParser);
  906. smalltalk.addMethod(
  907. smalltalk.method({
  908. selector: "stream:",
  909. category: 'accessing',
  910. fn: function (aStream){
  911. var self=this;
  912. return smalltalk.withContext(function($ctx1) {
  913. self["@stream"]=aStream;
  914. return self}, function($ctx1) {$ctx1.fill(self,"stream:",{aStream:aStream},smalltalk.ChunkParser)})},
  915. args: ["aStream"],
  916. source: "stream: aStream\x0a\x09stream := aStream",
  917. messageSends: [],
  918. referencedClasses: []
  919. }),
  920. smalltalk.ChunkParser);
  921. smalltalk.addMethod(
  922. smalltalk.method({
  923. selector: "on:",
  924. category: 'not yet classified',
  925. fn: function (aStream){
  926. var self=this;
  927. return smalltalk.withContext(function($ctx1) {
  928. var $1;
  929. $1=_st(self._new())._stream_(aStream);
  930. return $1;
  931. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},smalltalk.ChunkParser.klass)})},
  932. args: ["aStream"],
  933. source: "on: aStream\x0a\x09^self new stream: aStream",
  934. messageSends: ["stream:", "new"],
  935. referencedClasses: []
  936. }),
  937. smalltalk.ChunkParser.klass);
  938. smalltalk.addClass('ExportRecipeInterpreter', smalltalk.Object, [], 'Importer-Exporter');
  939. smalltalk.ExportRecipeInterpreter.comment="I am an interpreter for export recipes.\x0a\x0a## Recipe format\x0a\x0aRecipe is an array, which can contain two kinds of elements:\x0a\x0a - an assocation where the key is the receiver and the value is a two-arguments selector\x0a In this case, `receiver perform: selector withArguments: { data. stream }` is called.\x0a\x09This essentially defines one step of export process.\x0a\x09The key (eg. receiver) is presumed to be some kind of 'repository' of the exporting methods\x0a\x09that just format appropriate aspect of data into a stream; like a class or a singleton,\x0a\x09so that the recipe itself can be decoupled from data.\x0a\x0a - a subarray, where first element is special and the rest is recursive recipe.\x0a\x0a `subarray first` must be an association similar to one above,\x0a\x09with key being the 'repository' receiver, but value is one-arg selector.\x0a\x09In this case, `receiver perform: selector withArguments: { data }` should create a collection.\x0a\x09Then, the sub-recipe (`subarray allButFirst`) is applied to every element of a collection, eg.\x0a\x09 collection do: [ :each | self export: each using: sa allButFirst on: stream ]";
  940. smalltalk.addMethod(
  941. smalltalk.method({
  942. selector: "interpret:for:on:",
  943. category: 'interpreting',
  944. fn: function (aRecipe,anObject,aStream){
  945. var self=this;
  946. var recipeStream;
  947. return smalltalk.withContext(function($ctx1) {
  948. recipeStream=_st(aRecipe)._readStream();
  949. _st((function(){
  950. return smalltalk.withContext(function($ctx2) {
  951. return _st(recipeStream)._atEnd();
  952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  953. return smalltalk.withContext(function($ctx2) {
  954. return self._interpretStep_for_on_(_st(recipeStream)._next(),anObject,aStream);
  955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  956. return self}, function($ctx1) {$ctx1.fill(self,"interpret:for:on:",{aRecipe:aRecipe,anObject:anObject,aStream:aStream,recipeStream:recipeStream},smalltalk.ExportRecipeInterpreter)})},
  957. args: ["aRecipe", "anObject", "aStream"],
  958. source: "interpret: aRecipe for: anObject on: aStream\x0a\x09| recipeStream |\x0a\x09\x0a\x09recipeStream := aRecipe readStream.\x0a\x09\x0a\x09[ recipeStream atEnd ] whileFalse: [\x0a\x09\x09self \x0a\x09\x09\x09interpretStep: recipeStream next\x0a\x09\x09\x09for: anObject\x0a\x09\x09\x09on: aStream ]",
  959. messageSends: ["readStream", "whileFalse:", "interpretStep:for:on:", "next", "atEnd"],
  960. referencedClasses: []
  961. }),
  962. smalltalk.ExportRecipeInterpreter);
  963. smalltalk.addMethod(
  964. smalltalk.method({
  965. selector: "interpretStep:for:on:",
  966. category: 'interpreting',
  967. fn: function (aRecipeStep,anObject,aStream){
  968. var self=this;
  969. return smalltalk.withContext(function($ctx1) {
  970. var $1,$2;
  971. $1=_st(_st(aRecipeStep)._value()).__eq_eq(aRecipeStep);
  972. if(smalltalk.assert($1)){
  973. $2=self._interpretSubRecipe_for_on_(aRecipeStep,anObject,aStream);
  974. return $2;
  975. };
  976. _st(_st(aRecipeStep)._key())._perform_withArguments_(_st(aRecipeStep)._value(),[anObject,aStream]);
  977. return self}, function($ctx1) {$ctx1.fill(self,"interpretStep:for:on:",{aRecipeStep:aRecipeStep,anObject:anObject,aStream:aStream},smalltalk.ExportRecipeInterpreter)})},
  978. args: ["aRecipeStep", "anObject", "aStream"],
  979. source: "interpretStep: aRecipeStep for: anObject on: aStream\x0a\x09aRecipeStep value == aRecipeStep ifTrue: [ \x0a\x09\x09^ self interpretSubRecipe: aRecipeStep for: anObject on: aStream ].\x0a\x09\x09\x09\x0a\x09aRecipeStep key perform: aRecipeStep value withArguments: { anObject. aStream }",
  980. messageSends: ["ifTrue:", "interpretSubRecipe:for:on:", "==", "value", "perform:withArguments:", "key"],
  981. referencedClasses: []
  982. }),
  983. smalltalk.ExportRecipeInterpreter);
  984. smalltalk.addMethod(
  985. smalltalk.method({
  986. selector: "interpretSubRecipe:for:on:",
  987. category: 'interpreting',
  988. fn: function (aRecipe,anObject,aStream){
  989. var self=this;
  990. var selection;
  991. return smalltalk.withContext(function($ctx1) {
  992. selection=_st(_st(_st(aRecipe)._first())._key())._perform_withArguments_(_st(_st(aRecipe)._first())._value(),[anObject]);
  993. _st(selection)._do_((function(each){
  994. return smalltalk.withContext(function($ctx2) {
  995. return self._interpret_for_on_(_st(aRecipe)._allButFirst(),each,aStream);
  996. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  997. return self}, function($ctx1) {$ctx1.fill(self,"interpretSubRecipe:for:on:",{aRecipe:aRecipe,anObject:anObject,aStream:aStream,selection:selection},smalltalk.ExportRecipeInterpreter)})},
  998. args: ["aRecipe", "anObject", "aStream"],
  999. source: "interpretSubRecipe: aRecipe for: anObject on: aStream\x0a\x09| selection |\x0a\x09selection := aRecipe first key \x0a\x09\x09perform: aRecipe first value \x0a\x09\x09withArguments: { anObject }.\x0a\x09selection do: [ :each |\x09\x0a\x09\x09self interpret: aRecipe allButFirst for: each on: aStream ]",
  1000. messageSends: ["perform:withArguments:", "value", "first", "key", "do:", "interpret:for:on:", "allButFirst"],
  1001. referencedClasses: []
  1002. }),
  1003. smalltalk.ExportRecipeInterpreter);
  1004. smalltalk.addClass('Importer', smalltalk.Object, [], 'Importer-Exporter');
  1005. smalltalk.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "import:",
  1009. category: 'fileIn',
  1010. fn: function (aStream){
  1011. var self=this;
  1012. var chunk,result,parser,lastEmpty;
  1013. function $ChunkParser(){return smalltalk.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  1014. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  1015. return smalltalk.withContext(function($ctx1) {
  1016. var $1,$2;
  1017. parser=_st($ChunkParser())._on_(aStream);
  1018. lastEmpty=false;
  1019. _st((function(){
  1020. return smalltalk.withContext(function($ctx2) {
  1021. chunk=_st(parser)._nextChunk();
  1022. chunk;
  1023. return _st(chunk)._isNil();
  1024. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  1025. return smalltalk.withContext(function($ctx2) {
  1026. $1=_st(chunk)._isEmpty();
  1027. if(smalltalk.assert($1)){
  1028. lastEmpty=true;
  1029. return lastEmpty;
  1030. } else {
  1031. result=_st(_st($Compiler())._new())._evaluateExpression_(chunk);
  1032. result;
  1033. $2=lastEmpty;
  1034. if(smalltalk.assert($2)){
  1035. lastEmpty=false;
  1036. lastEmpty;
  1037. return _st(result)._scanFrom_(parser);
  1038. };
  1039. };
  1040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1041. return self}, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},smalltalk.Importer)})},
  1042. args: ["aStream"],
  1043. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09[chunk := parser nextChunk.\x0a\x09chunk isNil] whileFalse: [\x0a\x09\x09chunk isEmpty\x0a\x09\x09\x09ifTrue: [lastEmpty := true]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser]]]",
  1044. messageSends: ["on:", "whileFalse:", "ifTrue:ifFalse:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "isEmpty", "nextChunk", "isNil"],
  1045. referencedClasses: ["ChunkParser", "Compiler"]
  1046. }),
  1047. smalltalk.Importer);
  1048. smalltalk.addClass('MethodCategory', smalltalk.Object, ['methods', 'name', 'theClass'], 'Importer-Exporter');
  1049. smalltalk.MethodCategory.comment="I am an abstraction for a method category in a class / metaclass.\x0a\x0aI know of my class, name and methods.\x0aI am used when exporting a package.";
  1050. smalltalk.addMethod(
  1051. smalltalk.method({
  1052. selector: "methods",
  1053. category: 'accessing',
  1054. fn: function (){
  1055. var self=this;
  1056. return smalltalk.withContext(function($ctx1) {
  1057. var $1;
  1058. $1=self["@methods"];
  1059. return $1;
  1060. }, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.MethodCategory)})},
  1061. args: [],
  1062. source: "methods\x0a\x09^methods",
  1063. messageSends: [],
  1064. referencedClasses: []
  1065. }),
  1066. smalltalk.MethodCategory);
  1067. smalltalk.addMethod(
  1068. smalltalk.method({
  1069. selector: "methods:",
  1070. category: 'accessing',
  1071. fn: function (aCollection){
  1072. var self=this;
  1073. return smalltalk.withContext(function($ctx1) {
  1074. self["@methods"]=aCollection;
  1075. return self}, function($ctx1) {$ctx1.fill(self,"methods:",{aCollection:aCollection},smalltalk.MethodCategory)})},
  1076. args: ["aCollection"],
  1077. source: "methods: aCollection\x0a\x09methods := aCollection",
  1078. messageSends: [],
  1079. referencedClasses: []
  1080. }),
  1081. smalltalk.MethodCategory);
  1082. smalltalk.addMethod(
  1083. smalltalk.method({
  1084. selector: "name",
  1085. category: 'accessing',
  1086. fn: function (){
  1087. var self=this;
  1088. return smalltalk.withContext(function($ctx1) {
  1089. var $1;
  1090. $1=self["@name"];
  1091. return $1;
  1092. }, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.MethodCategory)})},
  1093. args: [],
  1094. source: "name\x0a\x09^name",
  1095. messageSends: [],
  1096. referencedClasses: []
  1097. }),
  1098. smalltalk.MethodCategory);
  1099. smalltalk.addMethod(
  1100. smalltalk.method({
  1101. selector: "name:",
  1102. category: 'accessing',
  1103. fn: function (aString){
  1104. var self=this;
  1105. return smalltalk.withContext(function($ctx1) {
  1106. self["@name"]=aString;
  1107. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.MethodCategory)})},
  1108. args: ["aString"],
  1109. source: "name: aString\x0a\x09name := aString",
  1110. messageSends: [],
  1111. referencedClasses: []
  1112. }),
  1113. smalltalk.MethodCategory);
  1114. smalltalk.addMethod(
  1115. smalltalk.method({
  1116. selector: "theClass",
  1117. category: 'accessing',
  1118. fn: function (){
  1119. var self=this;
  1120. return smalltalk.withContext(function($ctx1) {
  1121. var $1;
  1122. $1=self["@theClass"];
  1123. return $1;
  1124. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.MethodCategory)})},
  1125. args: [],
  1126. source: "theClass\x0a\x09^theClass",
  1127. messageSends: [],
  1128. referencedClasses: []
  1129. }),
  1130. smalltalk.MethodCategory);
  1131. smalltalk.addMethod(
  1132. smalltalk.method({
  1133. selector: "theClass:",
  1134. category: 'accessing',
  1135. fn: function (aClass){
  1136. var self=this;
  1137. return smalltalk.withContext(function($ctx1) {
  1138. self["@theClass"]=aClass;
  1139. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.MethodCategory)})},
  1140. args: ["aClass"],
  1141. source: "theClass: aClass\x0a\x09theClass := aClass",
  1142. messageSends: [],
  1143. referencedClasses: []
  1144. }),
  1145. smalltalk.MethodCategory);
  1146. smalltalk.addMethod(
  1147. smalltalk.method({
  1148. selector: "name:theClass:methods:",
  1149. category: 'not yet classified',
  1150. fn: function (aString,aClass,anArray){
  1151. var self=this;
  1152. return smalltalk.withContext(function($ctx1) {
  1153. var $2,$3,$1;
  1154. $2=self._new();
  1155. _st($2)._name_(aString);
  1156. _st($2)._theClass_(aClass);
  1157. _st($2)._methods_(anArray);
  1158. $3=_st($2)._yourself();
  1159. $1=$3;
  1160. return $1;
  1161. }, function($ctx1) {$ctx1.fill(self,"name:theClass:methods:",{aString:aString,aClass:aClass,anArray:anArray},smalltalk.MethodCategory.klass)})},
  1162. args: ["aString", "aClass", "anArray"],
  1163. source: "name: aString theClass: aClass methods: anArray\x0a\x09^self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09methods: anArray;\x0a\x09\x09yourself",
  1164. messageSends: ["name:", "new", "theClass:", "methods:", "yourself"],
  1165. referencedClasses: []
  1166. }),
  1167. smalltalk.MethodCategory.klass);
  1168. smalltalk.addClass('PackageHandler', smalltalk.InterfacingObject, [], 'Importer-Exporter');
  1169. smalltalk.PackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  1170. smalltalk.addMethod(
  1171. smalltalk.method({
  1172. selector: "ajaxPutAt:data:",
  1173. category: 'private',
  1174. fn: function (aURL,aString){
  1175. var self=this;
  1176. return smalltalk.withContext(function($ctx1) {
  1177. self._ajax_(smalltalk.HashedCollection._from_(["url".__minus_gt(aURL),"type".__minus_gt("PUT"),"data".__minus_gt(aString),"contentType".__minus_gt("text/plain;charset=UTF-8"),"error".__minus_gt((function(xhr){
  1178. return smalltalk.withContext(function($ctx2) {
  1179. return self._error_(_st(_st(_st("Commiting ".__comma(aURL)).__comma(" failed with reason: \x22")).__comma(_st(xhr)._responseText())).__comma("\x22"));
  1180. }, function($ctx2) {$ctx2.fillBlock({xhr:xhr},$ctx1)})}))]));
  1181. return self}, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:",{aURL:aURL,aString:aString},smalltalk.PackageHandler)})},
  1182. args: ["aURL", "aString"],
  1183. source: "ajaxPutAt: aURL data: aString\x0a\x09self\x0a\x09\x09ajax: #{\x0a\x09\x09\x09'url' -> aURL.\x0a\x09\x09\x09'type' -> 'PUT'.\x0a\x09\x09\x09'data' -> aString.\x0a\x09\x09\x09'contentType' -> 'text/plain;charset=UTF-8'.\x0a\x09\x09\x09'error' -> [ :xhr | self error: 'Commiting ' , aURL , ' failed with reason: \x22' , (xhr responseText) , '\x22'] }",
  1184. messageSends: ["ajax:", "->", "error:", ",", "responseText"],
  1185. referencedClasses: []
  1186. }),
  1187. smalltalk.PackageHandler);
  1188. smalltalk.addMethod(
  1189. smalltalk.method({
  1190. selector: "commit:",
  1191. category: 'committing',
  1192. fn: function (aPackage){
  1193. var self=this;
  1194. function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
  1195. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1196. return smalltalk.withContext(function($ctx1) {
  1197. _st(self._commitChannels())._do_displayingProgress_((function(commitStrategyFactory){
  1198. var fileContents,commitStrategy;
  1199. return smalltalk.withContext(function($ctx2) {
  1200. commitStrategy=_st(commitStrategyFactory)._value_(aPackage);
  1201. commitStrategy;
  1202. fileContents=_st($String())._streamContents_((function(stream){
  1203. return smalltalk.withContext(function($ctx3) {
  1204. return _st(_st($PluggableExporter())._forRecipe_(_st(commitStrategy)._key()))._exportPackage_on_(aPackage,stream);
  1205. }, function($ctx3) {$ctx3.fillBlock({stream:stream},$ctx2)})}));
  1206. fileContents;
  1207. return self._ajaxPutAt_data_(_st(commitStrategy)._value(),fileContents);
  1208. }, function($ctx2) {$ctx2.fillBlock({commitStrategyFactory:commitStrategyFactory,fileContents:fileContents,commitStrategy:commitStrategy},$ctx1)})}),"Committing package ".__comma(_st(aPackage)._name()));
  1209. return self}, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1210. args: ["aPackage"],
  1211. source: "commit: aPackage\x0a\x09self commitChannels\x0a\x09\x09do: [ :commitStrategyFactory || fileContents commitStrategy |\x0a\x09\x09\x09commitStrategy := commitStrategyFactory value: aPackage.\x0a\x09\x09\x09fileContents := String streamContents: [ :stream |\x0a\x09\x09\x09\x09(PluggableExporter forRecipe: commitStrategy key) exportPackage: aPackage on: stream ].\x0a\x09\x09\x09self ajaxPutAt: commitStrategy value data: fileContents ]\x0a\x09\x09displayingProgress: 'Committing package ', aPackage name",
  1212. messageSends: ["do:displayingProgress:", "value:", "streamContents:", "exportPackage:on:", "forRecipe:", "key", "ajaxPutAt:data:", "value", ",", "name", "commitChannels"],
  1213. referencedClasses: ["PluggableExporter", "String"]
  1214. }),
  1215. smalltalk.PackageHandler);
  1216. smalltalk.addMethod(
  1217. smalltalk.method({
  1218. selector: "commitChannels",
  1219. category: 'committing',
  1220. fn: function (){
  1221. var self=this;
  1222. return smalltalk.withContext(function($ctx1) {
  1223. self._subclassResponsibility();
  1224. return self}, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.PackageHandler)})},
  1225. args: [],
  1226. source: "commitChannels\x0a\x09self subclassResponsibility",
  1227. messageSends: ["subclassResponsibility"],
  1228. referencedClasses: []
  1229. }),
  1230. smalltalk.PackageHandler);
  1231. smalltalk.PackageHandler.klass.iVarNames = ['registry'];
  1232. smalltalk.addMethod(
  1233. smalltalk.method({
  1234. selector: "classRegisteredFor:",
  1235. category: 'accessing',
  1236. fn: function (aString){
  1237. var self=this;
  1238. return smalltalk.withContext(function($ctx1) {
  1239. var $1;
  1240. $1=_st(self["@registry"])._at_(aString);
  1241. return $1;
  1242. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},smalltalk.PackageHandler.klass)})},
  1243. args: ["aString"],
  1244. source: "classRegisteredFor: aString\x0a\x09^registry at: aString",
  1245. messageSends: ["at:"],
  1246. referencedClasses: []
  1247. }),
  1248. smalltalk.PackageHandler.klass);
  1249. smalltalk.addMethod(
  1250. smalltalk.method({
  1251. selector: "for:",
  1252. category: 'accessing',
  1253. fn: function (aString){
  1254. var self=this;
  1255. return smalltalk.withContext(function($ctx1) {
  1256. var $1;
  1257. $1=_st(self._classRegisteredFor_(aString))._new();
  1258. return $1;
  1259. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},smalltalk.PackageHandler.klass)})},
  1260. args: ["aString"],
  1261. source: "for: aString\x0a\x09^(self classRegisteredFor: aString) new",
  1262. messageSends: ["new", "classRegisteredFor:"],
  1263. referencedClasses: []
  1264. }),
  1265. smalltalk.PackageHandler.klass);
  1266. smalltalk.addMethod(
  1267. smalltalk.method({
  1268. selector: "initialize",
  1269. category: 'initialization',
  1270. fn: function (){
  1271. var self=this;
  1272. return smalltalk.withContext(function($ctx1) {
  1273. smalltalk.PackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  1274. self["@registry"]=smalltalk.HashedCollection._from_([]);
  1275. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.PackageHandler.klass)})},
  1276. args: [],
  1277. source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}",
  1278. messageSends: ["initialize"],
  1279. referencedClasses: []
  1280. }),
  1281. smalltalk.PackageHandler.klass);
  1282. smalltalk.addMethod(
  1283. smalltalk.method({
  1284. selector: "register:for:",
  1285. category: 'registry',
  1286. fn: function (aClass,aString){
  1287. var self=this;
  1288. return smalltalk.withContext(function($ctx1) {
  1289. _st(self["@registry"])._at_put_(aString,aClass);
  1290. return self}, function($ctx1) {$ctx1.fill(self,"register:for:",{aClass:aClass,aString:aString},smalltalk.PackageHandler.klass)})},
  1291. args: ["aClass", "aString"],
  1292. source: "register: aClass for: aString\x0a\x09registry at: aString put: aClass",
  1293. messageSends: ["at:put:"],
  1294. referencedClasses: []
  1295. }),
  1296. smalltalk.PackageHandler.klass);
  1297. smalltalk.addMethod(
  1298. smalltalk.method({
  1299. selector: "registerFor:",
  1300. category: 'registry',
  1301. fn: function (aString){
  1302. var self=this;
  1303. function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
  1304. return smalltalk.withContext(function($ctx1) {
  1305. _st($PackageHandler())._register_for_(self,aString);
  1306. return self}, function($ctx1) {$ctx1.fill(self,"registerFor:",{aString:aString},smalltalk.PackageHandler.klass)})},
  1307. args: ["aString"],
  1308. source: "registerFor: aString\x0a\x09PackageHandler register: self for: aString",
  1309. messageSends: ["register:for:"],
  1310. referencedClasses: ["PackageHandler"]
  1311. }),
  1312. smalltalk.PackageHandler.klass);
  1313. smalltalk.addClass('AmdPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
  1314. smalltalk.AmdPackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  1315. smalltalk.addMethod(
  1316. smalltalk.method({
  1317. selector: "commitChannels",
  1318. category: 'committing',
  1319. fn: function (){
  1320. var self=this;
  1321. function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  1322. function $StrippedExporter(){return smalltalk.StrippedExporter||(typeof StrippedExporter=="undefined"?nil:StrippedExporter)}
  1323. function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  1324. return smalltalk.withContext(function($ctx1) {
  1325. var $1;
  1326. $1=[(function(pkg){
  1327. return smalltalk.withContext(function($ctx2) {
  1328. return _st(_st(_st($Exporter())._default())._amdRecipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".js"));
  1329. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  1330. return smalltalk.withContext(function($ctx2) {
  1331. return _st(_st(_st($StrippedExporter())._default())._amdRecipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".deploy.js"));
  1332. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  1333. return smalltalk.withContext(function($ctx2) {
  1334. return _st(_st(_st($ChunkExporter())._default())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathSt()).__comma("/")).__comma(_st(pkg)._name())).__comma(".st"));
  1335. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})})];
  1336. return $1;
  1337. }, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.AmdPackageHandler)})},
  1338. args: [],
  1339. source: "commitChannels\x0a\x09^{ \x0a\x09\x09[ :pkg | Exporter default amdRecipe -> (pkg commitPathJs, '/', pkg name, '.js') ].\x0a\x09\x09[ :pkg | StrippedExporter default amdRecipe -> (pkg commitPathJs, '/', pkg name, '.deploy.js') ].\x0a\x09\x09[ :pkg | ChunkExporter default recipe -> (pkg commitPathSt, '/', pkg name, '.st') ]\x0a\x09}",
  1340. messageSends: ["->", ",", "name", "commitPathJs", "amdRecipe", "default", "commitPathSt", "recipe"],
  1341. referencedClasses: ["Exporter", "StrippedExporter", "ChunkExporter"]
  1342. }),
  1343. smalltalk.AmdPackageHandler);
  1344. smalltalk.addMethod(
  1345. smalltalk.method({
  1346. selector: "commitPathJsFor:",
  1347. category: 'committing',
  1348. fn: function (aPackage){
  1349. var self=this;
  1350. return smalltalk.withContext(function($ctx1) {
  1351. var $1;
  1352. $1=self._toUrl_(self._namespaceFor_(aPackage));
  1353. return $1;
  1354. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  1355. args: ["aPackage"],
  1356. source: "commitPathJsFor: aPackage\x0a\x09^self toUrl: (self namespaceFor: aPackage)",
  1357. messageSends: ["toUrl:", "namespaceFor:"],
  1358. referencedClasses: []
  1359. }),
  1360. smalltalk.AmdPackageHandler);
  1361. smalltalk.addMethod(
  1362. smalltalk.method({
  1363. selector: "commitPathStFor:",
  1364. category: 'committing',
  1365. fn: function (aPackage){
  1366. var self=this;
  1367. return smalltalk.withContext(function($ctx1) {
  1368. var $1;
  1369. $1=self._toUrl_(_st(self._namespaceFor_(aPackage)).__comma("/_source"));
  1370. return $1;
  1371. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  1372. args: ["aPackage"],
  1373. source: "commitPathStFor: aPackage\x0a\x09\x22if _source is not mapped, .st commit will likely fail\x22\x0a\x09^self toUrl: (self namespaceFor: aPackage), '/_source'.",
  1374. messageSends: ["toUrl:", ",", "namespaceFor:"],
  1375. referencedClasses: []
  1376. }),
  1377. smalltalk.AmdPackageHandler);
  1378. smalltalk.addMethod(
  1379. smalltalk.method({
  1380. selector: "namespaceFor:",
  1381. category: 'committing',
  1382. fn: function (aPackage){
  1383. var self=this;
  1384. return smalltalk.withContext(function($ctx1) {
  1385. var $2,$3,$4,$1;
  1386. $2=_st(aPackage)._amdNamespace();
  1387. if(($receiver = $2) == nil || $receiver == undefined){
  1388. $3=aPackage;
  1389. _st($3)._amdNamespace_(_st(self._class())._defaultNamespace());
  1390. $4=_st($3)._amdNamespace();
  1391. $1=$4;
  1392. } else {
  1393. $1=$2;
  1394. };
  1395. return $1;
  1396. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  1397. args: ["aPackage"],
  1398. source: "namespaceFor: aPackage\x0a\x09^aPackage amdNamespace\x0a\x09\x09ifNil: [ aPackage amdNamespace: self class defaultNamespace; amdNamespace ]",
  1399. messageSends: ["ifNil:", "amdNamespace:", "defaultNamespace", "class", "amdNamespace"],
  1400. referencedClasses: []
  1401. }),
  1402. smalltalk.AmdPackageHandler);
  1403. smalltalk.addMethod(
  1404. smalltalk.method({
  1405. selector: "toUrl:",
  1406. category: 'private',
  1407. fn: function (aString){
  1408. var self=this;
  1409. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1410. return smalltalk.withContext(function($ctx1) {
  1411. var $1,$2;
  1412. $1=_st(_st($Smalltalk())._current())._at_("_amd_require");
  1413. if(($receiver = $1) == nil || $receiver == undefined){
  1414. self._error_("AMD loader not present");
  1415. } else {
  1416. var require;
  1417. require=$receiver;
  1418. $2=_st(_st(require)._basicAt_("toUrl"))._value_(aString);
  1419. return $2;
  1420. };
  1421. return self}, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},smalltalk.AmdPackageHandler)})},
  1422. args: ["aString"],
  1423. source: "toUrl: aString\x0a\x09(Smalltalk current at: '_amd_require')\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | ^(require basicAt: 'toUrl') value: aString ]",
  1424. messageSends: ["ifNil:ifNotNil:", "error:", "value:", "basicAt:", "at:", "current"],
  1425. referencedClasses: ["Smalltalk"]
  1426. }),
  1427. smalltalk.AmdPackageHandler);
  1428. smalltalk.AmdPackageHandler.klass.iVarNames = ['defaultNamespace'];
  1429. smalltalk.addMethod(
  1430. smalltalk.method({
  1431. selector: "commitPathsFromLoader",
  1432. category: 'commit paths',
  1433. fn: function (){
  1434. var self=this;
  1435. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1436. return smalltalk.withContext(function($ctx1) {
  1437. var $1;
  1438. $1=_st(_st($Smalltalk())._current())._at_("_amd_defaultNamespace");
  1439. if(($receiver = $1) == nil || $receiver == undefined){
  1440. $1;
  1441. } else {
  1442. var namespace;
  1443. namespace=$receiver;
  1444. self._defaultNamespace_(namespace);
  1445. };
  1446. return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.AmdPackageHandler.klass)})},
  1447. args: [],
  1448. source: "commitPathsFromLoader\x0a\x09(Smalltalk current at: '_amd_defaultNamespace')\x0a\x09\x09ifNotNil: [ :namespace | self defaultNamespace: namespace ]",
  1449. messageSends: ["ifNotNil:", "defaultNamespace:", "at:", "current"],
  1450. referencedClasses: ["Smalltalk"]
  1451. }),
  1452. smalltalk.AmdPackageHandler.klass);
  1453. smalltalk.addMethod(
  1454. smalltalk.method({
  1455. selector: "defaultNamespace",
  1456. category: 'commit paths',
  1457. fn: function (){
  1458. var self=this;
  1459. return smalltalk.withContext(function($ctx1) {
  1460. var $2,$1;
  1461. $2=self["@defaultNamespace"];
  1462. if(($receiver = $2) == nil || $receiver == undefined){
  1463. $1=self._error_("AMD default namespace not set.");
  1464. } else {
  1465. $1=$2;
  1466. };
  1467. return $1;
  1468. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},smalltalk.AmdPackageHandler.klass)})},
  1469. args: [],
  1470. source: "defaultNamespace\x0a\x09^ defaultNamespace ifNil: [ self error: 'AMD default namespace not set.' ]",
  1471. messageSends: ["ifNil:", "error:"],
  1472. referencedClasses: []
  1473. }),
  1474. smalltalk.AmdPackageHandler.klass);
  1475. smalltalk.addMethod(
  1476. smalltalk.method({
  1477. selector: "defaultNamespace:",
  1478. category: 'commit paths',
  1479. fn: function (aString){
  1480. var self=this;
  1481. return smalltalk.withContext(function($ctx1) {
  1482. self["@defaultNamespace"]=aString;
  1483. return self}, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},smalltalk.AmdPackageHandler.klass)})},
  1484. args: ["aString"],
  1485. source: "defaultNamespace: aString\x0a\x09defaultNamespace := aString",
  1486. messageSends: [],
  1487. referencedClasses: []
  1488. }),
  1489. smalltalk.AmdPackageHandler.klass);
  1490. smalltalk.addMethod(
  1491. smalltalk.method({
  1492. selector: "initialize",
  1493. category: 'initialization',
  1494. fn: function (){
  1495. var self=this;
  1496. return smalltalk.withContext(function($ctx1) {
  1497. smalltalk.AmdPackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  1498. self._registerFor_("amd");
  1499. self._commitPathsFromLoader();
  1500. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.AmdPackageHandler.klass)})},
  1501. args: [],
  1502. source: "initialize\x0a\x09super initialize.\x0a\x09self registerFor: 'amd'.\x0a\x09self commitPathsFromLoader",
  1503. messageSends: ["initialize", "registerFor:", "commitPathsFromLoader"],
  1504. referencedClasses: []
  1505. }),
  1506. smalltalk.AmdPackageHandler.klass);
  1507. smalltalk.addMethod(
  1508. smalltalk.method({
  1509. selector: "resetCommitPaths",
  1510. category: 'commit paths',
  1511. fn: function (){
  1512. var self=this;
  1513. return smalltalk.withContext(function($ctx1) {
  1514. self["@defaultNamespace"]=nil;
  1515. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.AmdPackageHandler.klass)})},
  1516. args: [],
  1517. source: "resetCommitPaths\x0a\x09defaultNamespace := nil",
  1518. messageSends: [],
  1519. referencedClasses: []
  1520. }),
  1521. smalltalk.AmdPackageHandler.klass);
  1522. smalltalk.addClass('LegacyPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
  1523. smalltalk.LegacyPackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  1524. smalltalk.addMethod(
  1525. smalltalk.method({
  1526. selector: "commitChannels",
  1527. category: 'committing',
  1528. fn: function (){
  1529. var self=this;
  1530. function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  1531. function $StrippedExporter(){return smalltalk.StrippedExporter||(typeof StrippedExporter=="undefined"?nil:StrippedExporter)}
  1532. function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  1533. return smalltalk.withContext(function($ctx1) {
  1534. var $1;
  1535. $1=[(function(pkg){
  1536. return smalltalk.withContext(function($ctx2) {
  1537. return _st(_st(_st($Exporter())._default())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".js"));
  1538. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  1539. return smalltalk.withContext(function($ctx2) {
  1540. return _st(_st(_st($StrippedExporter())._default())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".deploy.js"));
  1541. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  1542. return smalltalk.withContext(function($ctx2) {
  1543. return _st(_st(_st($ChunkExporter())._default())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathSt()).__comma("/")).__comma(_st(pkg)._name())).__comma(".st"));
  1544. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})})];
  1545. return $1;
  1546. }, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.LegacyPackageHandler)})},
  1547. args: [],
  1548. source: "commitChannels\x0a\x09^{ \x0a\x09\x09[ :pkg | Exporter default recipe -> (pkg commitPathJs, '/', pkg name, '.js') ].\x0a\x09\x09[ :pkg | StrippedExporter default recipe -> (pkg commitPathJs, '/', pkg name, '.deploy.js') ].\x0a\x09\x09[ :pkg | ChunkExporter default recipe -> (pkg commitPathSt, '/', pkg name, '.st') ]\x0a\x09}",
  1549. messageSends: ["->", ",", "name", "commitPathJs", "recipe", "default", "commitPathSt"],
  1550. referencedClasses: ["Exporter", "StrippedExporter", "ChunkExporter"]
  1551. }),
  1552. smalltalk.LegacyPackageHandler);
  1553. smalltalk.addMethod(
  1554. smalltalk.method({
  1555. selector: "commitPathJsFor:",
  1556. category: 'committing',
  1557. fn: function (aPackage){
  1558. var self=this;
  1559. return smalltalk.withContext(function($ctx1) {
  1560. var $1;
  1561. $1=_st(self._class())._defaultCommitPathJs();
  1562. return $1;
  1563. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
  1564. args: ["aPackage"],
  1565. source: "commitPathJsFor: aPackage\x0a\x09^self class defaultCommitPathJs",
  1566. messageSends: ["defaultCommitPathJs", "class"],
  1567. referencedClasses: []
  1568. }),
  1569. smalltalk.LegacyPackageHandler);
  1570. smalltalk.addMethod(
  1571. smalltalk.method({
  1572. selector: "commitPathStFor:",
  1573. category: 'committing',
  1574. fn: function (aPackage){
  1575. var self=this;
  1576. return smalltalk.withContext(function($ctx1) {
  1577. var $1;
  1578. $1=_st(self._class())._defaultCommitPathSt();
  1579. return $1;
  1580. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
  1581. args: ["aPackage"],
  1582. source: "commitPathStFor: aPackage\x0a\x09^self class defaultCommitPathSt",
  1583. messageSends: ["defaultCommitPathSt", "class"],
  1584. referencedClasses: []
  1585. }),
  1586. smalltalk.LegacyPackageHandler);
  1587. smalltalk.addMethod(
  1588. smalltalk.method({
  1589. selector: "loadPackage:prefix:",
  1590. category: 'loading',
  1591. fn: function (packageName,aString){
  1592. var self=this;
  1593. var url;
  1594. return smalltalk.withContext(function($ctx1) {
  1595. var $1;
  1596. url=_st(_st(_st("/".__comma(aString)).__comma("/js/")).__comma(packageName)).__comma(".js");
  1597. self._ajax_(smalltalk.HashedCollection._from_(["url".__minus_gt(url),"type".__minus_gt("GET"),"dataType".__minus_gt("script"),"complete".__minus_gt((function(jqXHR,textStatus){
  1598. return smalltalk.withContext(function($ctx2) {
  1599. $1=_st(_st(jqXHR)._readyState()).__eq((4));
  1600. if(smalltalk.assert($1)){
  1601. return self._setupPackageNamed_prefix_(packageName,aString);
  1602. };
  1603. }, function($ctx2) {$ctx2.fillBlock({jqXHR:jqXHR,textStatus:textStatus},$ctx1)})})),"error".__minus_gt((function(){
  1604. return smalltalk.withContext(function($ctx2) {
  1605. return self._alert_("Could not load package at: ".__comma(url));
  1606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))]));
  1607. return self}, function($ctx1) {$ctx1.fill(self,"loadPackage:prefix:",{packageName:packageName,aString:aString,url:url},smalltalk.LegacyPackageHandler)})},
  1608. args: ["packageName", "aString"],
  1609. source: "loadPackage: packageName prefix: aString\x0a\x09| url |\x0a\x09url := '/', aString, '/js/', packageName, '.js'.\x0a\x09self\x0a\x09\x09ajax: #{\x0a\x09\x09\x09'url' -> url.\x0a\x09\x09\x09'type' -> 'GET'.\x0a\x09\x09\x09'dataType' -> 'script'.\x0a\x09\x09\x09'complete' -> [ :jqXHR :textStatus |\x0a\x09\x09\x09\x09jqXHR readyState = 4\x0a\x09\x09\x09\x09\x09ifTrue: [ self setupPackageNamed: packageName prefix: aString ] ].\x0a\x09\x09\x09'error' -> [ self alert: 'Could not load package at: ', url ]\x0a\x09\x09}",
  1610. messageSends: [",", "ajax:", "->", "ifTrue:", "setupPackageNamed:prefix:", "=", "readyState", "alert:"],
  1611. referencedClasses: []
  1612. }),
  1613. smalltalk.LegacyPackageHandler);
  1614. smalltalk.addMethod(
  1615. smalltalk.method({
  1616. selector: "loadPackages:prefix:",
  1617. category: 'loading',
  1618. fn: function (aCollection,aString){
  1619. var self=this;
  1620. return smalltalk.withContext(function($ctx1) {
  1621. _st(aCollection)._do_((function(each){
  1622. return smalltalk.withContext(function($ctx2) {
  1623. return self._loadPackage_prefix_(each,aString);
  1624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1625. return self}, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler)})},
  1626. args: ["aCollection", "aString"],
  1627. source: "loadPackages: aCollection prefix: aString\x0a\x09aCollection do: [ :each |\x0a\x09\x09self loadPackage: each prefix: aString ]",
  1628. messageSends: ["do:", "loadPackage:prefix:"],
  1629. referencedClasses: []
  1630. }),
  1631. smalltalk.LegacyPackageHandler);
  1632. smalltalk.addMethod(
  1633. smalltalk.method({
  1634. selector: "setupPackageNamed:prefix:",
  1635. category: 'private',
  1636. fn: function (packageName,aString){
  1637. var self=this;
  1638. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  1639. return smalltalk.withContext(function($ctx1) {
  1640. var $1,$2;
  1641. $1=_st($Package())._named_(packageName);
  1642. _st($1)._setupClasses();
  1643. _st($1)._commitPathJs_(_st("/".__comma(aString)).__comma("/js"));
  1644. $2=_st($1)._commitPathSt_(_st("/".__comma(aString)).__comma("/st"));
  1645. return self}, function($ctx1) {$ctx1.fill(self,"setupPackageNamed:prefix:",{packageName:packageName,aString:aString},smalltalk.LegacyPackageHandler)})},
  1646. args: ["packageName", "aString"],
  1647. source: "setupPackageNamed: packageName prefix: aString\x0a\x0a\x09(Package named: packageName)\x0a\x09\x09setupClasses;\x0a\x09\x09commitPathJs: '/', aString, '/js';\x0a\x09\x09commitPathSt: '/', aString, '/st'",
  1648. messageSends: ["setupClasses", "named:", "commitPathJs:", ",", "commitPathSt:"],
  1649. referencedClasses: ["Package"]
  1650. }),
  1651. smalltalk.LegacyPackageHandler);
  1652. smalltalk.LegacyPackageHandler.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  1653. smalltalk.addMethod(
  1654. smalltalk.method({
  1655. selector: "commitPathsFromLoader",
  1656. category: 'commit paths',
  1657. fn: function (){
  1658. var self=this;
  1659. return smalltalk.withContext(function($ctx1) {
  1660. var commitPath = typeof amber !== 'undefined' && amber.commitPath;
  1661. if (!commitPath) return;
  1662. if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);
  1663. if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);
  1664. ;
  1665. return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.LegacyPackageHandler.klass)})},
  1666. args: [],
  1667. source: "commitPathsFromLoader\x0a\x09<\x0a\x09\x09var commitPath = typeof amber !== 'undefined' && amber.commitPath;\x0a\x09\x09if (!commitPath) return;\x0a\x09\x09if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);\x0a\x09\x09if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);\x0a\x09>",
  1668. messageSends: [],
  1669. referencedClasses: []
  1670. }),
  1671. smalltalk.LegacyPackageHandler.klass);
  1672. smalltalk.addMethod(
  1673. smalltalk.method({
  1674. selector: "defaultCommitPathJs",
  1675. category: 'commit paths',
  1676. fn: function (){
  1677. var self=this;
  1678. return smalltalk.withContext(function($ctx1) {
  1679. var $2,$1;
  1680. $2=self["@defaultCommitPathJs"];
  1681. if(($receiver = $2) == nil || $receiver == undefined){
  1682. self["@defaultCommitPathJs"]="js";
  1683. $1=self["@defaultCommitPathJs"];
  1684. } else {
  1685. $1=$2;
  1686. };
  1687. return $1;
  1688. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs",{},smalltalk.LegacyPackageHandler.klass)})},
  1689. args: [],
  1690. source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']",
  1691. messageSends: ["ifNil:"],
  1692. referencedClasses: []
  1693. }),
  1694. smalltalk.LegacyPackageHandler.klass);
  1695. smalltalk.addMethod(
  1696. smalltalk.method({
  1697. selector: "defaultCommitPathJs:",
  1698. category: 'commit paths',
  1699. fn: function (aString){
  1700. var self=this;
  1701. return smalltalk.withContext(function($ctx1) {
  1702. self["@defaultCommitPathJs"]=aString;
  1703. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1704. args: ["aString"],
  1705. source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString",
  1706. messageSends: [],
  1707. referencedClasses: []
  1708. }),
  1709. smalltalk.LegacyPackageHandler.klass);
  1710. smalltalk.addMethod(
  1711. smalltalk.method({
  1712. selector: "defaultCommitPathSt",
  1713. category: 'commit paths',
  1714. fn: function (){
  1715. var self=this;
  1716. return smalltalk.withContext(function($ctx1) {
  1717. var $2,$1;
  1718. $2=self["@defaultCommitPathSt"];
  1719. if(($receiver = $2) == nil || $receiver == undefined){
  1720. self["@defaultCommitPathSt"]="st";
  1721. $1=self["@defaultCommitPathSt"];
  1722. } else {
  1723. $1=$2;
  1724. };
  1725. return $1;
  1726. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt",{},smalltalk.LegacyPackageHandler.klass)})},
  1727. args: [],
  1728. source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']",
  1729. messageSends: ["ifNil:"],
  1730. referencedClasses: []
  1731. }),
  1732. smalltalk.LegacyPackageHandler.klass);
  1733. smalltalk.addMethod(
  1734. smalltalk.method({
  1735. selector: "defaultCommitPathSt:",
  1736. category: 'commit paths',
  1737. fn: function (aString){
  1738. var self=this;
  1739. return smalltalk.withContext(function($ctx1) {
  1740. self["@defaultCommitPathSt"]=aString;
  1741. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1742. args: ["aString"],
  1743. source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString",
  1744. messageSends: [],
  1745. referencedClasses: []
  1746. }),
  1747. smalltalk.LegacyPackageHandler.klass);
  1748. smalltalk.addMethod(
  1749. smalltalk.method({
  1750. selector: "initialize",
  1751. category: 'initialization',
  1752. fn: function (){
  1753. var self=this;
  1754. return smalltalk.withContext(function($ctx1) {
  1755. smalltalk.LegacyPackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  1756. self._registerFor_("unknown");
  1757. self._commitPathsFromLoader();
  1758. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.LegacyPackageHandler.klass)})},
  1759. args: [],
  1760. source: "initialize\x0a\x09super initialize.\x0a\x09self registerFor: 'unknown'.\x0a\x09self commitPathsFromLoader",
  1761. messageSends: ["initialize", "registerFor:", "commitPathsFromLoader"],
  1762. referencedClasses: []
  1763. }),
  1764. smalltalk.LegacyPackageHandler.klass);
  1765. smalltalk.addMethod(
  1766. smalltalk.method({
  1767. selector: "loadPackages:prefix:",
  1768. category: 'loading',
  1769. fn: function (aCollection,aString){
  1770. var self=this;
  1771. return smalltalk.withContext(function($ctx1) {
  1772. var $1;
  1773. $1=_st(self._new())._loadPackages_prefix_(aCollection,aString);
  1774. return $1;
  1775. }, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1776. args: ["aCollection", "aString"],
  1777. source: "loadPackages: aCollection prefix: aString\x0a\x09^ self new loadPackages: aCollection prefix: aString",
  1778. messageSends: ["loadPackages:prefix:", "new"],
  1779. referencedClasses: []
  1780. }),
  1781. smalltalk.LegacyPackageHandler.klass);
  1782. smalltalk.addMethod(
  1783. smalltalk.method({
  1784. selector: "resetCommitPaths",
  1785. category: 'commit paths',
  1786. fn: function (){
  1787. var self=this;
  1788. return smalltalk.withContext(function($ctx1) {
  1789. self["@defaultCommitPathJs"]=nil;
  1790. self["@defaultCommitPathSt"]=nil;
  1791. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.LegacyPackageHandler.klass)})},
  1792. args: [],
  1793. source: "resetCommitPaths\x0a\x09defaultCommitPathJs := nil.\x0a\x09defaultCommitPathSt := nil",
  1794. messageSends: [],
  1795. referencedClasses: []
  1796. }),
  1797. smalltalk.LegacyPackageHandler.klass);
  1798. smalltalk.addClass('PluggableExporter', smalltalk.Object, ['recipe'], 'Importer-Exporter');
  1799. smalltalk.PluggableExporter.comment="I am an engine for exporting structured data on a Stream.\x0a\x0aMy instances are created using\x0a PluggableExporter newUsing: recipe,\x0awhere recipe is structured description of the exporting algorithm.\x0a\x0aThe actual exporting is done by interpreting the recipe using a `RecipeInterpreter`.\x0a\x0a\x0aI am used to export amber packages, so I have a convenience method\x0a`exportPackage: aPackage on: aStream`\x0awhich exports `aPackage` using the `recipe`\x0a(it is otherwise no special, so it may be renamed to export:on:)";
  1800. smalltalk.addMethod(
  1801. smalltalk.method({
  1802. selector: "exportAllPackages",
  1803. category: 'fileOut',
  1804. fn: function (){
  1805. var self=this;
  1806. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1807. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1808. return smalltalk.withContext(function($ctx1) {
  1809. var $1;
  1810. $1=_st($String())._streamContents_((function(stream){
  1811. return smalltalk.withContext(function($ctx2) {
  1812. return _st(_st(_st($Smalltalk())._current())._packages())._do_((function(pkg){
  1813. return smalltalk.withContext(function($ctx3) {
  1814. return self._exportPackage_on_(pkg,stream);
  1815. }, function($ctx3) {$ctx3.fillBlock({pkg:pkg},$ctx2)})}));
  1816. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  1817. return $1;
  1818. }, function($ctx1) {$ctx1.fill(self,"exportAllPackages",{},smalltalk.PluggableExporter)})},
  1819. args: [],
  1820. source: "exportAllPackages\x0a\x09\x22Export all packages in the system.\x22\x0a\x0a\x09^String streamContents: [:stream |\x0a\x09\x09Smalltalk current packages do: [:pkg |\x0a\x09\x09self exportPackage: pkg on: stream]]",
  1821. messageSends: ["streamContents:", "do:", "exportPackage:on:", "packages", "current"],
  1822. referencedClasses: ["Smalltalk", "String"]
  1823. }),
  1824. smalltalk.PluggableExporter);
  1825. smalltalk.addMethod(
  1826. smalltalk.method({
  1827. selector: "exportPackage:on:",
  1828. category: 'fileOut',
  1829. fn: function (aPackage,aStream){
  1830. var self=this;
  1831. return smalltalk.withContext(function($ctx1) {
  1832. _st(self._interpreter())._interpret_for_on_(self._recipe(),aPackage,aStream);
  1833. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},smalltalk.PluggableExporter)})},
  1834. args: ["aPackage", "aStream"],
  1835. source: "exportPackage: aPackage on: aStream\x0a\x09self interpreter interpret: self recipe for: aPackage on: aStream",
  1836. messageSends: ["interpret:for:on:", "recipe", "interpreter"],
  1837. referencedClasses: []
  1838. }),
  1839. smalltalk.PluggableExporter);
  1840. smalltalk.addMethod(
  1841. smalltalk.method({
  1842. selector: "interpreter",
  1843. category: 'accessing',
  1844. fn: function (){
  1845. var self=this;
  1846. function $ExportRecipeInterpreter(){return smalltalk.ExportRecipeInterpreter||(typeof ExportRecipeInterpreter=="undefined"?nil:ExportRecipeInterpreter)}
  1847. return smalltalk.withContext(function($ctx1) {
  1848. var $1;
  1849. $1=_st($ExportRecipeInterpreter())._new();
  1850. return $1;
  1851. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.PluggableExporter)})},
  1852. args: [],
  1853. source: "interpreter\x0a\x09^ ExportRecipeInterpreter new",
  1854. messageSends: ["new"],
  1855. referencedClasses: ["ExportRecipeInterpreter"]
  1856. }),
  1857. smalltalk.PluggableExporter);
  1858. smalltalk.addMethod(
  1859. smalltalk.method({
  1860. selector: "recipe",
  1861. category: 'accessing',
  1862. fn: function (){
  1863. var self=this;
  1864. return smalltalk.withContext(function($ctx1) {
  1865. var $1;
  1866. $1=self["@recipe"];
  1867. return $1;
  1868. }, function($ctx1) {$ctx1.fill(self,"recipe",{},smalltalk.PluggableExporter)})},
  1869. args: [],
  1870. source: "recipe\x0a\x09^recipe",
  1871. messageSends: [],
  1872. referencedClasses: []
  1873. }),
  1874. smalltalk.PluggableExporter);
  1875. smalltalk.addMethod(
  1876. smalltalk.method({
  1877. selector: "recipe:",
  1878. category: 'accessing',
  1879. fn: function (anArray){
  1880. var self=this;
  1881. return smalltalk.withContext(function($ctx1) {
  1882. self["@recipe"]=anArray;
  1883. return self}, function($ctx1) {$ctx1.fill(self,"recipe:",{anArray:anArray},smalltalk.PluggableExporter)})},
  1884. args: ["anArray"],
  1885. source: "recipe: anArray\x0a\x09recipe := anArray",
  1886. messageSends: [],
  1887. referencedClasses: []
  1888. }),
  1889. smalltalk.PluggableExporter);
  1890. smalltalk.addMethod(
  1891. smalltalk.method({
  1892. selector: "forRecipe:",
  1893. category: 'instance creation',
  1894. fn: function (aRecipe){
  1895. var self=this;
  1896. return smalltalk.withContext(function($ctx1) {
  1897. var $2,$3,$1;
  1898. $2=self._new();
  1899. _st($2)._recipe_(aRecipe);
  1900. $3=_st($2)._yourself();
  1901. $1=$3;
  1902. return $1;
  1903. }, function($ctx1) {$ctx1.fill(self,"forRecipe:",{aRecipe:aRecipe},smalltalk.PluggableExporter.klass)})},
  1904. args: ["aRecipe"],
  1905. source: "forRecipe: aRecipe\x0a\x09^self new recipe: aRecipe; yourself",
  1906. messageSends: ["recipe:", "new", "yourself"],
  1907. referencedClasses: []
  1908. }),
  1909. smalltalk.PluggableExporter.klass);
  1910. smalltalk.addMethod(
  1911. smalltalk.method({
  1912. selector: "ownClassesOfPackage:",
  1913. category: 'convenience',
  1914. fn: function (package_){
  1915. var self=this;
  1916. return smalltalk.withContext(function($ctx1) {
  1917. var $1;
  1918. $1=_st(_st(package_)._sortedClasses())._asSet();
  1919. return $1;
  1920. }, function($ctx1) {$ctx1.fill(self,"ownClassesOfPackage:",{package_:package_},smalltalk.PluggableExporter.klass)})},
  1921. args: ["package"],
  1922. source: "ownClassesOfPackage: package\x0a\x09\x22Export classes in dependency order.\x0a\x09Update (issue #171): Remove duplicates for export\x22\x0a\x09^package sortedClasses asSet",
  1923. messageSends: ["asSet", "sortedClasses"],
  1924. referencedClasses: []
  1925. }),
  1926. smalltalk.PluggableExporter.klass);
  1927. smalltalk.addMethod(
  1928. smalltalk.method({
  1929. selector: "amdNamespace",
  1930. category: '*Importer-Exporter',
  1931. fn: function (){
  1932. var self=this;
  1933. return smalltalk.withContext(function($ctx1) {
  1934. return (self.transport && self.transport.amdNamespace) || nil;
  1935. return self}, function($ctx1) {$ctx1.fill(self,"amdNamespace",{},smalltalk.Package)})},
  1936. args: [],
  1937. source: "amdNamespace\x0a<return (self.transport && self.transport.amdNamespace) || nil>",
  1938. messageSends: [],
  1939. referencedClasses: []
  1940. }),
  1941. smalltalk.Package);
  1942. smalltalk.addMethod(
  1943. smalltalk.method({
  1944. selector: "amdNamespace:",
  1945. category: '*Importer-Exporter',
  1946. fn: function (aString){
  1947. var self=this;
  1948. return smalltalk.withContext(function($ctx1) {
  1949. if (!self.transport) { self.transport = { type: 'amd' }; }
  1950. if (self.transport.type !== 'amd') { throw new Error('Package '+self._name()+' has transport type '+self.transport.type+', not "amd".'); }
  1951. self.transport.amdNamespace = aString;;
  1952. return self}, function($ctx1) {$ctx1.fill(self,"amdNamespace:",{aString:aString},smalltalk.Package)})},
  1953. args: ["aString"],
  1954. source: "amdNamespace: aString\x0a<\x0a\x09if (!self.transport) { self.transport = { type: 'amd' }; }\x0a\x09if (self.transport.type !== 'amd') { throw new Error('Package '+self._name()+' has transport type '+self.transport.type+', not \x22amd\x22.'); }\x0a\x09self.transport.amdNamespace = aString;\x0a>",
  1955. messageSends: [],
  1956. referencedClasses: []
  1957. }),
  1958. smalltalk.Package);
  1959. smalltalk.addMethod(
  1960. smalltalk.method({
  1961. selector: "commit",
  1962. category: '*Importer-Exporter',
  1963. fn: function (){
  1964. var self=this;
  1965. return smalltalk.withContext(function($ctx1) {
  1966. var $1;
  1967. $1=_st(self._transport())._commit_(self);
  1968. return $1;
  1969. }, function($ctx1) {$ctx1.fill(self,"commit",{},smalltalk.Package)})},
  1970. args: [],
  1971. source: "commit\x0a\x09^ self transport commit: self",
  1972. messageSends: ["commit:", "transport"],
  1973. referencedClasses: []
  1974. }),
  1975. smalltalk.Package);
  1976. smalltalk.addMethod(
  1977. smalltalk.method({
  1978. selector: "commitPathJs",
  1979. category: '*Importer-Exporter',
  1980. fn: function (){
  1981. var self=this;
  1982. return smalltalk.withContext(function($ctx1) {
  1983. var $3,$2,$1;
  1984. $3=self["@extension"];
  1985. if(($receiver = $3) == nil || $receiver == undefined){
  1986. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1987. $2=self["@extension"];
  1988. } else {
  1989. $2=$3;
  1990. };
  1991. $1=_st($2)._at_ifAbsent_("commitPathJs",(function(){
  1992. return smalltalk.withContext(function($ctx2) {
  1993. return _st(self._transport())._commitPathJsFor_(self);
  1994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1995. return $1;
  1996. }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
  1997. args: [],
  1998. source: "commitPathJs\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathJs ifAbsent: [self transport commitPathJsFor: self]",
  1999. messageSends: ["at:ifAbsent:", "commitPathJsFor:", "transport", "ifNil:"],
  2000. referencedClasses: []
  2001. }),
  2002. smalltalk.Package);
  2003. smalltalk.addMethod(
  2004. smalltalk.method({
  2005. selector: "commitPathJs:",
  2006. category: '*Importer-Exporter',
  2007. fn: function (aString){
  2008. var self=this;
  2009. return smalltalk.withContext(function($ctx1) {
  2010. var $3,$2,$1;
  2011. $3=self["@extension"];
  2012. if(($receiver = $3) == nil || $receiver == undefined){
  2013. self["@extension"]=smalltalk.HashedCollection._from_([]);
  2014. $2=self["@extension"];
  2015. } else {
  2016. $2=$3;
  2017. };
  2018. $1=_st($2)._at_put_("commitPathJs",aString);
  2019. return $1;
  2020. }, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
  2021. args: ["aString"],
  2022. source: "commitPathJs: aString\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathJs put: aString",
  2023. messageSends: ["at:put:", "ifNil:"],
  2024. referencedClasses: []
  2025. }),
  2026. smalltalk.Package);
  2027. smalltalk.addMethod(
  2028. smalltalk.method({
  2029. selector: "commitPathSt",
  2030. category: '*Importer-Exporter',
  2031. fn: function (){
  2032. var self=this;
  2033. return smalltalk.withContext(function($ctx1) {
  2034. var $3,$2,$1;
  2035. $3=self["@extension"];
  2036. if(($receiver = $3) == nil || $receiver == undefined){
  2037. self["@extension"]=smalltalk.HashedCollection._from_([]);
  2038. $2=self["@extension"];
  2039. } else {
  2040. $2=$3;
  2041. };
  2042. $1=_st($2)._at_ifAbsent_("commitPathSt",(function(){
  2043. return smalltalk.withContext(function($ctx2) {
  2044. return _st(self._transport())._commitPathStFor_(self);
  2045. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2046. return $1;
  2047. }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
  2048. args: [],
  2049. source: "commitPathSt\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathSt ifAbsent: [self transport commitPathStFor: self]",
  2050. messageSends: ["at:ifAbsent:", "commitPathStFor:", "transport", "ifNil:"],
  2051. referencedClasses: []
  2052. }),
  2053. smalltalk.Package);
  2054. smalltalk.addMethod(
  2055. smalltalk.method({
  2056. selector: "commitPathSt:",
  2057. category: '*Importer-Exporter',
  2058. fn: function (aString){
  2059. var self=this;
  2060. return smalltalk.withContext(function($ctx1) {
  2061. var $3,$2,$1;
  2062. $3=self["@extension"];
  2063. if(($receiver = $3) == nil || $receiver == undefined){
  2064. self["@extension"]=smalltalk.HashedCollection._from_([]);
  2065. $2=self["@extension"];
  2066. } else {
  2067. $2=$3;
  2068. };
  2069. $1=_st($2)._at_put_("commitPathSt",aString);
  2070. return $1;
  2071. }, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
  2072. args: ["aString"],
  2073. source: "commitPathSt: aString\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathSt put: aString",
  2074. messageSends: ["at:put:", "ifNil:"],
  2075. referencedClasses: []
  2076. }),
  2077. smalltalk.Package);
  2078. smalltalk.addMethod(
  2079. smalltalk.method({
  2080. selector: "transport",
  2081. category: '*Importer-Exporter',
  2082. fn: function (){
  2083. var self=this;
  2084. function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
  2085. return smalltalk.withContext(function($ctx1) {
  2086. var $1;
  2087. $1=_st($PackageHandler())._for_(self._transportType());
  2088. return $1;
  2089. }, function($ctx1) {$ctx1.fill(self,"transport",{},smalltalk.Package)})},
  2090. args: [],
  2091. source: "transport\x0a\x09^ PackageHandler for: self transportType",
  2092. messageSends: ["for:", "transportType"],
  2093. referencedClasses: ["PackageHandler"]
  2094. }),
  2095. smalltalk.Package);
  2096. smalltalk.addMethod(
  2097. smalltalk.method({
  2098. selector: "transportJson",
  2099. category: '*Importer-Exporter',
  2100. fn: function (){
  2101. var self=this;
  2102. return smalltalk.withContext(function($ctx1) {
  2103. return JSON.stringify(self.transport || null);;
  2104. return self}, function($ctx1) {$ctx1.fill(self,"transportJson",{},smalltalk.Package)})},
  2105. args: [],
  2106. source: "transportJson\x0a\x09<return JSON.stringify(self.transport || null);>",
  2107. messageSends: [],
  2108. referencedClasses: []
  2109. }),
  2110. smalltalk.Package);
  2111. smalltalk.addMethod(
  2112. smalltalk.method({
  2113. selector: "transportType",
  2114. category: '*Importer-Exporter',
  2115. fn: function (){
  2116. var self=this;
  2117. return smalltalk.withContext(function($ctx1) {
  2118. return (self.transport && self.transport.type) || 'unknown';;
  2119. return self}, function($ctx1) {$ctx1.fill(self,"transportType",{},smalltalk.Package)})},
  2120. args: [],
  2121. source: "transportType\x0a\x09<return (self.transport && self.transport.type) || 'unknown';>",
  2122. messageSends: [],
  2123. referencedClasses: []
  2124. }),
  2125. smalltalk.Package);
  2126. });