Importer-Exporter.js 121 KB

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