Importer-Exporter.deploy.js 92 KB

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