Importer-Exporter.deploy.js 92 KB

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