Importer-Exporter.deploy.js 78 KB

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