Importer-Exporter.js 117 KB

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