Importer-Exporter.deploy.js 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132
  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('ChunkParser', smalltalk.Object, ['stream'], 'Importer-Exporter');
  4. smalltalk.addMethod(
  5. smalltalk.method({
  6. selector: "nextChunk",
  7. fn: function (){
  8. var self=this;
  9. var char,result,chunk;
  10. return smalltalk.withContext(function($ctx1) {
  11. var $1,$2,$3;
  12. var $early={};
  13. try {
  14. result=""._writeStream();
  15. _st((function(){
  16. return smalltalk.withContext(function($ctx2) {
  17. char=_st(self["@stream"])._next();
  18. char;
  19. return _st(char)._notNil();
  20. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  21. return smalltalk.withContext(function($ctx2) {
  22. $1=_st(char).__eq("!");
  23. if(smalltalk.assert($1)){
  24. $2=_st(_st(self["@stream"])._peek()).__eq("!");
  25. if(smalltalk.assert($2)){
  26. _st(self["@stream"])._next();
  27. } else {
  28. $3=_st(_st(result)._contents())._trimBoth();
  29. throw $early=[$3];
  30. };
  31. };
  32. return _st(result)._nextPut_(char);
  33. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  34. return nil;
  35. }
  36. catch(e) {if(e===$early)return e[0]; throw e}
  37. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},smalltalk.ChunkParser)})},
  38. messageSends: ["writeStream", "whileTrue:", "ifTrue:", "ifTrue:ifFalse:", "next", "trimBoth", "contents", "=", "peek", "nextPut:", "notNil"]}),
  39. smalltalk.ChunkParser);
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "stream:",
  43. fn: function (aStream){
  44. var self=this;
  45. return smalltalk.withContext(function($ctx1) {
  46. self["@stream"]=aStream;
  47. return self}, function($ctx1) {$ctx1.fill(self,"stream:",{aStream:aStream},smalltalk.ChunkParser)})},
  48. messageSends: []}),
  49. smalltalk.ChunkParser);
  50. smalltalk.addMethod(
  51. smalltalk.method({
  52. selector: "on:",
  53. fn: function (aStream){
  54. var self=this;
  55. return smalltalk.withContext(function($ctx1) {
  56. var $1;
  57. $1=_st(self._new())._stream_(aStream);
  58. return $1;
  59. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},smalltalk.ChunkParser.klass)})},
  60. messageSends: ["stream:", "new"]}),
  61. smalltalk.ChunkParser.klass);
  62. smalltalk.addClass('Exporter', smalltalk.Object, [], 'Importer-Exporter');
  63. smalltalk.addMethod(
  64. smalltalk.method({
  65. selector: "classNameFor:",
  66. fn: function (aClass){
  67. var self=this;
  68. return smalltalk.withContext(function($ctx1) {
  69. var $2,$3,$1;
  70. $2=_st(aClass)._isMetaclass();
  71. if(smalltalk.assert($2)){
  72. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(".klass");
  73. } else {
  74. $3=_st(aClass)._isNil();
  75. if(smalltalk.assert($3)){
  76. $1="nil";
  77. } else {
  78. $1=_st(aClass)._name();
  79. };
  80. };
  81. return $1;
  82. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.Exporter)})},
  83. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"]}),
  84. smalltalk.Exporter);
  85. smalltalk.addMethod(
  86. smalltalk.method({
  87. selector: "exportAll",
  88. fn: function (){
  89. var self=this;
  90. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  91. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  92. return smalltalk.withContext(function($ctx1) {
  93. var $1;
  94. $1=_st($String())._streamContents_((function(stream){
  95. return smalltalk.withContext(function($ctx2) {
  96. return _st(_st(_st($Smalltalk())._current())._packages())._do_((function(pkg){
  97. return smalltalk.withContext(function($ctx3) {
  98. return _st(stream)._nextPutAll_(self._exportPackage_(_st(pkg)._name()));
  99. }, function($ctx3) {$ctx3.fillBlock({pkg:pkg},$ctx2)})}));
  100. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  101. return $1;
  102. }, function($ctx1) {$ctx1.fill(self,"exportAll",{},smalltalk.Exporter)})},
  103. messageSends: ["streamContents:", "do:", "nextPutAll:", "exportPackage:", "name", "packages", "current"]}),
  104. smalltalk.Exporter);
  105. smalltalk.addMethod(
  106. smalltalk.method({
  107. selector: "exportClass:",
  108. fn: function (aClass){
  109. var self=this;
  110. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  111. return smalltalk.withContext(function($ctx1) {
  112. var $1;
  113. $1=_st($String())._streamContents_((function(stream){
  114. return smalltalk.withContext(function($ctx2) {
  115. self._exportDefinitionOf_on_(aClass,stream);
  116. self._exportMethodsOf_on_(aClass,stream);
  117. self._exportMetaDefinitionOf_on_(aClass,stream);
  118. return self._exportMethodsOf_on_(_st(aClass)._class(),stream);
  119. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  120. return $1;
  121. }, function($ctx1) {$ctx1.fill(self,"exportClass:",{aClass:aClass},smalltalk.Exporter)})},
  122. messageSends: ["streamContents:", "exportDefinitionOf:on:", "exportMethodsOf:on:", "exportMetaDefinitionOf:on:", "class"]}),
  123. smalltalk.Exporter);
  124. smalltalk.addMethod(
  125. smalltalk.method({
  126. selector: "exportDefinitionOf:on:",
  127. fn: function (aClass,aStream){
  128. var self=this;
  129. return smalltalk.withContext(function($ctx1) {
  130. var $1,$2,$3,$4,$5,$6,$7;
  131. $1=aStream;
  132. _st($1)._nextPutAll_("smalltalk.addClass(");
  133. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  134. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  135. $2=_st($1)._nextPutAll_(", [");
  136. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  137. return smalltalk.withContext(function($ctx2) {
  138. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  139. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  140. return smalltalk.withContext(function($ctx2) {
  141. return _st(aStream)._nextPutAll_(", ");
  142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  143. $3=aStream;
  144. _st($3)._nextPutAll_("], '");
  145. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  146. $4=_st($3)._nextPutAll_(");");
  147. $5=_st(_st(aClass)._comment())._notEmpty();
  148. if(smalltalk.assert($5)){
  149. $6=aStream;
  150. _st($6)._lf();
  151. _st($6)._nextPutAll_("smalltalk.");
  152. _st($6)._nextPutAll_(self._classNameFor_(aClass));
  153. _st($6)._nextPutAll_(".comment=");
  154. _st($6)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
  155. $7=_st($6)._nextPutAll_(";");
  156. $7;
  157. };
  158. _st(aStream)._lf();
  159. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  160. messageSends: ["nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "lf", "asJavascript", "comment", "notEmpty"]}),
  161. smalltalk.Exporter);
  162. smalltalk.addMethod(
  163. smalltalk.method({
  164. selector: "exportMetaDefinitionOf:on:",
  165. fn: function (aClass,aStream){
  166. var self=this;
  167. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  168. return smalltalk.withContext(function($ctx1) {
  169. var $1,$2,$3;
  170. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  171. if(! smalltalk.assert($1)){
  172. $2=aStream;
  173. _st($2)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._class())));
  174. $3=_st($2)._nextPutAll_(".iVarNames = [");
  175. $3;
  176. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  177. return smalltalk.withContext(function($ctx2) {
  178. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  179. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  180. return smalltalk.withContext(function($ctx2) {
  181. return _st(aStream)._nextPutAll_(",");
  182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  183. _st(aStream)._nextPutAll_("];".__comma(_st($String())._lf()));
  184. };
  185. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  186. messageSends: ["ifFalse:", "nextPutAll:", ",", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"]}),
  187. smalltalk.Exporter);
  188. smalltalk.addMethod(
  189. smalltalk.method({
  190. selector: "exportMethod:of:on:",
  191. fn: function (aMethod,aClass,aStream){
  192. var self=this;
  193. return smalltalk.withContext(function($ctx1) {
  194. var $1,$2,$3,$4;
  195. $1=aStream;
  196. _st($1)._nextPutAll_("smalltalk.addMethod(");
  197. _st($1)._lf();
  198. _st($1)._nextPutAll_("smalltalk.method({");
  199. _st($1)._lf();
  200. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  201. _st($1)._lf();
  202. _st($1)._nextPutAll_(_st("category: '".__comma(_st(aMethod)._category())).__comma("',"));
  203. _st($1)._lf();
  204. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  205. _st($1)._lf();
  206. _st($1)._nextPutAll_(_st("args: ".__comma(_st(_st(aMethod)._arguments())._asJavascript())).__comma(","));
  207. _st($1)._lf();
  208. _st($1)._nextPutAll_(_st("source: ".__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
  209. _st($1)._lf();
  210. _st($1)._nextPutAll_(_st("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript())).__comma(","));
  211. _st($1)._lf();
  212. $2=_st($1)._nextPutAll_("referencedClasses: ".__comma(_st(_st(aMethod)._referencedClasses())._asJavascript()));
  213. $3=aStream;
  214. _st($3)._lf();
  215. _st($3)._nextPutAll_("}),");
  216. _st($3)._lf();
  217. _st($3)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(aClass)));
  218. _st($3)._nextPutAll_(");");
  219. _st($3)._lf();
  220. $4=_st($3)._lf();
  221. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:of:on:",{aMethod:aMethod,aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  222. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "category", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:"]}),
  223. smalltalk.Exporter);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "exportMethodsOf:on:",
  227. fn: function (aClass,aStream){
  228. var self=this;
  229. return smalltalk.withContext(function($ctx1) {
  230. var $1;
  231. _st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  232. return smalltalk.withContext(function($ctx2) {
  233. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  234. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(each){
  235. return smalltalk.withContext(function($ctx2) {
  236. $1=_st(_st(each)._category())._match_("^\x5c*");
  237. if(! smalltalk.assert($1)){
  238. return self._exportMethod_of_on_(each,aClass,aStream);
  239. };
  240. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  241. _st(aStream)._lf();
  242. return self}, function($ctx1) {$ctx1.fill(self,"exportMethodsOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  243. messageSends: ["do:", "ifFalse:", "exportMethod:of:on:", "match:", "category", "sorted:", "<=", "selector", "values", "methodDictionary", "lf"]}),
  244. smalltalk.Exporter);
  245. smalltalk.addMethod(
  246. smalltalk.method({
  247. selector: "exportPackage:",
  248. fn: function (packageName){
  249. var self=this;
  250. var package_;
  251. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  252. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  253. return smalltalk.withContext(function($ctx1) {
  254. var $1;
  255. $1=_st($String())._streamContents_((function(stream){
  256. return smalltalk.withContext(function($ctx2) {
  257. package_=_st(_st($Smalltalk())._current())._packageAt_(packageName);
  258. package_;
  259. self._exportPackagePrologueOf_on_(package_,stream);
  260. return _st((function(){
  261. return smalltalk.withContext(function($ctx3) {
  262. self._exportPackageDefinitionOf_on_(package_,stream);
  263. _st(_st(_st(package_)._sortedClasses())._asSet())._do_((function(each){
  264. return smalltalk.withContext(function($ctx4) {
  265. return _st(stream)._nextPutAll_(self._exportClass_(each));
  266. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3)})}));
  267. return self._exportPackageExtensionsOf_on_(package_,stream);
  268. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))._ensure_((function(){
  269. return smalltalk.withContext(function($ctx3) {
  270. return self._exportPackageEpilogueOn_(stream);
  271. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  272. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  273. return $1;
  274. }, function($ctx1) {$ctx1.fill(self,"exportPackage:",{packageName:packageName,package_:package_},smalltalk.Exporter)})},
  275. messageSends: ["streamContents:", "packageAt:", "current", "exportPackagePrologueOf:on:", "ensure:", "exportPackageEpilogueOn:", "exportPackageDefinitionOf:on:", "do:", "nextPutAll:", "exportClass:", "asSet", "sortedClasses", "exportPackageExtensionsOf:on:"]}),
  276. smalltalk.Exporter);
  277. smalltalk.addMethod(
  278. smalltalk.method({
  279. selector: "exportPackageDefinitionOf:on:",
  280. fn: function (package_,aStream){
  281. var self=this;
  282. return smalltalk.withContext(function($ctx1) {
  283. var $1,$2;
  284. $1=aStream;
  285. _st($1)._nextPutAll_("smalltalk.addPackage(");
  286. _st($1)._nextPutAll_(_st("'".__comma(_st(package_)._name())).__comma("');"));
  287. $2=_st($1)._lf();
  288. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{package_:package_,aStream:aStream},smalltalk.Exporter)})},
  289. messageSends: ["nextPutAll:", ",", "name", "lf"]}),
  290. smalltalk.Exporter);
  291. smalltalk.addMethod(
  292. smalltalk.method({
  293. selector: "exportPackageEpilogueOn:",
  294. fn: function (aStream){
  295. var self=this;
  296. return smalltalk.withContext(function($ctx1) {
  297. var $1,$2;
  298. $1=aStream;
  299. _st($1)._nextPutAll_("});");
  300. $2=_st($1)._lf();
  301. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOn:",{aStream:aStream},smalltalk.Exporter)})},
  302. messageSends: ["nextPutAll:", "lf"]}),
  303. smalltalk.Exporter);
  304. smalltalk.addMethod(
  305. smalltalk.method({
  306. selector: "exportPackageExtensionsOf:on:",
  307. fn: function (package_,aStream){
  308. var self=this;
  309. var name;
  310. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  311. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  312. return smalltalk.withContext(function($ctx1) {
  313. var $1;
  314. name=_st(package_)._name();
  315. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  316. return smalltalk.withContext(function($ctx2) {
  317. return _st([each,_st(each)._class()])._do_((function(aClass){
  318. return smalltalk.withContext(function($ctx3) {
  319. return _st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  320. return smalltalk.withContext(function($ctx4) {
  321. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  322. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._do_((function(method){
  323. return smalltalk.withContext(function($ctx4) {
  324. $1=_st(_st(method)._category())._match_("^\x5c*".__comma(name));
  325. if(smalltalk.assert($1)){
  326. return self._exportMethod_of_on_(method,aClass,aStream);
  327. };
  328. }, function($ctx4) {$ctx4.fillBlock({method:method},$ctx3)})}));
  329. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  330. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  331. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageExtensionsOf:on:",{package_:package_,aStream:aStream,name:name},smalltalk.Exporter)})},
  332. messageSends: ["name", "do:", "ifTrue:", "exportMethod:of:on:", "match:", ",", "category", "sorted:", "<=", "selector", "values", "methodDictionary", "class", "sortedClasses:", "classes", "current"]}),
  333. smalltalk.Exporter);
  334. smalltalk.addMethod(
  335. smalltalk.method({
  336. selector: "exportPackagePrologueOf:on:",
  337. fn: function (aPackage,aStream){
  338. var self=this;
  339. return smalltalk.withContext(function($ctx1) {
  340. var $1,$2;
  341. $1=aStream;
  342. _st($1)._nextPutAll_("define(\x22amber/");
  343. _st($1)._nextPutAll_(_st(aPackage)._name());
  344. _st($1)._nextPutAll_("\x22, [\x22amber_vm/smalltalk\x22,\x22amber_vm/nil\x22,\x22amber_vm/_st\x22], function(smalltalk,nil,_st){");
  345. $2=_st($1)._lf();
  346. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  347. messageSends: ["nextPutAll:", "name", "lf"]}),
  348. smalltalk.Exporter);
  349. smalltalk.addClass('ChunkExporter', smalltalk.Exporter, [], 'Importer-Exporter');
  350. smalltalk.addMethod(
  351. smalltalk.method({
  352. selector: "chunkEscape:",
  353. fn: function (aString){
  354. var self=this;
  355. return smalltalk.withContext(function($ctx1) {
  356. var $1;
  357. $1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
  358. return $1;
  359. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},smalltalk.ChunkExporter)})},
  360. messageSends: ["trimBoth", "replace:with:"]}),
  361. smalltalk.ChunkExporter);
  362. smalltalk.addMethod(
  363. smalltalk.method({
  364. selector: "classNameFor:",
  365. fn: function (aClass){
  366. var self=this;
  367. return smalltalk.withContext(function($ctx1) {
  368. var $2,$3,$1;
  369. $2=_st(aClass)._isMetaclass();
  370. if(smalltalk.assert($2)){
  371. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(" class");
  372. } else {
  373. $3=_st(aClass)._isNil();
  374. if(smalltalk.assert($3)){
  375. $1="nil";
  376. } else {
  377. $1=_st(aClass)._name();
  378. };
  379. };
  380. return $1;
  381. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.ChunkExporter)})},
  382. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"]}),
  383. smalltalk.ChunkExporter);
  384. smalltalk.addMethod(
  385. smalltalk.method({
  386. selector: "exportDefinitionOf:on:",
  387. fn: function (aClass,aStream){
  388. var self=this;
  389. return smalltalk.withContext(function($ctx1) {
  390. var $1,$2,$3,$4,$5,$6,$7;
  391. $1=aStream;
  392. _st($1)._nextPutAll_(self._classNameFor_(_st(aClass)._superclass()));
  393. _st($1)._nextPutAll_(" subclass: #".__comma(self._classNameFor_(aClass)));
  394. _st($1)._lf();
  395. _st($1)._tab();
  396. $2=_st($1)._nextPutAll_("instanceVariableNames: '");
  397. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  398. return smalltalk.withContext(function($ctx2) {
  399. return _st(aStream)._nextPutAll_(each);
  400. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  401. return smalltalk.withContext(function($ctx2) {
  402. return _st(aStream)._nextPutAll_(" ");
  403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  404. $3=aStream;
  405. _st($3)._nextPutAll_("'");
  406. _st($3)._lf();
  407. _st($3)._tab();
  408. _st($3)._nextPutAll_(_st("package: '".__comma(_st(aClass)._category())).__comma("'!"));
  409. $4=_st($3)._lf();
  410. $5=_st(_st(aClass)._comment())._notEmpty();
  411. if(smalltalk.assert($5)){
  412. $6=aStream;
  413. _st($6)._nextPutAll_(_st("!".__comma(self._classNameFor_(aClass))).__comma(" commentStamp!"));
  414. _st($6)._lf();
  415. _st($6)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
  416. $7=_st($6)._lf();
  417. $7;
  418. };
  419. _st(aStream)._lf();
  420. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  421. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "chunkEscape:", "comment", "notEmpty"]}),
  422. smalltalk.ChunkExporter);
  423. smalltalk.addMethod(
  424. smalltalk.method({
  425. selector: "exportMetaDefinitionOf:on:",
  426. fn: function (aClass,aStream){
  427. var self=this;
  428. return smalltalk.withContext(function($ctx1) {
  429. var $1,$2,$3,$4,$5;
  430. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  431. if(! smalltalk.assert($1)){
  432. $2=aStream;
  433. _st($2)._nextPutAll_(self._classNameFor_(_st(aClass)._class()));
  434. $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
  435. $3;
  436. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  437. return smalltalk.withContext(function($ctx2) {
  438. return _st(aStream)._nextPutAll_(each);
  439. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  440. return smalltalk.withContext(function($ctx2) {
  441. return _st(aStream)._nextPutAll_(" ");
  442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  443. $4=aStream;
  444. _st($4)._nextPutAll_("'!");
  445. _st($4)._lf();
  446. $5=_st($4)._lf();
  447. $5;
  448. };
  449. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  450. messageSends: ["ifFalse:", "nextPutAll:", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"]}),
  451. smalltalk.ChunkExporter);
  452. smalltalk.addMethod(
  453. smalltalk.method({
  454. selector: "exportMethod:of:on:",
  455. fn: function (aMethod,aClass,aStream){
  456. var self=this;
  457. return smalltalk.withContext(function($ctx1) {
  458. var $1,$2;
  459. $1=aStream;
  460. _st($1)._lf();
  461. _st($1)._lf();
  462. _st($1)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
  463. _st($1)._lf();
  464. $2=_st($1)._nextPutAll_("!");
  465. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:of:on:",{aMethod:aMethod,aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  466. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]}),
  467. smalltalk.ChunkExporter);
  468. smalltalk.addMethod(
  469. smalltalk.method({
  470. selector: "exportMethods:category:of:on:",
  471. fn: function (methods,category,aClass,aStream){
  472. var self=this;
  473. return smalltalk.withContext(function($ctx1) {
  474. var $1,$2,$3,$4;
  475. $1=aStream;
  476. _st($1)._nextPutAll_("!".__comma(self._classNameFor_(aClass)));
  477. $2=_st($1)._nextPutAll_(_st(" methodsFor: '".__comma(category)).__comma("'!"));
  478. _st(_st(methods)._sorted_((function(a,b){
  479. return smalltalk.withContext(function($ctx2) {
  480. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  481. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(each){
  482. return smalltalk.withContext(function($ctx2) {
  483. return self._exportMethod_of_on_(each,aClass,aStream);
  484. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  485. $3=aStream;
  486. _st($3)._nextPutAll_(" !");
  487. _st($3)._lf();
  488. $4=_st($3)._lf();
  489. return self}, function($ctx1) {$ctx1.fill(self,"exportMethods:category:of:on:",{methods:methods,category:category,aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  490. messageSends: ["nextPutAll:", ",", "classNameFor:", "do:", "exportMethod:of:on:", "sorted:", "<=", "selector", "lf"]}),
  491. smalltalk.ChunkExporter);
  492. smalltalk.addMethod(
  493. smalltalk.method({
  494. selector: "exportMethodsOf:on:",
  495. fn: function (aClass,aStream){
  496. var self=this;
  497. var map;
  498. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  499. return smalltalk.withContext(function($ctx1) {
  500. var $1;
  501. map=_st($Dictionary())._new();
  502. _st(aClass)._protocolsDo_((function(category,methods){
  503. return smalltalk.withContext(function($ctx2) {
  504. $1=_st(category)._match_("^\x5c*");
  505. if(! smalltalk.assert($1)){
  506. return _st(map)._at_put_(category,methods);
  507. };
  508. }, function($ctx2) {$ctx2.fillBlock({category:category,methods:methods},$ctx1)})}));
  509. _st(_st(_st(map)._keys())._sorted_((function(a,b){
  510. return smalltalk.withContext(function($ctx2) {
  511. return _st(a).__lt_eq(b);
  512. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(category){
  513. var methods;
  514. return smalltalk.withContext(function($ctx2) {
  515. methods=_st(map)._at_(category);
  516. methods;
  517. return self._exportMethods_category_of_on_(methods,category,aClass,aStream);
  518. }, function($ctx2) {$ctx2.fillBlock({category:category,methods:methods},$ctx1)})}));
  519. return self}, function($ctx1) {$ctx1.fill(self,"exportMethodsOf:on:",{aClass:aClass,aStream:aStream,map:map},smalltalk.ChunkExporter)})},
  520. messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "do:", "at:", "exportMethods:category:of:on:", "sorted:", "<=", "keys"]}),
  521. smalltalk.ChunkExporter);
  522. smalltalk.addMethod(
  523. smalltalk.method({
  524. selector: "exportPackageDefinitionOf:on:",
  525. fn: function (package_,aStream){
  526. var self=this;
  527. return smalltalk.withContext(function($ctx1) {
  528. var $1,$2;
  529. $1=aStream;
  530. _st($1)._nextPutAll_(_st("Smalltalk current createPackage: '".__comma(_st(package_)._name())).__comma("'!"));
  531. $2=_st($1)._lf();
  532. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{package_:package_,aStream:aStream},smalltalk.ChunkExporter)})},
  533. messageSends: ["nextPutAll:", ",", "name", "lf"]}),
  534. smalltalk.ChunkExporter);
  535. smalltalk.addMethod(
  536. smalltalk.method({
  537. selector: "exportPackageEpilogueOn:",
  538. fn: function (aStream){
  539. var self=this;
  540. return smalltalk.withContext(function($ctx1) {
  541. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOn:",{aStream:aStream},smalltalk.ChunkExporter)})},
  542. messageSends: []}),
  543. smalltalk.ChunkExporter);
  544. smalltalk.addMethod(
  545. smalltalk.method({
  546. selector: "exportPackageExtensionsOf:on:",
  547. fn: function (package_,aStream){
  548. var self=this;
  549. var name,map;
  550. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  551. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  552. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  553. return smalltalk.withContext(function($ctx1) {
  554. var $1;
  555. name=_st(package_)._name();
  556. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  557. return smalltalk.withContext(function($ctx2) {
  558. return _st([each,_st(each)._class()])._do_((function(aClass){
  559. return smalltalk.withContext(function($ctx3) {
  560. map=_st($Dictionary())._new();
  561. map;
  562. _st(aClass)._protocolsDo_((function(category,methods){
  563. return smalltalk.withContext(function($ctx4) {
  564. $1=_st(category)._match_("^\x5c*".__comma(name));
  565. if(smalltalk.assert($1)){
  566. return _st(map)._at_put_(category,methods);
  567. };
  568. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3)})}));
  569. return _st(_st(_st(map)._keys())._sorted_((function(a,b){
  570. return smalltalk.withContext(function($ctx4) {
  571. return _st(a).__lt_eq(b);
  572. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._do_((function(category){
  573. var methods;
  574. return smalltalk.withContext(function($ctx4) {
  575. methods=_st(map)._at_(category);
  576. methods;
  577. return self._exportMethods_category_of_on_(methods,category,aClass,aStream);
  578. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3)})}));
  579. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  580. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  581. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageExtensionsOf:on:",{package_:package_,aStream:aStream,name:name,map:map},smalltalk.ChunkExporter)})},
  582. messageSends: ["name", "do:", "new", "protocolsDo:", "ifTrue:", "at:put:", "match:", ",", "at:", "exportMethods:category:of:on:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"]}),
  583. smalltalk.ChunkExporter);
  584. smalltalk.addMethod(
  585. smalltalk.method({
  586. selector: "exportPackagePrologueOn:",
  587. fn: function (aStream){
  588. var self=this;
  589. return smalltalk.withContext(function($ctx1) {
  590. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOn:",{aStream:aStream},smalltalk.ChunkExporter)})},
  591. messageSends: []}),
  592. smalltalk.ChunkExporter);
  593. smalltalk.addClass('StrippedExporter', smalltalk.Exporter, [], 'Importer-Exporter');
  594. smalltalk.addMethod(
  595. smalltalk.method({
  596. selector: "exportDefinitionOf:on:",
  597. fn: function (aClass,aStream){
  598. var self=this;
  599. return smalltalk.withContext(function($ctx1) {
  600. var $1,$2,$3,$4;
  601. $1=aStream;
  602. _st($1)._nextPutAll_("smalltalk.addClass(");
  603. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  604. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  605. $2=_st($1)._nextPutAll_(", [");
  606. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  607. return smalltalk.withContext(function($ctx2) {
  608. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  609. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  610. return smalltalk.withContext(function($ctx2) {
  611. return _st(aStream)._nextPutAll_(", ");
  612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  613. $3=aStream;
  614. _st($3)._nextPutAll_("], '");
  615. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  616. $4=_st($3)._nextPutAll_(");");
  617. _st(aStream)._lf();
  618. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.StrippedExporter)})},
  619. messageSends: ["nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "lf"]}),
  620. smalltalk.StrippedExporter);
  621. smalltalk.addMethod(
  622. smalltalk.method({
  623. selector: "exportMethod:of:on:",
  624. fn: function (aMethod,aClass,aStream){
  625. var self=this;
  626. return smalltalk.withContext(function($ctx1) {
  627. var $1,$2;
  628. $1=aStream;
  629. _st($1)._nextPutAll_("smalltalk.addMethod(");
  630. _st($1)._lf();
  631. _st($1)._nextPutAll_("smalltalk.method({");
  632. _st($1)._lf();
  633. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  634. _st($1)._lf();
  635. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  636. _st($1)._lf();
  637. _st($1)._nextPutAll_("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript()));
  638. _st($1)._nextPutAll_("}),");
  639. _st($1)._lf();
  640. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(aClass)));
  641. _st($1)._nextPutAll_(");");
  642. _st($1)._lf();
  643. $2=_st($1)._lf();
  644. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:of:on:",{aMethod:aMethod,aClass:aClass,aStream:aStream},smalltalk.StrippedExporter)})},
  645. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "compiledSource", "fn", "messageSends", "classNameFor:"]}),
  646. smalltalk.StrippedExporter);
  647. smalltalk.addClass('Importer', smalltalk.Object, [], 'Importer-Exporter');
  648. smalltalk.addMethod(
  649. smalltalk.method({
  650. selector: "import:",
  651. fn: function (aStream){
  652. var self=this;
  653. var chunk,result,parser,lastEmpty;
  654. function $ChunkParser(){return smalltalk.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  655. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  656. return smalltalk.withContext(function($ctx1) {
  657. var $1,$2;
  658. parser=_st($ChunkParser())._on_(aStream);
  659. lastEmpty=false;
  660. _st((function(){
  661. return smalltalk.withContext(function($ctx2) {
  662. chunk=_st(parser)._nextChunk();
  663. chunk;
  664. return _st(chunk)._isNil();
  665. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  666. return smalltalk.withContext(function($ctx2) {
  667. $1=_st(chunk)._isEmpty();
  668. if(smalltalk.assert($1)){
  669. lastEmpty=true;
  670. return lastEmpty;
  671. } else {
  672. result=_st(_st($Compiler())._new())._evaluateExpression_(chunk);
  673. result;
  674. $2=lastEmpty;
  675. if(smalltalk.assert($2)){
  676. lastEmpty=false;
  677. lastEmpty;
  678. return _st(result)._scanFrom_(parser);
  679. };
  680. };
  681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  682. return self}, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},smalltalk.Importer)})},
  683. messageSends: ["on:", "whileFalse:", "ifTrue:ifFalse:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "isEmpty", "nextChunk", "isNil"]}),
  684. smalltalk.Importer);
  685. smalltalk.addClass('PackageHandler', smalltalk.Object, [], 'Importer-Exporter');
  686. smalltalk.addMethod(
  687. smalltalk.method({
  688. selector: "ajaxPutAt:data:",
  689. fn: function (aURL,aString){
  690. var self=this;
  691. return smalltalk.withContext(function($ctx1) {
  692. _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){
  693. return smalltalk.withContext(function($ctx2) {
  694. return self._error_(_st(_st(_st("Commiting ".__comma(aURL)).__comma(" failed with reason: \x22")).__comma(_st(xhr)._responseText())).__comma("\x22"));
  695. }, function($ctx2) {$ctx2.fillBlock({xhr:xhr},$ctx1)})}))]));
  696. return self}, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:",{aURL:aURL,aString:aString},smalltalk.PackageHandler)})},
  697. messageSends: ["ajax:options:", "->", "error:", ",", "responseText"]}),
  698. smalltalk.PackageHandler);
  699. smalltalk.addMethod(
  700. smalltalk.method({
  701. selector: "commit:",
  702. fn: function (aPackage){
  703. var self=this;
  704. return smalltalk.withContext(function($ctx1) {
  705. _st(self._commitChannels())._do_displayingProgress_((function(commitStrategyFactory){
  706. var fileContents,commitStrategy;
  707. return smalltalk.withContext(function($ctx2) {
  708. commitStrategy=_st(commitStrategyFactory)._value_(aPackage);
  709. commitStrategy;
  710. fileContents=_st(_st(commitStrategy)._key())._exportPackage_(_st(aPackage)._name());
  711. fileContents;
  712. return self._ajaxPutAt_data_(_st(commitStrategy)._value(),fileContents);
  713. }, function($ctx2) {$ctx2.fillBlock({commitStrategyFactory:commitStrategyFactory,fileContents:fileContents,commitStrategy:commitStrategy},$ctx1)})}),"Committing package ".__comma(_st(aPackage)._name()));
  714. return self}, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  715. messageSends: ["do:displayingProgress:", "value:", "exportPackage:", "name", "key", "ajaxPutAt:data:", "value", ",", "commitChannels"]}),
  716. smalltalk.PackageHandler);
  717. smalltalk.addMethod(
  718. smalltalk.method({
  719. selector: "classRegisteredFor:",
  720. fn: function (aString){
  721. var self=this;
  722. function $LegacyPackageHandler(){return smalltalk.LegacyPackageHandler||(typeof LegacyPackageHandler=="undefined"?nil:LegacyPackageHandler)}
  723. return smalltalk.withContext(function($ctx1) {
  724. var $1;
  725. $1=$LegacyPackageHandler();
  726. return $1;
  727. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},smalltalk.PackageHandler.klass)})},
  728. messageSends: []}),
  729. smalltalk.PackageHandler.klass);
  730. smalltalk.addMethod(
  731. smalltalk.method({
  732. selector: "for:",
  733. fn: function (aString){
  734. var self=this;
  735. return smalltalk.withContext(function($ctx1) {
  736. var $1;
  737. $1=_st(self._classRegisteredFor_(aString))._new();
  738. return $1;
  739. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},smalltalk.PackageHandler.klass)})},
  740. messageSends: ["new", "classRegisteredFor:"]}),
  741. smalltalk.PackageHandler.klass);
  742. smalltalk.addClass('LegacyPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
  743. smalltalk.addMethod(
  744. smalltalk.method({
  745. selector: "commitChannels",
  746. fn: function (){
  747. var self=this;
  748. function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  749. function $StrippedExporter(){return smalltalk.StrippedExporter||(typeof StrippedExporter=="undefined"?nil:StrippedExporter)}
  750. function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  751. return smalltalk.withContext(function($ctx1) {
  752. var $1;
  753. $1=[(function(pkg){
  754. return smalltalk.withContext(function($ctx2) {
  755. return _st(_st($Exporter())._new()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".js"));
  756. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  757. return smalltalk.withContext(function($ctx2) {
  758. return _st(_st($StrippedExporter())._new()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".deploy.js"));
  759. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  760. return smalltalk.withContext(function($ctx2) {
  761. return _st(_st($ChunkExporter())._new()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathSt()).__comma("/")).__comma(_st(pkg)._name())).__comma(".st"));
  762. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})})];
  763. return $1;
  764. }, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.LegacyPackageHandler)})},
  765. messageSends: ["->", ",", "name", "commitPathJs", "new", "commitPathSt"]}),
  766. smalltalk.LegacyPackageHandler);
  767. smalltalk.addMethod(
  768. smalltalk.method({
  769. selector: "commitPathJsFor:",
  770. fn: function (aPackage){
  771. var self=this;
  772. return smalltalk.withContext(function($ctx1) {
  773. var $1;
  774. $1=_st(self._class())._defaultCommitPathJs();
  775. return $1;
  776. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
  777. messageSends: ["defaultCommitPathJs", "class"]}),
  778. smalltalk.LegacyPackageHandler);
  779. smalltalk.addMethod(
  780. smalltalk.method({
  781. selector: "commitPathStFor:",
  782. fn: function (aPackage){
  783. var self=this;
  784. return smalltalk.withContext(function($ctx1) {
  785. var $1;
  786. $1=_st(self._class())._defaultCommitPathSt();
  787. return $1;
  788. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
  789. messageSends: ["defaultCommitPathSt", "class"]}),
  790. smalltalk.LegacyPackageHandler);
  791. smalltalk.addMethod(
  792. smalltalk.method({
  793. selector: "loadPackage:prefix:",
  794. fn: function (packageName,aString){
  795. var self=this;
  796. var url;
  797. return smalltalk.withContext(function($ctx1) {
  798. var $1;
  799. url=_st(_st(_st("/".__comma(aString)).__comma("/js/")).__comma(packageName)).__comma(".js");
  800. _st(jQuery)._ajax_options_(url,smalltalk.HashedCollection._from_(["type".__minus_gt("GET"),"dataType".__minus_gt("script"),"complete".__minus_gt((function(jqXHR,textStatus){
  801. return smalltalk.withContext(function($ctx2) {
  802. $1=_st(_st(jqXHR)._readyState()).__eq((4));
  803. if(smalltalk.assert($1)){
  804. return self._setupPackageNamed_prefix_(packageName,aString);
  805. };
  806. }, function($ctx2) {$ctx2.fillBlock({jqXHR:jqXHR,textStatus:textStatus},$ctx1)})})),"error".__minus_gt((function(){
  807. return smalltalk.withContext(function($ctx2) {
  808. return _st(window)._alert_("Could not load package at: ".__comma(url));
  809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))]));
  810. return self}, function($ctx1) {$ctx1.fill(self,"loadPackage:prefix:",{packageName:packageName,aString:aString,url:url},smalltalk.LegacyPackageHandler)})},
  811. messageSends: [",", "ajax:options:", "->", "ifTrue:", "setupPackageNamed:prefix:", "=", "readyState", "alert:"]}),
  812. smalltalk.LegacyPackageHandler);
  813. smalltalk.addMethod(
  814. smalltalk.method({
  815. selector: "loadPackages:prefix:",
  816. fn: function (aCollection,aString){
  817. var self=this;
  818. return smalltalk.withContext(function($ctx1) {
  819. _st(aCollection)._do_((function(each){
  820. return smalltalk.withContext(function($ctx2) {
  821. return self._loadPackage_prefix_(each,aString);
  822. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  823. return self}, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler)})},
  824. messageSends: ["do:", "loadPackage:prefix:"]}),
  825. smalltalk.LegacyPackageHandler);
  826. smalltalk.addMethod(
  827. smalltalk.method({
  828. selector: "setupPackageNamed:prefix:",
  829. fn: function (packageName,aString){
  830. var self=this;
  831. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  832. return smalltalk.withContext(function($ctx1) {
  833. var $1,$2;
  834. $1=_st($Package())._named_(packageName);
  835. _st($1)._setupClasses();
  836. _st($1)._commitPathJs_(_st("/".__comma(aString)).__comma("/js"));
  837. $2=_st($1)._commitPathSt_(_st("/".__comma(aString)).__comma("/st"));
  838. return self}, function($ctx1) {$ctx1.fill(self,"setupPackageNamed:prefix:",{packageName:packageName,aString:aString},smalltalk.LegacyPackageHandler)})},
  839. messageSends: ["setupClasses", "named:", "commitPathJs:", ",", "commitPathSt:"]}),
  840. smalltalk.LegacyPackageHandler);
  841. smalltalk.LegacyPackageHandler.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  842. smalltalk.addMethod(
  843. smalltalk.method({
  844. selector: "commitPathsFromLoader",
  845. fn: function (){
  846. var self=this;
  847. return smalltalk.withContext(function($ctx1) {
  848. var commitPath = typeof amber !== 'undefined' && amber.commitPath;
  849. if (!commitPath) return;
  850. if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);
  851. if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);
  852. ;
  853. return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.LegacyPackageHandler.klass)})},
  854. messageSends: []}),
  855. smalltalk.LegacyPackageHandler.klass);
  856. smalltalk.addMethod(
  857. smalltalk.method({
  858. selector: "defaultCommitPathJs",
  859. fn: function (){
  860. var self=this;
  861. return smalltalk.withContext(function($ctx1) {
  862. var $2,$1;
  863. $2=self["@defaultCommitPathJs"];
  864. if(($receiver = $2) == nil || $receiver == undefined){
  865. self["@defaultCommitPathJs"]="js";
  866. $1=self["@defaultCommitPathJs"];
  867. } else {
  868. $1=$2;
  869. };
  870. return $1;
  871. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs",{},smalltalk.LegacyPackageHandler.klass)})},
  872. messageSends: ["ifNil:"]}),
  873. smalltalk.LegacyPackageHandler.klass);
  874. smalltalk.addMethod(
  875. smalltalk.method({
  876. selector: "defaultCommitPathJs:",
  877. fn: function (aString){
  878. var self=this;
  879. return smalltalk.withContext(function($ctx1) {
  880. self["@defaultCommitPathJs"]=aString;
  881. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  882. messageSends: []}),
  883. smalltalk.LegacyPackageHandler.klass);
  884. smalltalk.addMethod(
  885. smalltalk.method({
  886. selector: "defaultCommitPathSt",
  887. fn: function (){
  888. var self=this;
  889. return smalltalk.withContext(function($ctx1) {
  890. var $2,$1;
  891. $2=self["@defaultCommitPathSt"];
  892. if(($receiver = $2) == nil || $receiver == undefined){
  893. self["@defaultCommitPathSt"]="st";
  894. $1=self["@defaultCommitPathSt"];
  895. } else {
  896. $1=$2;
  897. };
  898. return $1;
  899. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt",{},smalltalk.LegacyPackageHandler.klass)})},
  900. messageSends: ["ifNil:"]}),
  901. smalltalk.LegacyPackageHandler.klass);
  902. smalltalk.addMethod(
  903. smalltalk.method({
  904. selector: "defaultCommitPathSt:",
  905. fn: function (aString){
  906. var self=this;
  907. return smalltalk.withContext(function($ctx1) {
  908. self["@defaultCommitPathSt"]=aString;
  909. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  910. messageSends: []}),
  911. smalltalk.LegacyPackageHandler.klass);
  912. smalltalk.addMethod(
  913. smalltalk.method({
  914. selector: "initialize",
  915. fn: function (){
  916. var self=this;
  917. return smalltalk.withContext(function($ctx1) {
  918. smalltalk.LegacyPackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  919. self._commitPathsFromLoader();
  920. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.LegacyPackageHandler.klass)})},
  921. messageSends: ["initialize", "commitPathsFromLoader"]}),
  922. smalltalk.LegacyPackageHandler.klass);
  923. smalltalk.addMethod(
  924. smalltalk.method({
  925. selector: "loadPackages:prefix:",
  926. fn: function (aCollection,aString){
  927. var self=this;
  928. return smalltalk.withContext(function($ctx1) {
  929. var $1;
  930. $1=_st(self._new())._loadPackages_prefix_(aCollection,aString);
  931. return $1;
  932. }, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  933. messageSends: ["loadPackages:prefix:", "new"]}),
  934. smalltalk.LegacyPackageHandler.klass);
  935. smalltalk.addMethod(
  936. smalltalk.method({
  937. selector: "resetCommitPaths",
  938. fn: function (){
  939. var self=this;
  940. return smalltalk.withContext(function($ctx1) {
  941. self["@defaultCommitPathJs"]=nil;
  942. self["@defaultCommitPathSt"]=nil;
  943. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.LegacyPackageHandler.klass)})},
  944. messageSends: []}),
  945. smalltalk.LegacyPackageHandler.klass);
  946. smalltalk.addMethod(
  947. smalltalk.method({
  948. selector: "commit",
  949. fn: function (){
  950. var self=this;
  951. return smalltalk.withContext(function($ctx1) {
  952. var $1;
  953. $1=_st(self._transport())._commit_(self);
  954. return $1;
  955. }, function($ctx1) {$ctx1.fill(self,"commit",{},smalltalk.Package)})},
  956. messageSends: ["commit:", "transport"]}),
  957. smalltalk.Package);
  958. smalltalk.addMethod(
  959. smalltalk.method({
  960. selector: "commitPathJs",
  961. fn: function (){
  962. var self=this;
  963. return smalltalk.withContext(function($ctx1) {
  964. var $3,$2,$1;
  965. $3=self["@extension"];
  966. if(($receiver = $3) == nil || $receiver == undefined){
  967. self["@extension"]=smalltalk.HashedCollection._from_([]);
  968. $2=self["@extension"];
  969. } else {
  970. $2=$3;
  971. };
  972. $1=_st($2)._at_ifAbsentPut_("commitPathJs",(function(){
  973. return smalltalk.withContext(function($ctx2) {
  974. return _st(self._transport())._commitPathJsFor_(self);
  975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  976. return $1;
  977. }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
  978. messageSends: ["at:ifAbsentPut:", "commitPathJsFor:", "transport", "ifNil:"]}),
  979. smalltalk.Package);
  980. smalltalk.addMethod(
  981. smalltalk.method({
  982. selector: "commitPathJs:",
  983. fn: function (aString){
  984. var self=this;
  985. return smalltalk.withContext(function($ctx1) {
  986. var $3,$2,$1;
  987. $3=self["@extension"];
  988. if(($receiver = $3) == nil || $receiver == undefined){
  989. self["@extension"]=smalltalk.HashedCollection._from_([]);
  990. $2=self["@extension"];
  991. } else {
  992. $2=$3;
  993. };
  994. $1=_st($2)._at_put_("commitPathJs",aString);
  995. return $1;
  996. }, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
  997. messageSends: ["at:put:", "ifNil:"]}),
  998. smalltalk.Package);
  999. smalltalk.addMethod(
  1000. smalltalk.method({
  1001. selector: "commitPathSt",
  1002. fn: function (){
  1003. var self=this;
  1004. return smalltalk.withContext(function($ctx1) {
  1005. var $3,$2,$1;
  1006. $3=self["@extension"];
  1007. if(($receiver = $3) == nil || $receiver == undefined){
  1008. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1009. $2=self["@extension"];
  1010. } else {
  1011. $2=$3;
  1012. };
  1013. $1=_st($2)._at_ifAbsentPut_("commitPathSt",(function(){
  1014. return smalltalk.withContext(function($ctx2) {
  1015. return _st(self._transport())._commitPathStFor_(self);
  1016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1017. return $1;
  1018. }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
  1019. messageSends: ["at:ifAbsentPut:", "commitPathStFor:", "transport", "ifNil:"]}),
  1020. smalltalk.Package);
  1021. smalltalk.addMethod(
  1022. smalltalk.method({
  1023. selector: "commitPathSt:",
  1024. fn: function (aString){
  1025. var self=this;
  1026. return smalltalk.withContext(function($ctx1) {
  1027. var $3,$2,$1;
  1028. $3=self["@extension"];
  1029. if(($receiver = $3) == nil || $receiver == undefined){
  1030. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1031. $2=self["@extension"];
  1032. } else {
  1033. $2=$3;
  1034. };
  1035. $1=_st($2)._at_put_("commitPathSt",aString);
  1036. return $1;
  1037. }, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
  1038. messageSends: ["at:put:", "ifNil:"]}),
  1039. smalltalk.Package);
  1040. smalltalk.addMethod(
  1041. smalltalk.method({
  1042. selector: "transport",
  1043. fn: function (){
  1044. var self=this;
  1045. function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
  1046. return smalltalk.withContext(function($ctx1) {
  1047. var $1;
  1048. $1=_st($PackageHandler())._for_(self._transportType());
  1049. return $1;
  1050. }, function($ctx1) {$ctx1.fill(self,"transport",{},smalltalk.Package)})},
  1051. messageSends: ["for:", "transportType"]}),
  1052. smalltalk.Package);
  1053. smalltalk.addMethod(
  1054. smalltalk.method({
  1055. selector: "transportType",
  1056. fn: function (){
  1057. var self=this;
  1058. return smalltalk.withContext(function($ctx1) {
  1059. return (self.transport && self.transport.type) || 'unknown';;
  1060. return self}, function($ctx1) {$ctx1.fill(self,"transportType",{},smalltalk.Package)})},
  1061. messageSends: []}),
  1062. smalltalk.Package);
  1063. });