1
0

Importer-Exporter.deploy.js 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552
  1. define("amber/Importer-Exporter", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Importer-Exporter');
  3. smalltalk.addClass('AmdExporter', smalltalk.Object, [], 'Importer-Exporter');
  4. smalltalk.addMethod(
  5. smalltalk.method({
  6. selector: "exportPackageEpilogueOf:on:",
  7. fn: function (aPackage,aStream){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) {
  10. var $1,$2;
  11. $1=aStream;
  12. _st($1)._nextPutAll_("});");
  13. $2=_st($1)._lf();
  14. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter.klass)})},
  15. messageSends: ["nextPutAll:", "lf"]}),
  16. smalltalk.AmdExporter.klass);
  17. smalltalk.addMethod(
  18. smalltalk.method({
  19. selector: "exportPackagePrologueOf:on:",
  20. fn: function (aPackage,aStream){
  21. var self=this;
  22. return smalltalk.withContext(function($ctx1) {
  23. var $1,$2,$4,$3,$5;
  24. $1=aStream;
  25. _st($1)._nextPutAll_("define(\x22");
  26. $2=$1;
  27. $4=_st(aPackage)._amdNamespace();
  28. if(($receiver = $4) == nil || $receiver == undefined){
  29. $3="amber";
  30. } else {
  31. $3=$4;
  32. };
  33. _st($2)._nextPutAll_($3);
  34. _st($1)._nextPutAll_("/");
  35. _st($1)._nextPutAll_(_st(aPackage)._name());
  36. _st($1)._nextPutAll_("\x22, [\x22amber_vm/smalltalk\x22,\x22amber_vm/nil\x22,\x22amber_vm/_st\x22], function(smalltalk,nil,_st){");
  37. $5=_st($1)._lf();
  38. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter.klass)})},
  39. messageSends: ["nextPutAll:", "ifNil:", "amdNamespace", "name", "lf"]}),
  40. smalltalk.AmdExporter.klass);
  41. smalltalk.addMethod(
  42. smalltalk.method({
  43. selector: "exportPackageTransportOf:on:",
  44. fn: function (aPackage,aStream){
  45. var self=this;
  46. return smalltalk.withContext(function($ctx1) {
  47. var $1,$2;
  48. $1=aStream;
  49. _st($1)._nextPutAll_("smalltalk.packages[");
  50. _st($1)._nextPutAll_(_st(_st(aPackage)._name())._asJavascript());
  51. _st($1)._nextPutAll_("].transport = ");
  52. _st($1)._nextPutAll_(_st(aPackage)._transportJson());
  53. _st($1)._nextPutAll_(";");
  54. $2=_st($1)._lf();
  55. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter.klass)})},
  56. messageSends: ["nextPutAll:", "asJavascript", "name", "transportJson", "lf"]}),
  57. smalltalk.AmdExporter.klass);
  58. smalltalk.addClass('ChunkExporter', smalltalk.Object, [], 'Importer-Exporter');
  59. smalltalk.addMethod(
  60. smalltalk.method({
  61. selector: "chunkEscape:",
  62. fn: function (aString){
  63. var self=this;
  64. return smalltalk.withContext(function($ctx1) {
  65. var $1;
  66. $1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
  67. return $1;
  68. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},smalltalk.ChunkExporter.klass)})},
  69. messageSends: ["trimBoth", "replace:with:"]}),
  70. smalltalk.ChunkExporter.klass);
  71. smalltalk.addMethod(
  72. smalltalk.method({
  73. selector: "classNameFor:",
  74. fn: function (aClass){
  75. var self=this;
  76. return smalltalk.withContext(function($ctx1) {
  77. var $2,$3,$1;
  78. $2=_st(aClass)._isMetaclass();
  79. if(smalltalk.assert($2)){
  80. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(" class");
  81. } else {
  82. $3=_st(aClass)._isNil();
  83. if(smalltalk.assert($3)){
  84. $1="nil";
  85. } else {
  86. $1=_st(aClass)._name();
  87. };
  88. };
  89. return $1;
  90. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.ChunkExporter.klass)})},
  91. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"]}),
  92. smalltalk.ChunkExporter.klass);
  93. smalltalk.addMethod(
  94. smalltalk.method({
  95. selector: "exportCategoryEpilogueOf:on:",
  96. fn: function (category,aStream){
  97. var self=this;
  98. return smalltalk.withContext(function($ctx1) {
  99. var $1,$2;
  100. $1=aStream;
  101. _st($1)._nextPutAll_(" !");
  102. _st($1)._lf();
  103. $2=_st($1)._lf();
  104. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{category:category,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  105. messageSends: ["nextPutAll:", "lf"]}),
  106. smalltalk.ChunkExporter.klass);
  107. smalltalk.addMethod(
  108. smalltalk.method({
  109. selector: "exportCategoryPrologueOf:on:",
  110. fn: function (category,aStream){
  111. var self=this;
  112. return smalltalk.withContext(function($ctx1) {
  113. var $1,$2;
  114. $1=aStream;
  115. _st($1)._nextPutAll_("!".__comma(self._classNameFor_(_st(category)._at_("class"))));
  116. $2=_st($1)._nextPutAll_(_st(" methodsFor: '".__comma(_st(category)._at_("name"))).__comma("'!"));
  117. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{category:category,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  118. messageSends: ["nextPutAll:", ",", "classNameFor:", "at:"]}),
  119. smalltalk.ChunkExporter.klass);
  120. smalltalk.addMethod(
  121. smalltalk.method({
  122. selector: "exportDefinitionOf:on:",
  123. fn: function (aClass,aStream){
  124. var self=this;
  125. return smalltalk.withContext(function($ctx1) {
  126. var $1,$2,$3,$4,$5,$6,$7;
  127. $1=aStream;
  128. _st($1)._nextPutAll_(self._classNameFor_(_st(aClass)._superclass()));
  129. _st($1)._nextPutAll_(" subclass: #".__comma(self._classNameFor_(aClass)));
  130. _st($1)._lf();
  131. _st($1)._tab();
  132. $2=_st($1)._nextPutAll_("instanceVariableNames: '");
  133. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  134. return smalltalk.withContext(function($ctx2) {
  135. return _st(aStream)._nextPutAll_(each);
  136. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  137. return smalltalk.withContext(function($ctx2) {
  138. return _st(aStream)._nextPutAll_(" ");
  139. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  140. $3=aStream;
  141. _st($3)._nextPutAll_("'");
  142. _st($3)._lf();
  143. _st($3)._tab();
  144. _st($3)._nextPutAll_(_st("package: '".__comma(_st(aClass)._category())).__comma("'!"));
  145. $4=_st($3)._lf();
  146. $5=_st(_st(aClass)._comment())._notEmpty();
  147. if(smalltalk.assert($5)){
  148. $6=aStream;
  149. _st($6)._nextPutAll_(_st("!".__comma(self._classNameFor_(aClass))).__comma(" commentStamp!"));
  150. _st($6)._lf();
  151. _st($6)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
  152. $7=_st($6)._lf();
  153. $7;
  154. };
  155. _st(aStream)._lf();
  156. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  157. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "chunkEscape:", "comment", "notEmpty"]}),
  158. smalltalk.ChunkExporter.klass);
  159. smalltalk.addMethod(
  160. smalltalk.method({
  161. selector: "exportMetaDefinitionOf:on:",
  162. fn: function (aClass,aStream){
  163. var self=this;
  164. return smalltalk.withContext(function($ctx1) {
  165. var $1,$2,$3,$4,$5;
  166. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  167. if(! smalltalk.assert($1)){
  168. $2=aStream;
  169. _st($2)._nextPutAll_(self._classNameFor_(_st(aClass)._class()));
  170. $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
  171. $3;
  172. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  173. return smalltalk.withContext(function($ctx2) {
  174. return _st(aStream)._nextPutAll_(each);
  175. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  176. return smalltalk.withContext(function($ctx2) {
  177. return _st(aStream)._nextPutAll_(" ");
  178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  179. $4=aStream;
  180. _st($4)._nextPutAll_("'!");
  181. _st($4)._lf();
  182. $5=_st($4)._lf();
  183. $5;
  184. };
  185. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  186. messageSends: ["ifFalse:", "nextPutAll:", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"]}),
  187. smalltalk.ChunkExporter.klass);
  188. smalltalk.addMethod(
  189. smalltalk.method({
  190. selector: "exportMethod:on:",
  191. fn: function (aMethod,aStream){
  192. var self=this;
  193. return smalltalk.withContext(function($ctx1) {
  194. var $1,$2;
  195. $1=aStream;
  196. _st($1)._lf();
  197. _st($1)._lf();
  198. _st($1)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
  199. _st($1)._lf();
  200. $2=_st($1)._nextPutAll_("!");
  201. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  202. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]}),
  203. smalltalk.ChunkExporter.klass);
  204. smalltalk.addMethod(
  205. smalltalk.method({
  206. selector: "exportPackageDefinitionOf:on:",
  207. fn: function (package_,aStream){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. var $1,$2;
  211. $1=aStream;
  212. _st($1)._nextPutAll_(_st("Smalltalk current createPackage: '".__comma(_st(package_)._name())).__comma("'!"));
  213. $2=_st($1)._lf();
  214. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{package_:package_,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  215. messageSends: ["nextPutAll:", ",", "name", "lf"]}),
  216. smalltalk.ChunkExporter.klass);
  217. smalltalk.addMethod(
  218. smalltalk.method({
  219. selector: "extensionCategoriesOfPackage:",
  220. fn: function (package_){
  221. var self=this;
  222. var name,map,result;
  223. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  224. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  225. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  226. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  227. return smalltalk.withContext(function($ctx1) {
  228. var $1,$2;
  229. name=_st(package_)._name();
  230. result=_st($OrderedCollection())._new();
  231. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  232. return smalltalk.withContext(function($ctx2) {
  233. return _st([each,_st(each)._class()])._do_((function(aClass){
  234. return smalltalk.withContext(function($ctx3) {
  235. map=_st($Dictionary())._new();
  236. map;
  237. _st(aClass)._protocolsDo_((function(category,methods){
  238. return smalltalk.withContext(function($ctx4) {
  239. $1=_st(category)._match_("^\x5c*".__comma(name));
  240. if(smalltalk.assert($1)){
  241. return _st(map)._at_put_(category,methods);
  242. };
  243. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3)})}));
  244. return _st(result)._addAll_(_st(_st(_st(map)._keys())._sorted_((function(a,b){
  245. return smalltalk.withContext(function($ctx4) {
  246. return _st(a).__lt_eq(b);
  247. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._collect_((function(category){
  248. return smalltalk.withContext(function($ctx4) {
  249. return smalltalk.HashedCollection._from_(["methods".__minus_gt(_st(map)._at_(category)),"name".__minus_gt(category),"class".__minus_gt(aClass)]);
  250. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3)})})));
  251. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  252. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  253. $2=result;
  254. return $2;
  255. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{package_:package_,name:name,map:map,result:result},smalltalk.ChunkExporter.klass)})},
  256. messageSends: ["name", "new", "do:", "protocolsDo:", "ifTrue:", "at:put:", "match:", ",", "addAll:", "collect:", "->", "at:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"]}),
  257. smalltalk.ChunkExporter.klass);
  258. smalltalk.addMethod(
  259. smalltalk.method({
  260. selector: "methodsOfCategory:",
  261. fn: function (category){
  262. var self=this;
  263. return smalltalk.withContext(function($ctx1) {
  264. var $1;
  265. $1=_st(_st(category)._at_("methods"))._sorted_((function(a,b){
  266. return smalltalk.withContext(function($ctx2) {
  267. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  268. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}));
  269. return $1;
  270. }, function($ctx1) {$ctx1.fill(self,"methodsOfCategory:",{category:category},smalltalk.ChunkExporter.klass)})},
  271. messageSends: ["sorted:", "<=", "selector", "at:"]}),
  272. smalltalk.ChunkExporter.klass);
  273. smalltalk.addMethod(
  274. smalltalk.method({
  275. selector: "ownCategoriesOfClass:",
  276. fn: function (aClass){
  277. var self=this;
  278. var map;
  279. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  280. return smalltalk.withContext(function($ctx1) {
  281. var $1,$2;
  282. map=_st($Dictionary())._new();
  283. _st(aClass)._protocolsDo_((function(category,methods){
  284. return smalltalk.withContext(function($ctx2) {
  285. $1=_st(category)._match_("^\x5c*");
  286. if(! smalltalk.assert($1)){
  287. return _st(map)._at_put_(category,methods);
  288. };
  289. }, function($ctx2) {$ctx2.fillBlock({category:category,methods:methods},$ctx1)})}));
  290. $2=_st(_st(_st(map)._keys())._sorted_((function(a,b){
  291. return smalltalk.withContext(function($ctx2) {
  292. return _st(a).__lt_eq(b);
  293. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._collect_((function(category){
  294. return smalltalk.withContext(function($ctx2) {
  295. return smalltalk.HashedCollection._from_(["methods".__minus_gt(_st(map)._at_(category)),"name".__minus_gt(category),"class".__minus_gt(aClass)]);
  296. }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1)})}));
  297. return $2;
  298. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},smalltalk.ChunkExporter.klass)})},
  299. messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "collect:", "->", "at:", "sorted:", "<=", "keys"]}),
  300. smalltalk.ChunkExporter.klass);
  301. smalltalk.addMethod(
  302. smalltalk.method({
  303. selector: "ownCategoriesOfMetaClass:",
  304. fn: function (aClass){
  305. var self=this;
  306. return smalltalk.withContext(function($ctx1) {
  307. var $1;
  308. $1=self._ownCategoriesOfClass_(_st(aClass)._class());
  309. return $1;
  310. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},smalltalk.ChunkExporter.klass)})},
  311. messageSends: ["ownCategoriesOfClass:", "class"]}),
  312. smalltalk.ChunkExporter.klass);
  313. smalltalk.addMethod(
  314. smalltalk.method({
  315. selector: "recipe",
  316. fn: function (){
  317. var self=this;
  318. var exportCategoryRecipe;
  319. function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
  320. return smalltalk.withContext(function($ctx1) {
  321. var $1;
  322. exportCategoryRecipe=[self.__minus_gt("exportCategoryPrologueOf:on:"),[self.__minus_gt("methodsOfCategory:"),self.__minus_gt("exportMethod:on:")],self.__minus_gt("exportCategoryEpilogueOf:on:")];
  323. $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)];
  324. return $1;
  325. }, function($ctx1) {$ctx1.fill(self,"recipe",{exportCategoryRecipe:exportCategoryRecipe},smalltalk.ChunkExporter.klass)})},
  326. messageSends: ["->", ","]}),
  327. smalltalk.ChunkExporter.klass);
  328. smalltalk.addClass('ChunkParser', smalltalk.Object, ['stream'], 'Importer-Exporter');
  329. smalltalk.addMethod(
  330. smalltalk.method({
  331. selector: "nextChunk",
  332. fn: function (){
  333. var self=this;
  334. var char,result,chunk;
  335. return smalltalk.withContext(function($ctx1) {
  336. var $1,$2,$3;
  337. var $early={};
  338. try {
  339. result=""._writeStream();
  340. _st((function(){
  341. return smalltalk.withContext(function($ctx2) {
  342. char=_st(self["@stream"])._next();
  343. char;
  344. return _st(char)._notNil();
  345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  346. return smalltalk.withContext(function($ctx2) {
  347. $1=_st(char).__eq("!");
  348. if(smalltalk.assert($1)){
  349. $2=_st(_st(self["@stream"])._peek()).__eq("!");
  350. if(smalltalk.assert($2)){
  351. _st(self["@stream"])._next();
  352. } else {
  353. $3=_st(_st(result)._contents())._trimBoth();
  354. throw $early=[$3];
  355. };
  356. };
  357. return _st(result)._nextPut_(char);
  358. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  359. return nil;
  360. }
  361. catch(e) {if(e===$early)return e[0]; throw e}
  362. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},smalltalk.ChunkParser)})},
  363. messageSends: ["writeStream", "whileTrue:", "ifTrue:", "ifTrue:ifFalse:", "next", "trimBoth", "contents", "=", "peek", "nextPut:", "notNil"]}),
  364. smalltalk.ChunkParser);
  365. smalltalk.addMethod(
  366. smalltalk.method({
  367. selector: "stream:",
  368. fn: function (aStream){
  369. var self=this;
  370. return smalltalk.withContext(function($ctx1) {
  371. self["@stream"]=aStream;
  372. return self}, function($ctx1) {$ctx1.fill(self,"stream:",{aStream:aStream},smalltalk.ChunkParser)})},
  373. messageSends: []}),
  374. smalltalk.ChunkParser);
  375. smalltalk.addMethod(
  376. smalltalk.method({
  377. selector: "on:",
  378. fn: function (aStream){
  379. var self=this;
  380. return smalltalk.withContext(function($ctx1) {
  381. var $1;
  382. $1=_st(self._new())._stream_(aStream);
  383. return $1;
  384. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},smalltalk.ChunkParser.klass)})},
  385. messageSends: ["stream:", "new"]}),
  386. smalltalk.ChunkParser.klass);
  387. smalltalk.addClass('Exporter', smalltalk.Object, [], 'Importer-Exporter');
  388. smalltalk.addMethod(
  389. smalltalk.method({
  390. selector: "amdRecipe",
  391. fn: function (){
  392. var self=this;
  393. var legacy;
  394. function $AmdExporter(){return smalltalk.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  395. return smalltalk.withContext(function($ctx1) {
  396. var $1;
  397. legacy=self._recipe();
  398. $1=_st(_st(_st(legacy)._copyFrom_to_((1),(2))).__comma([_st($AmdExporter()).__minus_gt("exportPackageTransportOf:on:")])).__comma(_st(legacy)._copyFrom_to_((3),_st(legacy)._size()));
  399. return $1;
  400. }, function($ctx1) {$ctx1.fill(self,"amdRecipe",{legacy:legacy},smalltalk.Exporter.klass)})},
  401. messageSends: ["recipe", ",", "copyFrom:to:", "size", "->"]}),
  402. smalltalk.Exporter.klass);
  403. smalltalk.addMethod(
  404. smalltalk.method({
  405. selector: "classNameFor:",
  406. fn: function (aClass){
  407. var self=this;
  408. return smalltalk.withContext(function($ctx1) {
  409. var $2,$3,$1;
  410. $2=_st(aClass)._isMetaclass();
  411. if(smalltalk.assert($2)){
  412. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(".klass");
  413. } else {
  414. $3=_st(aClass)._isNil();
  415. if(smalltalk.assert($3)){
  416. $1="nil";
  417. } else {
  418. $1=_st(aClass)._name();
  419. };
  420. };
  421. return $1;
  422. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.Exporter.klass)})},
  423. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"]}),
  424. smalltalk.Exporter.klass);
  425. smalltalk.addMethod(
  426. smalltalk.method({
  427. selector: "exportDefinitionOf:on:",
  428. fn: function (aClass,aStream){
  429. var self=this;
  430. return smalltalk.withContext(function($ctx1) {
  431. var $1,$2,$3,$4,$5,$6,$7;
  432. $1=aStream;
  433. _st($1)._lf();
  434. _st($1)._nextPutAll_("smalltalk.addClass(");
  435. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  436. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  437. $2=_st($1)._nextPutAll_(", [");
  438. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  439. return smalltalk.withContext(function($ctx2) {
  440. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  441. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  442. return smalltalk.withContext(function($ctx2) {
  443. return _st(aStream)._nextPutAll_(", ");
  444. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  445. $3=aStream;
  446. _st($3)._nextPutAll_("], '");
  447. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  448. $4=_st($3)._nextPutAll_(");");
  449. $5=_st(_st(aClass)._comment())._notEmpty();
  450. if(smalltalk.assert($5)){
  451. $6=aStream;
  452. _st($6)._lf();
  453. _st($6)._nextPutAll_("smalltalk.");
  454. _st($6)._nextPutAll_(self._classNameFor_(aClass));
  455. _st($6)._nextPutAll_(".comment=");
  456. _st($6)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
  457. $7=_st($6)._nextPutAll_(";");
  458. $7;
  459. };
  460. _st(aStream)._lf();
  461. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter.klass)})},
  462. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "asJavascript", "comment", "notEmpty"]}),
  463. smalltalk.Exporter.klass);
  464. smalltalk.addMethod(
  465. smalltalk.method({
  466. selector: "exportMetaDefinitionOf:on:",
  467. fn: function (aClass,aStream){
  468. var self=this;
  469. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  470. return smalltalk.withContext(function($ctx1) {
  471. var $1,$2,$3;
  472. _st(aStream)._lf();
  473. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  474. if(! smalltalk.assert($1)){
  475. $2=aStream;
  476. _st($2)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._class())));
  477. $3=_st($2)._nextPutAll_(".iVarNames = [");
  478. $3;
  479. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  480. return smalltalk.withContext(function($ctx2) {
  481. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  482. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  483. return smalltalk.withContext(function($ctx2) {
  484. return _st(aStream)._nextPutAll_(",");
  485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  486. _st(aStream)._nextPutAll_("];".__comma(_st($String())._lf()));
  487. };
  488. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter.klass)})},
  489. messageSends: ["lf", "ifFalse:", "nextPutAll:", ",", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "isEmpty"]}),
  490. smalltalk.Exporter.klass);
  491. smalltalk.addMethod(
  492. smalltalk.method({
  493. selector: "exportMethod:on:",
  494. fn: function (aMethod,aStream){
  495. var self=this;
  496. return smalltalk.withContext(function($ctx1) {
  497. var $1,$2,$3,$4;
  498. $1=aStream;
  499. _st($1)._nextPutAll_("smalltalk.addMethod(");
  500. _st($1)._lf();
  501. _st($1)._nextPutAll_("smalltalk.method({");
  502. _st($1)._lf();
  503. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  504. _st($1)._lf();
  505. _st($1)._nextPutAll_(_st("category: '".__comma(_st(aMethod)._category())).__comma("',"));
  506. _st($1)._lf();
  507. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  508. _st($1)._lf();
  509. _st($1)._nextPutAll_(_st("args: ".__comma(_st(_st(aMethod)._arguments())._asJavascript())).__comma(","));
  510. _st($1)._lf();
  511. _st($1)._nextPutAll_(_st("source: ".__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
  512. _st($1)._lf();
  513. _st($1)._nextPutAll_(_st("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript())).__comma(","));
  514. _st($1)._lf();
  515. $2=_st($1)._nextPutAll_("referencedClasses: ".__comma(_st(_st(aMethod)._referencedClasses())._asJavascript()));
  516. $3=aStream;
  517. _st($3)._lf();
  518. _st($3)._nextPutAll_("}),");
  519. _st($3)._lf();
  520. _st($3)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
  521. _st($3)._nextPutAll_(");");
  522. _st($3)._lf();
  523. $4=_st($3)._lf();
  524. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.Exporter.klass)})},
  525. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "category", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:", "methodClass"]}),
  526. smalltalk.Exporter.klass);
  527. smalltalk.addMethod(
  528. smalltalk.method({
  529. selector: "exportPackageDefinitionOf:on:",
  530. fn: function (package_,aStream){
  531. var self=this;
  532. return smalltalk.withContext(function($ctx1) {
  533. var $1,$2;
  534. $1=aStream;
  535. _st($1)._nextPutAll_("smalltalk.addPackage(");
  536. _st($1)._nextPutAll_(_st("'".__comma(_st(package_)._name())).__comma("');"));
  537. $2=_st($1)._lf();
  538. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{package_:package_,aStream:aStream},smalltalk.Exporter.klass)})},
  539. messageSends: ["nextPutAll:", ",", "name", "lf"]}),
  540. smalltalk.Exporter.klass);
  541. smalltalk.addMethod(
  542. smalltalk.method({
  543. selector: "exportPackageEpilogueOf:on:",
  544. fn: function (aPackage,aStream){
  545. var self=this;
  546. return smalltalk.withContext(function($ctx1) {
  547. var $1,$2;
  548. $1=aStream;
  549. _st($1)._nextPutAll_("})(global_smalltalk,global_nil,global__st);");
  550. $2=_st($1)._lf();
  551. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter.klass)})},
  552. messageSends: ["nextPutAll:", "lf"]}),
  553. smalltalk.Exporter.klass);
  554. smalltalk.addMethod(
  555. smalltalk.method({
  556. selector: "exportPackagePrologueOf:on:",
  557. fn: function (aPackage,aStream){
  558. var self=this;
  559. return smalltalk.withContext(function($ctx1) {
  560. var $1,$2;
  561. $1=aStream;
  562. _st($1)._nextPutAll_("(function(smalltalk,nil,_st){");
  563. $2=_st($1)._lf();
  564. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter.klass)})},
  565. messageSends: ["nextPutAll:", "lf"]}),
  566. smalltalk.Exporter.klass);
  567. smalltalk.addMethod(
  568. smalltalk.method({
  569. selector: "extensionMethodsOfPackage:",
  570. fn: function (package_){
  571. var self=this;
  572. var name,result;
  573. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  574. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  575. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  576. return smalltalk.withContext(function($ctx1) {
  577. var $1;
  578. name=_st(package_)._name();
  579. result=_st($OrderedCollection())._new();
  580. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  581. return smalltalk.withContext(function($ctx2) {
  582. return _st([each,_st(each)._class()])._do_((function(aClass){
  583. return smalltalk.withContext(function($ctx3) {
  584. return _st(result)._addAll_(_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  585. return smalltalk.withContext(function($ctx4) {
  586. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  587. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._select_((function(method){
  588. return smalltalk.withContext(function($ctx4) {
  589. return _st(_st(method)._category())._match_("^\x5c*".__comma(name));
  590. }, function($ctx4) {$ctx4.fillBlock({method:method},$ctx3)})})));
  591. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  592. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  593. $1=result;
  594. return $1;
  595. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{package_:package_,name:name,result:result},smalltalk.Exporter.klass)})},
  596. messageSends: ["name", "new", "do:", "addAll:", "select:", "match:", ",", "category", "sorted:", "<=", "selector", "values", "methodDictionary", "class", "sortedClasses:", "classes", "current"]}),
  597. smalltalk.Exporter.klass);
  598. smalltalk.addMethod(
  599. smalltalk.method({
  600. selector: "ownMethodsOfClass:",
  601. fn: function (aClass){
  602. var self=this;
  603. return smalltalk.withContext(function($ctx1) {
  604. var $1;
  605. $1=_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  606. return smalltalk.withContext(function($ctx2) {
  607. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  608. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._reject_((function(each){
  609. return smalltalk.withContext(function($ctx2) {
  610. return _st(_st(each)._category())._match_("^\x5c*");
  611. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  612. return $1;
  613. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},smalltalk.Exporter.klass)})},
  614. messageSends: ["reject:", "match:", "category", "sorted:", "<=", "selector", "values", "methodDictionary"]}),
  615. smalltalk.Exporter.klass);
  616. smalltalk.addMethod(
  617. smalltalk.method({
  618. selector: "ownMethodsOfMetaClass:",
  619. fn: function (aClass){
  620. var self=this;
  621. return smalltalk.withContext(function($ctx1) {
  622. var $1;
  623. $1=self._ownMethodsOfClass_(_st(aClass)._class());
  624. return $1;
  625. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},smalltalk.Exporter.klass)})},
  626. messageSends: ["ownMethodsOfClass:", "class"]}),
  627. smalltalk.Exporter.klass);
  628. smalltalk.addMethod(
  629. smalltalk.method({
  630. selector: "recipe",
  631. fn: function (){
  632. var self=this;
  633. function $AmdExporter(){return smalltalk.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  634. function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
  635. return smalltalk.withContext(function($ctx1) {
  636. var $1;
  637. $1=[_st($AmdExporter()).__minus_gt("exportPackagePrologueOf:on:"),self.__minus_gt("exportPackageDefinitionOf:on:"),[_st($PluggableExporter()).__minus_gt("ownClassesOfPackage:"),self.__minus_gt("exportDefinitionOf:on:"),[self.__minus_gt("ownMethodsOfClass:"),self.__minus_gt("exportMethod:on:")],self.__minus_gt("exportMetaDefinitionOf:on:"),[self.__minus_gt("ownMethodsOfMetaClass:"),self.__minus_gt("exportMethod:on:")]],[self.__minus_gt("extensionMethodsOfPackage:"),self.__minus_gt("exportMethod:on:")],_st($AmdExporter()).__minus_gt("exportPackageEpilogueOf:on:")];
  638. return $1;
  639. }, function($ctx1) {$ctx1.fill(self,"recipe",{},smalltalk.Exporter.klass)})},
  640. messageSends: ["->"]}),
  641. smalltalk.Exporter.klass);
  642. smalltalk.addClass('StrippedExporter', smalltalk.Exporter, [], 'Importer-Exporter');
  643. smalltalk.addMethod(
  644. smalltalk.method({
  645. selector: "exportDefinitionOf:on:",
  646. fn: function (aClass,aStream){
  647. var self=this;
  648. return smalltalk.withContext(function($ctx1) {
  649. var $1,$2,$3,$4;
  650. $1=aStream;
  651. _st($1)._lf();
  652. _st($1)._nextPutAll_("smalltalk.addClass(");
  653. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  654. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  655. $2=_st($1)._nextPutAll_(", [");
  656. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  657. return smalltalk.withContext(function($ctx2) {
  658. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  659. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  660. return smalltalk.withContext(function($ctx2) {
  661. return _st(aStream)._nextPutAll_(", ");
  662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  663. $3=aStream;
  664. _st($3)._nextPutAll_("], '");
  665. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  666. $4=_st($3)._nextPutAll_(");");
  667. _st(aStream)._lf();
  668. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.StrippedExporter.klass)})},
  669. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category"]}),
  670. smalltalk.StrippedExporter.klass);
  671. smalltalk.addMethod(
  672. smalltalk.method({
  673. selector: "exportMethod:on:",
  674. fn: function (aMethod,aStream){
  675. var self=this;
  676. return smalltalk.withContext(function($ctx1) {
  677. var $1,$2;
  678. $1=aStream;
  679. _st($1)._nextPutAll_("smalltalk.addMethod(");
  680. _st($1)._lf();
  681. _st($1)._nextPutAll_("smalltalk.method({");
  682. _st($1)._lf();
  683. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  684. _st($1)._lf();
  685. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  686. _st($1)._lf();
  687. _st($1)._nextPutAll_("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript()));
  688. _st($1)._nextPutAll_("}),");
  689. _st($1)._lf();
  690. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
  691. _st($1)._nextPutAll_(");");
  692. _st($1)._lf();
  693. $2=_st($1)._lf();
  694. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.StrippedExporter.klass)})},
  695. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "compiledSource", "fn", "messageSends", "classNameFor:", "methodClass"]}),
  696. smalltalk.StrippedExporter.klass);
  697. smalltalk.addClass('Importer', smalltalk.Object, [], 'Importer-Exporter');
  698. smalltalk.addMethod(
  699. smalltalk.method({
  700. selector: "import:",
  701. fn: function (aStream){
  702. var self=this;
  703. var chunk,result,parser,lastEmpty;
  704. function $ChunkParser(){return smalltalk.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  705. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  706. return smalltalk.withContext(function($ctx1) {
  707. var $1,$2;
  708. parser=_st($ChunkParser())._on_(aStream);
  709. lastEmpty=false;
  710. _st((function(){
  711. return smalltalk.withContext(function($ctx2) {
  712. chunk=_st(parser)._nextChunk();
  713. chunk;
  714. return _st(chunk)._isNil();
  715. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  716. return smalltalk.withContext(function($ctx2) {
  717. $1=_st(chunk)._isEmpty();
  718. if(smalltalk.assert($1)){
  719. lastEmpty=true;
  720. return lastEmpty;
  721. } else {
  722. result=_st(_st($Compiler())._new())._evaluateExpression_(chunk);
  723. result;
  724. $2=lastEmpty;
  725. if(smalltalk.assert($2)){
  726. lastEmpty=false;
  727. lastEmpty;
  728. return _st(result)._scanFrom_(parser);
  729. };
  730. };
  731. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  732. return self}, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},smalltalk.Importer)})},
  733. messageSends: ["on:", "whileFalse:", "ifTrue:ifFalse:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "isEmpty", "nextChunk", "isNil"]}),
  734. smalltalk.Importer);
  735. smalltalk.addClass('PackageHandler', smalltalk.Object, [], 'Importer-Exporter');
  736. smalltalk.addMethod(
  737. smalltalk.method({
  738. selector: "ajaxPutAt:data:",
  739. fn: function (aURL,aString){
  740. var self=this;
  741. return smalltalk.withContext(function($ctx1) {
  742. _st(jQuery)._ajax_options_(aURL,smalltalk.HashedCollection._from_(["type".__minus_gt("PUT"),"data".__minus_gt(aString),"contentType".__minus_gt("text/plain;charset=UTF-8"),"error".__minus_gt((function(xhr){
  743. return smalltalk.withContext(function($ctx2) {
  744. return self._error_(_st(_st(_st("Commiting ".__comma(aURL)).__comma(" failed with reason: \x22")).__comma(_st(xhr)._responseText())).__comma("\x22"));
  745. }, function($ctx2) {$ctx2.fillBlock({xhr:xhr},$ctx1)})}))]));
  746. return self}, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:",{aURL:aURL,aString:aString},smalltalk.PackageHandler)})},
  747. messageSends: ["ajax:options:", "->", "error:", ",", "responseText"]}),
  748. smalltalk.PackageHandler);
  749. smalltalk.addMethod(
  750. smalltalk.method({
  751. selector: "commit:",
  752. fn: function (aPackage){
  753. var self=this;
  754. function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
  755. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  756. return smalltalk.withContext(function($ctx1) {
  757. _st(self._commitChannels())._do_displayingProgress_((function(commitStrategyFactory){
  758. var fileContents,commitStrategy;
  759. return smalltalk.withContext(function($ctx2) {
  760. commitStrategy=_st(commitStrategyFactory)._value_(aPackage);
  761. commitStrategy;
  762. fileContents=_st($String())._streamContents_((function(stream){
  763. return smalltalk.withContext(function($ctx3) {
  764. return _st(_st($PluggableExporter())._newUsing_(_st(commitStrategy)._key()))._exportPackage_on_(aPackage,stream);
  765. }, function($ctx3) {$ctx3.fillBlock({stream:stream},$ctx2)})}));
  766. fileContents;
  767. return self._ajaxPutAt_data_(_st(commitStrategy)._value(),fileContents);
  768. }, function($ctx2) {$ctx2.fillBlock({commitStrategyFactory:commitStrategyFactory,fileContents:fileContents,commitStrategy:commitStrategy},$ctx1)})}),"Committing package ".__comma(_st(aPackage)._name()));
  769. return self}, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  770. messageSends: ["do:displayingProgress:", "value:", "streamContents:", "exportPackage:on:", "newUsing:", "key", "ajaxPutAt:data:", "value", ",", "name", "commitChannels"]}),
  771. smalltalk.PackageHandler);
  772. smalltalk.PackageHandler.klass.iVarNames = ['registry'];
  773. smalltalk.addMethod(
  774. smalltalk.method({
  775. selector: "classRegisteredFor:",
  776. fn: function (aString){
  777. var self=this;
  778. return smalltalk.withContext(function($ctx1) {
  779. var $1;
  780. $1=_st(self["@registry"])._at_(aString);
  781. return $1;
  782. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},smalltalk.PackageHandler.klass)})},
  783. messageSends: ["at:"]}),
  784. smalltalk.PackageHandler.klass);
  785. smalltalk.addMethod(
  786. smalltalk.method({
  787. selector: "for:",
  788. fn: function (aString){
  789. var self=this;
  790. return smalltalk.withContext(function($ctx1) {
  791. var $1;
  792. $1=_st(self._classRegisteredFor_(aString))._new();
  793. return $1;
  794. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},smalltalk.PackageHandler.klass)})},
  795. messageSends: ["new", "classRegisteredFor:"]}),
  796. smalltalk.PackageHandler.klass);
  797. smalltalk.addMethod(
  798. smalltalk.method({
  799. selector: "initialize",
  800. fn: function (){
  801. var self=this;
  802. return smalltalk.withContext(function($ctx1) {
  803. smalltalk.PackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  804. self["@registry"]=smalltalk.HashedCollection._from_([]);
  805. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.PackageHandler.klass)})},
  806. messageSends: ["initialize"]}),
  807. smalltalk.PackageHandler.klass);
  808. smalltalk.addMethod(
  809. smalltalk.method({
  810. selector: "register:for:",
  811. fn: function (aClass,aString){
  812. var self=this;
  813. return smalltalk.withContext(function($ctx1) {
  814. _st(self["@registry"])._at_put_(aString,aClass);
  815. return self}, function($ctx1) {$ctx1.fill(self,"register:for:",{aClass:aClass,aString:aString},smalltalk.PackageHandler.klass)})},
  816. messageSends: ["at:put:"]}),
  817. smalltalk.PackageHandler.klass);
  818. smalltalk.addMethod(
  819. smalltalk.method({
  820. selector: "registerFor:",
  821. fn: function (aString){
  822. var self=this;
  823. function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
  824. return smalltalk.withContext(function($ctx1) {
  825. _st($PackageHandler())._register_for_(self,aString);
  826. return self}, function($ctx1) {$ctx1.fill(self,"registerFor:",{aString:aString},smalltalk.PackageHandler.klass)})},
  827. messageSends: ["register:for:"]}),
  828. smalltalk.PackageHandler.klass);
  829. smalltalk.addClass('AmdPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
  830. smalltalk.addMethod(
  831. smalltalk.method({
  832. selector: "commitChannels",
  833. fn: function (){
  834. var self=this;
  835. function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  836. function $StrippedExporter(){return smalltalk.StrippedExporter||(typeof StrippedExporter=="undefined"?nil:StrippedExporter)}
  837. function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  838. return smalltalk.withContext(function($ctx1) {
  839. var $1;
  840. $1=[(function(pkg){
  841. return smalltalk.withContext(function($ctx2) {
  842. return _st(_st($Exporter())._amdRecipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".js"));
  843. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  844. return smalltalk.withContext(function($ctx2) {
  845. return _st(_st($StrippedExporter())._amdRecipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".deploy.js"));
  846. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  847. return smalltalk.withContext(function($ctx2) {
  848. return _st(_st($ChunkExporter())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathSt()).__comma("/")).__comma(_st(pkg)._name())).__comma(".st"));
  849. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})})];
  850. return $1;
  851. }, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.AmdPackageHandler)})},
  852. messageSends: ["->", ",", "name", "commitPathJs", "amdRecipe", "commitPathSt", "recipe"]}),
  853. smalltalk.AmdPackageHandler);
  854. smalltalk.addMethod(
  855. smalltalk.method({
  856. selector: "commitPathJsFor:",
  857. fn: function (aPackage){
  858. var self=this;
  859. return smalltalk.withContext(function($ctx1) {
  860. var $1;
  861. $1=self._toUrl_(self._namespaceFor_(aPackage));
  862. return $1;
  863. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  864. messageSends: ["toUrl:", "namespaceFor:"]}),
  865. smalltalk.AmdPackageHandler);
  866. smalltalk.addMethod(
  867. smalltalk.method({
  868. selector: "commitPathStFor:",
  869. fn: function (aPackage){
  870. var self=this;
  871. var result;
  872. return smalltalk.withContext(function($ctx1) {
  873. var $2,$1;
  874. result=self._toUrl_(_st(self._namespaceFor_(aPackage)).__comma("/_source"));
  875. $2=_st(result)._match_("/_source$");
  876. if(smalltalk.assert($2)){
  877. $1=nil;
  878. } else {
  879. $1=result;
  880. };
  881. return $1;
  882. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,result:result},smalltalk.AmdPackageHandler)})},
  883. messageSends: ["toUrl:", ",", "namespaceFor:", "ifTrue:ifFalse:", "match:"]}),
  884. smalltalk.AmdPackageHandler);
  885. smalltalk.addMethod(
  886. smalltalk.method({
  887. selector: "namespaceFor:",
  888. fn: function (aPackage){
  889. var self=this;
  890. return smalltalk.withContext(function($ctx1) {
  891. var $2,$3,$4,$1;
  892. $2=_st(aPackage)._amdNamespace();
  893. if(($receiver = $2) == nil || $receiver == undefined){
  894. $3=aPackage;
  895. _st($3)._amdNamespace_(_st(self._class())._defaultNamespace());
  896. $4=_st($3)._amdNamespace();
  897. $1=$4;
  898. } else {
  899. $1=$2;
  900. };
  901. return $1;
  902. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
  903. messageSends: ["ifNil:", "amdNamespace:", "defaultNamespace", "class", "amdNamespace"]}),
  904. smalltalk.AmdPackageHandler);
  905. smalltalk.addMethod(
  906. smalltalk.method({
  907. selector: "toUrl:",
  908. fn: function (aString){
  909. var self=this;
  910. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  911. return smalltalk.withContext(function($ctx1) {
  912. var $1,$2;
  913. $1=_st(_st($Smalltalk())._current())._at_("_amd_require");
  914. if(($receiver = $1) == nil || $receiver == undefined){
  915. self._error_("AMD loader not present");
  916. } else {
  917. var require;
  918. require=$receiver;
  919. $2=_st(_st(require)._basicAt_("toUrl"))._value_(aString);
  920. return $2;
  921. };
  922. return self}, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},smalltalk.AmdPackageHandler)})},
  923. messageSends: ["ifNil:ifNotNil:", "error:", "value:", "basicAt:", "at:", "current"]}),
  924. smalltalk.AmdPackageHandler);
  925. smalltalk.AmdPackageHandler.klass.iVarNames = ['defaultNamespace'];
  926. smalltalk.addMethod(
  927. smalltalk.method({
  928. selector: "commitPathsFromLoader",
  929. fn: function (){
  930. var self=this;
  931. return smalltalk.withContext(function($ctx1) {
  932. return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.AmdPackageHandler.klass)})},
  933. messageSends: []}),
  934. smalltalk.AmdPackageHandler.klass);
  935. smalltalk.addMethod(
  936. smalltalk.method({
  937. selector: "defaultNamespace",
  938. fn: function (){
  939. var self=this;
  940. return smalltalk.withContext(function($ctx1) {
  941. var $2,$1;
  942. $2=self["@defaultNamespace"];
  943. if(($receiver = $2) == nil || $receiver == undefined){
  944. $1=self._error_("AMD default namespace not set.");
  945. } else {
  946. $1=$2;
  947. };
  948. return $1;
  949. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},smalltalk.AmdPackageHandler.klass)})},
  950. messageSends: ["ifNil:", "error:"]}),
  951. smalltalk.AmdPackageHandler.klass);
  952. smalltalk.addMethod(
  953. smalltalk.method({
  954. selector: "defaultNamespace:",
  955. fn: function (aString){
  956. var self=this;
  957. return smalltalk.withContext(function($ctx1) {
  958. self["@defaultNamespace"]=aString;
  959. return self}, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},smalltalk.AmdPackageHandler.klass)})},
  960. messageSends: []}),
  961. smalltalk.AmdPackageHandler.klass);
  962. smalltalk.addMethod(
  963. smalltalk.method({
  964. selector: "initialize",
  965. fn: function (){
  966. var self=this;
  967. return smalltalk.withContext(function($ctx1) {
  968. smalltalk.AmdPackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  969. self._registerFor_("amd");
  970. self._commitPathsFromLoader();
  971. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.AmdPackageHandler.klass)})},
  972. messageSends: ["initialize", "registerFor:", "commitPathsFromLoader"]}),
  973. smalltalk.AmdPackageHandler.klass);
  974. smalltalk.addMethod(
  975. smalltalk.method({
  976. selector: "resetCommitPaths",
  977. fn: function (){
  978. var self=this;
  979. return smalltalk.withContext(function($ctx1) {
  980. self["@defaultNamespace"]=nil;
  981. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.AmdPackageHandler.klass)})},
  982. messageSends: []}),
  983. smalltalk.AmdPackageHandler.klass);
  984. smalltalk.addClass('LegacyPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
  985. smalltalk.addMethod(
  986. smalltalk.method({
  987. selector: "commitChannels",
  988. fn: function (){
  989. var self=this;
  990. function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  991. function $StrippedExporter(){return smalltalk.StrippedExporter||(typeof StrippedExporter=="undefined"?nil:StrippedExporter)}
  992. function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  993. return smalltalk.withContext(function($ctx1) {
  994. var $1;
  995. $1=[(function(pkg){
  996. return smalltalk.withContext(function($ctx2) {
  997. return _st(_st($Exporter())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".js"));
  998. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  999. return smalltalk.withContext(function($ctx2) {
  1000. return _st(_st($StrippedExporter())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".deploy.js"));
  1001. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  1002. return smalltalk.withContext(function($ctx2) {
  1003. return _st(_st($ChunkExporter())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathSt()).__comma("/")).__comma(_st(pkg)._name())).__comma(".st"));
  1004. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})})];
  1005. return $1;
  1006. }, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.LegacyPackageHandler)})},
  1007. messageSends: ["->", ",", "name", "commitPathJs", "recipe", "commitPathSt"]}),
  1008. smalltalk.LegacyPackageHandler);
  1009. smalltalk.addMethod(
  1010. smalltalk.method({
  1011. selector: "commitPathJsFor:",
  1012. fn: function (aPackage){
  1013. var self=this;
  1014. return smalltalk.withContext(function($ctx1) {
  1015. var $1;
  1016. $1=_st(self._class())._defaultCommitPathJs();
  1017. return $1;
  1018. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
  1019. messageSends: ["defaultCommitPathJs", "class"]}),
  1020. smalltalk.LegacyPackageHandler);
  1021. smalltalk.addMethod(
  1022. smalltalk.method({
  1023. selector: "commitPathStFor:",
  1024. fn: function (aPackage){
  1025. var self=this;
  1026. return smalltalk.withContext(function($ctx1) {
  1027. var $1;
  1028. $1=_st(self._class())._defaultCommitPathSt();
  1029. return $1;
  1030. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
  1031. messageSends: ["defaultCommitPathSt", "class"]}),
  1032. smalltalk.LegacyPackageHandler);
  1033. smalltalk.addMethod(
  1034. smalltalk.method({
  1035. selector: "loadPackage:prefix:",
  1036. fn: function (packageName,aString){
  1037. var self=this;
  1038. var url;
  1039. return smalltalk.withContext(function($ctx1) {
  1040. var $1;
  1041. url=_st(_st(_st("/".__comma(aString)).__comma("/js/")).__comma(packageName)).__comma(".js");
  1042. _st(jQuery)._ajax_options_(url,smalltalk.HashedCollection._from_(["type".__minus_gt("GET"),"dataType".__minus_gt("script"),"complete".__minus_gt((function(jqXHR,textStatus){
  1043. return smalltalk.withContext(function($ctx2) {
  1044. $1=_st(_st(jqXHR)._readyState()).__eq((4));
  1045. if(smalltalk.assert($1)){
  1046. return self._setupPackageNamed_prefix_(packageName,aString);
  1047. };
  1048. }, function($ctx2) {$ctx2.fillBlock({jqXHR:jqXHR,textStatus:textStatus},$ctx1)})})),"error".__minus_gt((function(){
  1049. return smalltalk.withContext(function($ctx2) {
  1050. return _st(window)._alert_("Could not load package at: ".__comma(url));
  1051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))]));
  1052. return self}, function($ctx1) {$ctx1.fill(self,"loadPackage:prefix:",{packageName:packageName,aString:aString,url:url},smalltalk.LegacyPackageHandler)})},
  1053. messageSends: [",", "ajax:options:", "->", "ifTrue:", "setupPackageNamed:prefix:", "=", "readyState", "alert:"]}),
  1054. smalltalk.LegacyPackageHandler);
  1055. smalltalk.addMethod(
  1056. smalltalk.method({
  1057. selector: "loadPackages:prefix:",
  1058. fn: function (aCollection,aString){
  1059. var self=this;
  1060. return smalltalk.withContext(function($ctx1) {
  1061. _st(aCollection)._do_((function(each){
  1062. return smalltalk.withContext(function($ctx2) {
  1063. return self._loadPackage_prefix_(each,aString);
  1064. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1065. return self}, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler)})},
  1066. messageSends: ["do:", "loadPackage:prefix:"]}),
  1067. smalltalk.LegacyPackageHandler);
  1068. smalltalk.addMethod(
  1069. smalltalk.method({
  1070. selector: "setupPackageNamed:prefix:",
  1071. fn: function (packageName,aString){
  1072. var self=this;
  1073. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  1074. return smalltalk.withContext(function($ctx1) {
  1075. var $1,$2;
  1076. $1=_st($Package())._named_(packageName);
  1077. _st($1)._setupClasses();
  1078. _st($1)._commitPathJs_(_st("/".__comma(aString)).__comma("/js"));
  1079. $2=_st($1)._commitPathSt_(_st("/".__comma(aString)).__comma("/st"));
  1080. return self}, function($ctx1) {$ctx1.fill(self,"setupPackageNamed:prefix:",{packageName:packageName,aString:aString},smalltalk.LegacyPackageHandler)})},
  1081. messageSends: ["setupClasses", "named:", "commitPathJs:", ",", "commitPathSt:"]}),
  1082. smalltalk.LegacyPackageHandler);
  1083. smalltalk.LegacyPackageHandler.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  1084. smalltalk.addMethod(
  1085. smalltalk.method({
  1086. selector: "commitPathsFromLoader",
  1087. fn: function (){
  1088. var self=this;
  1089. return smalltalk.withContext(function($ctx1) {
  1090. var commitPath = typeof amber !== 'undefined' && amber.commitPath;
  1091. if (!commitPath) return;
  1092. if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);
  1093. if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);
  1094. ;
  1095. return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.LegacyPackageHandler.klass)})},
  1096. messageSends: []}),
  1097. smalltalk.LegacyPackageHandler.klass);
  1098. smalltalk.addMethod(
  1099. smalltalk.method({
  1100. selector: "defaultCommitPathJs",
  1101. fn: function (){
  1102. var self=this;
  1103. return smalltalk.withContext(function($ctx1) {
  1104. var $2,$1;
  1105. $2=self["@defaultCommitPathJs"];
  1106. if(($receiver = $2) == nil || $receiver == undefined){
  1107. self["@defaultCommitPathJs"]="js";
  1108. $1=self["@defaultCommitPathJs"];
  1109. } else {
  1110. $1=$2;
  1111. };
  1112. return $1;
  1113. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs",{},smalltalk.LegacyPackageHandler.klass)})},
  1114. messageSends: ["ifNil:"]}),
  1115. smalltalk.LegacyPackageHandler.klass);
  1116. smalltalk.addMethod(
  1117. smalltalk.method({
  1118. selector: "defaultCommitPathJs:",
  1119. fn: function (aString){
  1120. var self=this;
  1121. return smalltalk.withContext(function($ctx1) {
  1122. self["@defaultCommitPathJs"]=aString;
  1123. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1124. messageSends: []}),
  1125. smalltalk.LegacyPackageHandler.klass);
  1126. smalltalk.addMethod(
  1127. smalltalk.method({
  1128. selector: "defaultCommitPathSt",
  1129. fn: function (){
  1130. var self=this;
  1131. return smalltalk.withContext(function($ctx1) {
  1132. var $2,$1;
  1133. $2=self["@defaultCommitPathSt"];
  1134. if(($receiver = $2) == nil || $receiver == undefined){
  1135. self["@defaultCommitPathSt"]="st";
  1136. $1=self["@defaultCommitPathSt"];
  1137. } else {
  1138. $1=$2;
  1139. };
  1140. return $1;
  1141. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt",{},smalltalk.LegacyPackageHandler.klass)})},
  1142. messageSends: ["ifNil:"]}),
  1143. smalltalk.LegacyPackageHandler.klass);
  1144. smalltalk.addMethod(
  1145. smalltalk.method({
  1146. selector: "defaultCommitPathSt:",
  1147. fn: function (aString){
  1148. var self=this;
  1149. return smalltalk.withContext(function($ctx1) {
  1150. self["@defaultCommitPathSt"]=aString;
  1151. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1152. messageSends: []}),
  1153. smalltalk.LegacyPackageHandler.klass);
  1154. smalltalk.addMethod(
  1155. smalltalk.method({
  1156. selector: "initialize",
  1157. fn: function (){
  1158. var self=this;
  1159. return smalltalk.withContext(function($ctx1) {
  1160. smalltalk.LegacyPackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  1161. self._registerFor_("unknown");
  1162. self._commitPathsFromLoader();
  1163. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.LegacyPackageHandler.klass)})},
  1164. messageSends: ["initialize", "registerFor:", "commitPathsFromLoader"]}),
  1165. smalltalk.LegacyPackageHandler.klass);
  1166. smalltalk.addMethod(
  1167. smalltalk.method({
  1168. selector: "loadPackages:prefix:",
  1169. fn: function (aCollection,aString){
  1170. var self=this;
  1171. return smalltalk.withContext(function($ctx1) {
  1172. var $1;
  1173. $1=_st(self._new())._loadPackages_prefix_(aCollection,aString);
  1174. return $1;
  1175. }, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1176. messageSends: ["loadPackages:prefix:", "new"]}),
  1177. smalltalk.LegacyPackageHandler.klass);
  1178. smalltalk.addMethod(
  1179. smalltalk.method({
  1180. selector: "resetCommitPaths",
  1181. fn: function (){
  1182. var self=this;
  1183. return smalltalk.withContext(function($ctx1) {
  1184. self["@defaultCommitPathJs"]=nil;
  1185. self["@defaultCommitPathSt"]=nil;
  1186. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.LegacyPackageHandler.klass)})},
  1187. messageSends: []}),
  1188. smalltalk.LegacyPackageHandler.klass);
  1189. smalltalk.addClass('PluggableExporter', smalltalk.Object, ['recipe'], 'Importer-Exporter');
  1190. smalltalk.addMethod(
  1191. smalltalk.method({
  1192. selector: "export:usingRecipe:on:",
  1193. fn: function (anObject,anArray,aStream){
  1194. var self=this;
  1195. var args;
  1196. return smalltalk.withContext(function($ctx1) {
  1197. var $1;
  1198. args=[anObject,aStream];
  1199. _st(anArray)._do_((function(each){
  1200. var val;
  1201. return smalltalk.withContext(function($ctx2) {
  1202. val=_st(each)._value();
  1203. val;
  1204. $1=_st(val).__eq_eq(each);
  1205. if(smalltalk.assert($1)){
  1206. var selection;
  1207. selection=_st(_st(_st(each)._first())._key())._perform_withArguments_(_st(_st(each)._first())._value(),[anObject]);
  1208. selection;
  1209. return _st(selection)._do_((function(eachPart){
  1210. return smalltalk.withContext(function($ctx3) {
  1211. return self._export_usingRecipe_on_(eachPart,_st(each)._allButFirst(),aStream);
  1212. }, function($ctx3) {$ctx3.fillBlock({eachPart:eachPart},$ctx2)})}));
  1213. } else {
  1214. return _st(_st(each)._key())._perform_withArguments_(val,args);
  1215. };
  1216. }, function($ctx2) {$ctx2.fillBlock({each:each,val:val},$ctx1)})}));
  1217. return self}, function($ctx1) {$ctx1.fill(self,"export:usingRecipe:on:",{anObject:anObject,anArray:anArray,aStream:aStream,args:args},smalltalk.PluggableExporter)})},
  1218. messageSends: ["do:", "value", "ifFalse:ifTrue:", "perform:withArguments:", "key", "first", "export:usingRecipe:on:", "allButFirst", "=="]}),
  1219. smalltalk.PluggableExporter);
  1220. smalltalk.addMethod(
  1221. smalltalk.method({
  1222. selector: "exportAll",
  1223. fn: function (){
  1224. var self=this;
  1225. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1226. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1227. return smalltalk.withContext(function($ctx1) {
  1228. var $1;
  1229. $1=_st($String())._streamContents_((function(stream){
  1230. return smalltalk.withContext(function($ctx2) {
  1231. return _st(_st(_st($Smalltalk())._current())._packages())._do_((function(pkg){
  1232. return smalltalk.withContext(function($ctx3) {
  1233. return self._exportPackage_on_(pkg,stream);
  1234. }, function($ctx3) {$ctx3.fillBlock({pkg:pkg},$ctx2)})}));
  1235. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  1236. return $1;
  1237. }, function($ctx1) {$ctx1.fill(self,"exportAll",{},smalltalk.PluggableExporter)})},
  1238. messageSends: ["streamContents:", "do:", "exportPackage:on:", "packages", "current"]}),
  1239. smalltalk.PluggableExporter);
  1240. smalltalk.addMethod(
  1241. smalltalk.method({
  1242. selector: "exportPackage:on:",
  1243. fn: function (aPackage,aStream){
  1244. var self=this;
  1245. return smalltalk.withContext(function($ctx1) {
  1246. self._export_usingRecipe_on_(aPackage,self._recipe(),aStream);
  1247. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},smalltalk.PluggableExporter)})},
  1248. messageSends: ["export:usingRecipe:on:", "recipe"]}),
  1249. smalltalk.PluggableExporter);
  1250. smalltalk.addMethod(
  1251. smalltalk.method({
  1252. selector: "recipe",
  1253. fn: function (){
  1254. var self=this;
  1255. return smalltalk.withContext(function($ctx1) {
  1256. var $1;
  1257. $1=self["@recipe"];
  1258. return $1;
  1259. }, function($ctx1) {$ctx1.fill(self,"recipe",{},smalltalk.PluggableExporter)})},
  1260. messageSends: []}),
  1261. smalltalk.PluggableExporter);
  1262. smalltalk.addMethod(
  1263. smalltalk.method({
  1264. selector: "recipe:",
  1265. fn: function (anArray){
  1266. var self=this;
  1267. return smalltalk.withContext(function($ctx1) {
  1268. self["@recipe"]=anArray;
  1269. return self}, function($ctx1) {$ctx1.fill(self,"recipe:",{anArray:anArray},smalltalk.PluggableExporter)})},
  1270. messageSends: []}),
  1271. smalltalk.PluggableExporter);
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "newUsing:",
  1275. fn: function (recipe){
  1276. var self=this;
  1277. return smalltalk.withContext(function($ctx1) {
  1278. var $2,$3,$1;
  1279. $2=self._new();
  1280. _st($2)._recipe_(recipe);
  1281. $3=_st($2)._yourself();
  1282. $1=$3;
  1283. return $1;
  1284. }, function($ctx1) {$ctx1.fill(self,"newUsing:",{recipe:recipe},smalltalk.PluggableExporter.klass)})},
  1285. messageSends: ["recipe:", "new", "yourself"]}),
  1286. smalltalk.PluggableExporter.klass);
  1287. smalltalk.addMethod(
  1288. smalltalk.method({
  1289. selector: "ownClassesOfPackage:",
  1290. fn: function (package_){
  1291. var self=this;
  1292. return smalltalk.withContext(function($ctx1) {
  1293. var $1;
  1294. $1=_st(_st(package_)._sortedClasses())._asSet();
  1295. return $1;
  1296. }, function($ctx1) {$ctx1.fill(self,"ownClassesOfPackage:",{package_:package_},smalltalk.PluggableExporter.klass)})},
  1297. messageSends: ["asSet", "sortedClasses"]}),
  1298. smalltalk.PluggableExporter.klass);
  1299. smalltalk.addMethod(
  1300. smalltalk.method({
  1301. selector: "amdNamespace",
  1302. fn: function (){
  1303. var self=this;
  1304. return smalltalk.withContext(function($ctx1) {
  1305. return (self.transport && self.transport.amdNamespace) || nil;
  1306. return self}, function($ctx1) {$ctx1.fill(self,"amdNamespace",{},smalltalk.Package)})},
  1307. messageSends: []}),
  1308. smalltalk.Package);
  1309. smalltalk.addMethod(
  1310. smalltalk.method({
  1311. selector: "amdNamespace:",
  1312. fn: function (aString){
  1313. var self=this;
  1314. return smalltalk.withContext(function($ctx1) {
  1315. if (!self.transport) { self.transport = { type: 'amd' }; }
  1316. if (self.transport.type !== 'amd') { throw new Error('Package '+self._name()+' has transport type '+self.transport.type+', not "amd".'); }
  1317. self.transport.amdNamespace = aString;;
  1318. return self}, function($ctx1) {$ctx1.fill(self,"amdNamespace:",{aString:aString},smalltalk.Package)})},
  1319. messageSends: []}),
  1320. smalltalk.Package);
  1321. smalltalk.addMethod(
  1322. smalltalk.method({
  1323. selector: "commit",
  1324. fn: function (){
  1325. var self=this;
  1326. return smalltalk.withContext(function($ctx1) {
  1327. var $1;
  1328. $1=_st(self._transport())._commit_(self);
  1329. return $1;
  1330. }, function($ctx1) {$ctx1.fill(self,"commit",{},smalltalk.Package)})},
  1331. messageSends: ["commit:", "transport"]}),
  1332. smalltalk.Package);
  1333. smalltalk.addMethod(
  1334. smalltalk.method({
  1335. selector: "commitPathJs",
  1336. fn: function (){
  1337. var self=this;
  1338. return smalltalk.withContext(function($ctx1) {
  1339. var $3,$2,$1;
  1340. $3=self["@extension"];
  1341. if(($receiver = $3) == nil || $receiver == undefined){
  1342. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1343. $2=self["@extension"];
  1344. } else {
  1345. $2=$3;
  1346. };
  1347. $1=_st($2)._at_ifAbsent_("commitPathJs",(function(){
  1348. return smalltalk.withContext(function($ctx2) {
  1349. return _st(self._transport())._commitPathJsFor_(self);
  1350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1351. return $1;
  1352. }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
  1353. messageSends: ["at:ifAbsent:", "commitPathJsFor:", "transport", "ifNil:"]}),
  1354. smalltalk.Package);
  1355. smalltalk.addMethod(
  1356. smalltalk.method({
  1357. selector: "commitPathJs:",
  1358. fn: function (aString){
  1359. var self=this;
  1360. return smalltalk.withContext(function($ctx1) {
  1361. var $3,$2,$1;
  1362. $3=self["@extension"];
  1363. if(($receiver = $3) == nil || $receiver == undefined){
  1364. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1365. $2=self["@extension"];
  1366. } else {
  1367. $2=$3;
  1368. };
  1369. $1=_st($2)._at_put_("commitPathJs",aString);
  1370. return $1;
  1371. }, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
  1372. messageSends: ["at:put:", "ifNil:"]}),
  1373. smalltalk.Package);
  1374. smalltalk.addMethod(
  1375. smalltalk.method({
  1376. selector: "commitPathSt",
  1377. fn: function (){
  1378. var self=this;
  1379. return smalltalk.withContext(function($ctx1) {
  1380. var $3,$2,$1;
  1381. $3=self["@extension"];
  1382. if(($receiver = $3) == nil || $receiver == undefined){
  1383. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1384. $2=self["@extension"];
  1385. } else {
  1386. $2=$3;
  1387. };
  1388. $1=_st($2)._at_ifAbsent_("commitPathSt",(function(){
  1389. return smalltalk.withContext(function($ctx2) {
  1390. return _st(self._transport())._commitPathStFor_(self);
  1391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1392. return $1;
  1393. }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
  1394. messageSends: ["at:ifAbsent:", "commitPathStFor:", "transport", "ifNil:"]}),
  1395. smalltalk.Package);
  1396. smalltalk.addMethod(
  1397. smalltalk.method({
  1398. selector: "commitPathSt:",
  1399. fn: function (aString){
  1400. var self=this;
  1401. return smalltalk.withContext(function($ctx1) {
  1402. var $3,$2,$1;
  1403. $3=self["@extension"];
  1404. if(($receiver = $3) == nil || $receiver == undefined){
  1405. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1406. $2=self["@extension"];
  1407. } else {
  1408. $2=$3;
  1409. };
  1410. $1=_st($2)._at_put_("commitPathSt",aString);
  1411. return $1;
  1412. }, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
  1413. messageSends: ["at:put:", "ifNil:"]}),
  1414. smalltalk.Package);
  1415. smalltalk.addMethod(
  1416. smalltalk.method({
  1417. selector: "transport",
  1418. fn: function (){
  1419. var self=this;
  1420. function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
  1421. return smalltalk.withContext(function($ctx1) {
  1422. var $1;
  1423. $1=_st($PackageHandler())._for_(self._transportType());
  1424. return $1;
  1425. }, function($ctx1) {$ctx1.fill(self,"transport",{},smalltalk.Package)})},
  1426. messageSends: ["for:", "transportType"]}),
  1427. smalltalk.Package);
  1428. smalltalk.addMethod(
  1429. smalltalk.method({
  1430. selector: "transportJson",
  1431. fn: function (){
  1432. var self=this;
  1433. return smalltalk.withContext(function($ctx1) {
  1434. return JSON.stringify(self.transport || null);;
  1435. return self}, function($ctx1) {$ctx1.fill(self,"transportJson",{},smalltalk.Package)})},
  1436. messageSends: []}),
  1437. smalltalk.Package);
  1438. smalltalk.addMethod(
  1439. smalltalk.method({
  1440. selector: "transportType",
  1441. fn: function (){
  1442. var self=this;
  1443. return smalltalk.withContext(function($ctx1) {
  1444. return (self.transport && self.transport.type) || 'unknown';;
  1445. return self}, function($ctx1) {$ctx1.fill(self,"transportType",{},smalltalk.Package)})},
  1446. messageSends: []}),
  1447. smalltalk.Package);
  1448. });