Importer-Exporter.deploy.js 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166
  1. (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. self._exportPackagePrologueOn_(stream);
  258. return _st((function(){
  259. return smalltalk.withContext(function($ctx3) {
  260. package_=_st(_st($Smalltalk())._current())._packageAt_(packageName);
  261. package_;
  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:", "exportPackagePrologueOn:", "ensure:", "exportPackageEpilogueOn:", "packageAt:", "current", "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_("})(global_smalltalk,global_nil,global__st);");
  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: "exportPackagePrologueOn:",
  337. fn: function (aStream){
  338. var self=this;
  339. return smalltalk.withContext(function($ctx1) {
  340. var $1,$2;
  341. $1=aStream;
  342. _st($1)._nextPutAll_("(function(smalltalk,nil,_st){");
  343. $2=_st($1)._lf();
  344. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOn:",{aStream:aStream},smalltalk.Exporter)})},
  345. messageSends: ["nextPutAll:", "lf"]}),
  346. smalltalk.Exporter);
  347. smalltalk.addClass('ChunkExporter', smalltalk.Exporter, [], 'Importer-Exporter');
  348. smalltalk.addMethod(
  349. smalltalk.method({
  350. selector: "chunkEscape:",
  351. fn: function (aString){
  352. var self=this;
  353. return smalltalk.withContext(function($ctx1) {
  354. var $1;
  355. $1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
  356. return $1;
  357. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},smalltalk.ChunkExporter)})},
  358. messageSends: ["trimBoth", "replace:with:"]}),
  359. smalltalk.ChunkExporter);
  360. smalltalk.addMethod(
  361. smalltalk.method({
  362. selector: "classNameFor:",
  363. fn: function (aClass){
  364. var self=this;
  365. return smalltalk.withContext(function($ctx1) {
  366. var $2,$3,$1;
  367. $2=_st(aClass)._isMetaclass();
  368. if(smalltalk.assert($2)){
  369. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(" class");
  370. } else {
  371. $3=_st(aClass)._isNil();
  372. if(smalltalk.assert($3)){
  373. $1="nil";
  374. } else {
  375. $1=_st(aClass)._name();
  376. };
  377. };
  378. return $1;
  379. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.ChunkExporter)})},
  380. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"]}),
  381. smalltalk.ChunkExporter);
  382. smalltalk.addMethod(
  383. smalltalk.method({
  384. selector: "exportDefinitionOf:on:",
  385. fn: function (aClass,aStream){
  386. var self=this;
  387. return smalltalk.withContext(function($ctx1) {
  388. var $1,$2,$3,$4,$5,$6,$7;
  389. $1=aStream;
  390. _st($1)._nextPutAll_(self._classNameFor_(_st(aClass)._superclass()));
  391. _st($1)._nextPutAll_(" subclass: #".__comma(self._classNameFor_(aClass)));
  392. _st($1)._lf();
  393. _st($1)._tab();
  394. $2=_st($1)._nextPutAll_("instanceVariableNames: '");
  395. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  396. return smalltalk.withContext(function($ctx2) {
  397. return _st(aStream)._nextPutAll_(each);
  398. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  399. return smalltalk.withContext(function($ctx2) {
  400. return _st(aStream)._nextPutAll_(" ");
  401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  402. $3=aStream;
  403. _st($3)._nextPutAll_("'");
  404. _st($3)._lf();
  405. _st($3)._tab();
  406. _st($3)._nextPutAll_(_st("package: '".__comma(_st(aClass)._category())).__comma("'!"));
  407. $4=_st($3)._lf();
  408. $5=_st(_st(aClass)._comment())._notEmpty();
  409. if(smalltalk.assert($5)){
  410. $6=aStream;
  411. _st($6)._nextPutAll_(_st("!".__comma(self._classNameFor_(aClass))).__comma(" commentStamp!"));
  412. _st($6)._lf();
  413. _st($6)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
  414. $7=_st($6)._lf();
  415. $7;
  416. };
  417. _st(aStream)._lf();
  418. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  419. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "chunkEscape:", "comment", "notEmpty"]}),
  420. smalltalk.ChunkExporter);
  421. smalltalk.addMethod(
  422. smalltalk.method({
  423. selector: "exportMetaDefinitionOf:on:",
  424. fn: function (aClass,aStream){
  425. var self=this;
  426. return smalltalk.withContext(function($ctx1) {
  427. var $1,$2,$3,$4,$5;
  428. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  429. if(! smalltalk.assert($1)){
  430. $2=aStream;
  431. _st($2)._nextPutAll_(self._classNameFor_(_st(aClass)._class()));
  432. $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
  433. $3;
  434. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  435. return smalltalk.withContext(function($ctx2) {
  436. return _st(aStream)._nextPutAll_(each);
  437. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  438. return smalltalk.withContext(function($ctx2) {
  439. return _st(aStream)._nextPutAll_(" ");
  440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  441. $4=aStream;
  442. _st($4)._nextPutAll_("'!");
  443. _st($4)._lf();
  444. $5=_st($4)._lf();
  445. $5;
  446. };
  447. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  448. messageSends: ["ifFalse:", "nextPutAll:", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"]}),
  449. smalltalk.ChunkExporter);
  450. smalltalk.addMethod(
  451. smalltalk.method({
  452. selector: "exportMethod:of:on:",
  453. fn: function (aMethod,aClass,aStream){
  454. var self=this;
  455. return smalltalk.withContext(function($ctx1) {
  456. var $1,$2;
  457. $1=aStream;
  458. _st($1)._lf();
  459. _st($1)._lf();
  460. _st($1)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
  461. _st($1)._lf();
  462. $2=_st($1)._nextPutAll_("!");
  463. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:of:on:",{aMethod:aMethod,aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  464. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]}),
  465. smalltalk.ChunkExporter);
  466. smalltalk.addMethod(
  467. smalltalk.method({
  468. selector: "exportMethods:category:of:on:",
  469. fn: function (methods,category,aClass,aStream){
  470. var self=this;
  471. return smalltalk.withContext(function($ctx1) {
  472. var $1,$2,$3,$4;
  473. $1=aStream;
  474. _st($1)._nextPutAll_("!".__comma(self._classNameFor_(aClass)));
  475. $2=_st($1)._nextPutAll_(_st(" methodsFor: '".__comma(category)).__comma("'!"));
  476. _st(_st(methods)._sorted_((function(a,b){
  477. return smalltalk.withContext(function($ctx2) {
  478. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  479. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(each){
  480. return smalltalk.withContext(function($ctx2) {
  481. return self._exportMethod_of_on_(each,aClass,aStream);
  482. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  483. $3=aStream;
  484. _st($3)._nextPutAll_(" !");
  485. _st($3)._lf();
  486. $4=_st($3)._lf();
  487. return self}, function($ctx1) {$ctx1.fill(self,"exportMethods:category:of:on:",{methods:methods,category:category,aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  488. messageSends: ["nextPutAll:", ",", "classNameFor:", "do:", "exportMethod:of:on:", "sorted:", "<=", "selector", "lf"]}),
  489. smalltalk.ChunkExporter);
  490. smalltalk.addMethod(
  491. smalltalk.method({
  492. selector: "exportMethodsOf:on:",
  493. fn: function (aClass,aStream){
  494. var self=this;
  495. var map;
  496. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  497. return smalltalk.withContext(function($ctx1) {
  498. var $1;
  499. map=_st($Dictionary())._new();
  500. _st(aClass)._protocolsDo_((function(category,methods){
  501. return smalltalk.withContext(function($ctx2) {
  502. $1=_st(category)._match_("^\x5c*");
  503. if(! smalltalk.assert($1)){
  504. return _st(map)._at_put_(category,methods);
  505. };
  506. }, function($ctx2) {$ctx2.fillBlock({category:category,methods:methods},$ctx1)})}));
  507. _st(_st(_st(map)._keys())._sorted_((function(a,b){
  508. return smalltalk.withContext(function($ctx2) {
  509. return _st(a).__lt_eq(b);
  510. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(category){
  511. var methods;
  512. return smalltalk.withContext(function($ctx2) {
  513. methods=_st(map)._at_(category);
  514. methods;
  515. return self._exportMethods_category_of_on_(methods,category,aClass,aStream);
  516. }, function($ctx2) {$ctx2.fillBlock({category:category,methods:methods},$ctx1)})}));
  517. return self}, function($ctx1) {$ctx1.fill(self,"exportMethodsOf:on:",{aClass:aClass,aStream:aStream,map:map},smalltalk.ChunkExporter)})},
  518. messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "do:", "at:", "exportMethods:category:of:on:", "sorted:", "<=", "keys"]}),
  519. smalltalk.ChunkExporter);
  520. smalltalk.addMethod(
  521. smalltalk.method({
  522. selector: "exportPackageDefinitionOf:on:",
  523. fn: function (package_,aStream){
  524. var self=this;
  525. return smalltalk.withContext(function($ctx1) {
  526. var $1,$2;
  527. $1=aStream;
  528. _st($1)._nextPutAll_(_st("Smalltalk current createPackage: '".__comma(_st(package_)._name())).__comma("'!"));
  529. $2=_st($1)._lf();
  530. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{package_:package_,aStream:aStream},smalltalk.ChunkExporter)})},
  531. messageSends: ["nextPutAll:", ",", "name", "lf"]}),
  532. smalltalk.ChunkExporter);
  533. smalltalk.addMethod(
  534. smalltalk.method({
  535. selector: "exportPackageEpilogueOn:",
  536. fn: function (aStream){
  537. var self=this;
  538. return smalltalk.withContext(function($ctx1) {
  539. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOn:",{aStream:aStream},smalltalk.ChunkExporter)})},
  540. messageSends: []}),
  541. smalltalk.ChunkExporter);
  542. smalltalk.addMethod(
  543. smalltalk.method({
  544. selector: "exportPackageExtensionsOf:on:",
  545. fn: function (package_,aStream){
  546. var self=this;
  547. var name,map;
  548. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  549. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  550. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  551. return smalltalk.withContext(function($ctx1) {
  552. var $1;
  553. name=_st(package_)._name();
  554. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  555. return smalltalk.withContext(function($ctx2) {
  556. return _st([each,_st(each)._class()])._do_((function(aClass){
  557. return smalltalk.withContext(function($ctx3) {
  558. map=_st($Dictionary())._new();
  559. map;
  560. _st(aClass)._protocolsDo_((function(category,methods){
  561. return smalltalk.withContext(function($ctx4) {
  562. $1=_st(category)._match_("^\x5c*".__comma(name));
  563. if(smalltalk.assert($1)){
  564. return _st(map)._at_put_(category,methods);
  565. };
  566. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3)})}));
  567. return _st(_st(_st(map)._keys())._sorted_((function(a,b){
  568. return smalltalk.withContext(function($ctx4) {
  569. return _st(a).__lt_eq(b);
  570. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._do_((function(category){
  571. var methods;
  572. return smalltalk.withContext(function($ctx4) {
  573. methods=_st(map)._at_(category);
  574. methods;
  575. return self._exportMethods_category_of_on_(methods,category,aClass,aStream);
  576. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3)})}));
  577. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  578. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  579. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageExtensionsOf:on:",{package_:package_,aStream:aStream,name:name,map:map},smalltalk.ChunkExporter)})},
  580. messageSends: ["name", "do:", "new", "protocolsDo:", "ifTrue:", "at:put:", "match:", ",", "at:", "exportMethods:category:of:on:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"]}),
  581. smalltalk.ChunkExporter);
  582. smalltalk.addMethod(
  583. smalltalk.method({
  584. selector: "exportPackagePrologueOn:",
  585. fn: function (aStream){
  586. var self=this;
  587. return smalltalk.withContext(function($ctx1) {
  588. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOn:",{aStream:aStream},smalltalk.ChunkExporter)})},
  589. messageSends: []}),
  590. smalltalk.ChunkExporter);
  591. smalltalk.addClass('StrippedExporter', smalltalk.Exporter, [], 'Importer-Exporter');
  592. smalltalk.addMethod(
  593. smalltalk.method({
  594. selector: "exportDefinitionOf:on:",
  595. fn: function (aClass,aStream){
  596. var self=this;
  597. return smalltalk.withContext(function($ctx1) {
  598. var $1,$2,$3,$4;
  599. $1=aStream;
  600. _st($1)._nextPutAll_("smalltalk.addClass(");
  601. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  602. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  603. $2=_st($1)._nextPutAll_(", [");
  604. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  605. return smalltalk.withContext(function($ctx2) {
  606. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  607. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  608. return smalltalk.withContext(function($ctx2) {
  609. return _st(aStream)._nextPutAll_(", ");
  610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  611. $3=aStream;
  612. _st($3)._nextPutAll_("], '");
  613. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  614. $4=_st($3)._nextPutAll_(");");
  615. _st(aStream)._lf();
  616. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.StrippedExporter)})},
  617. messageSends: ["nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "lf"]}),
  618. smalltalk.StrippedExporter);
  619. smalltalk.addMethod(
  620. smalltalk.method({
  621. selector: "exportMethod:of:on:",
  622. fn: function (aMethod,aClass,aStream){
  623. var self=this;
  624. return smalltalk.withContext(function($ctx1) {
  625. var $1,$2;
  626. $1=aStream;
  627. _st($1)._nextPutAll_("smalltalk.addMethod(");
  628. _st($1)._lf();
  629. _st($1)._nextPutAll_("smalltalk.method({");
  630. _st($1)._lf();
  631. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  632. _st($1)._lf();
  633. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  634. _st($1)._lf();
  635. _st($1)._nextPutAll_("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript()));
  636. _st($1)._nextPutAll_("}),");
  637. _st($1)._lf();
  638. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(aClass)));
  639. _st($1)._nextPutAll_(");");
  640. _st($1)._lf();
  641. $2=_st($1)._lf();
  642. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:of:on:",{aMethod:aMethod,aClass:aClass,aStream:aStream},smalltalk.StrippedExporter)})},
  643. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "compiledSource", "fn", "messageSends", "classNameFor:"]}),
  644. smalltalk.StrippedExporter);
  645. smalltalk.addClass('Importer', smalltalk.Object, [], 'Importer-Exporter');
  646. smalltalk.addMethod(
  647. smalltalk.method({
  648. selector: "import:",
  649. fn: function (aStream){
  650. var self=this;
  651. var chunk,result,parser,lastEmpty;
  652. function $ChunkParser(){return smalltalk.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  653. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  654. return smalltalk.withContext(function($ctx1) {
  655. var $1,$2;
  656. parser=_st($ChunkParser())._on_(aStream);
  657. lastEmpty=false;
  658. _st((function(){
  659. return smalltalk.withContext(function($ctx2) {
  660. chunk=_st(parser)._nextChunk();
  661. chunk;
  662. return _st(chunk)._isNil();
  663. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  664. return smalltalk.withContext(function($ctx2) {
  665. $1=_st(chunk)._isEmpty();
  666. if(smalltalk.assert($1)){
  667. lastEmpty=true;
  668. return lastEmpty;
  669. } else {
  670. result=_st(_st($Compiler())._new())._evaluateExpression_(chunk);
  671. result;
  672. $2=lastEmpty;
  673. if(smalltalk.assert($2)){
  674. lastEmpty=false;
  675. lastEmpty;
  676. return _st(result)._scanFrom_(parser);
  677. };
  678. };
  679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  680. return self}, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},smalltalk.Importer)})},
  681. messageSends: ["on:", "whileFalse:", "ifTrue:ifFalse:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "isEmpty", "nextChunk", "isNil"]}),
  682. smalltalk.Importer);
  683. smalltalk.addClass('PackageHandler', smalltalk.Object, [], 'Importer-Exporter');
  684. smalltalk.addMethod(
  685. smalltalk.method({
  686. selector: "ajaxPutAt:data:",
  687. fn: function (aURL,aString){
  688. var self=this;
  689. return smalltalk.withContext(function($ctx1) {
  690. _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){
  691. return smalltalk.withContext(function($ctx2) {
  692. return self._error_(_st(_st(_st("Commiting ".__comma(aURL)).__comma(" failed with reason: \x22")).__comma(_st(xhr)._responseText())).__comma("\x22"));
  693. }, function($ctx2) {$ctx2.fillBlock({xhr:xhr},$ctx1)})}))]));
  694. return self}, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:",{aURL:aURL,aString:aString},smalltalk.PackageHandler)})},
  695. messageSends: ["ajax:options:", "->", "error:", ",", "responseText"]}),
  696. smalltalk.PackageHandler);
  697. smalltalk.addMethod(
  698. smalltalk.method({
  699. selector: "commit:",
  700. fn: function (aPackage){
  701. var self=this;
  702. return smalltalk.withContext(function($ctx1) {
  703. _st(self._commitChannels())._do_displayingProgress_((function(commitStrategyFactory){
  704. var fileContents,commitStrategy;
  705. return smalltalk.withContext(function($ctx2) {
  706. commitStrategy=_st(commitStrategyFactory)._value_(aPackage);
  707. commitStrategy;
  708. fileContents=_st(_st(commitStrategy)._key())._exportPackage_(_st(aPackage)._name());
  709. fileContents;
  710. return self._ajaxPutAt_data_(_st(commitStrategy)._value(),fileContents);
  711. }, function($ctx2) {$ctx2.fillBlock({commitStrategyFactory:commitStrategyFactory,fileContents:fileContents,commitStrategy:commitStrategy},$ctx1)})}),"Committing package ".__comma(_st(aPackage)._name()));
  712. return self}, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  713. messageSends: ["do:displayingProgress:", "value:", "exportPackage:", "name", "key", "ajaxPutAt:data:", "value", ",", "commitChannels"]}),
  714. smalltalk.PackageHandler);
  715. smalltalk.PackageHandler.klass.iVarNames = ['registry'];
  716. smalltalk.addMethod(
  717. smalltalk.method({
  718. selector: "classRegisteredFor:",
  719. fn: function (aString){
  720. var self=this;
  721. return smalltalk.withContext(function($ctx1) {
  722. var $1;
  723. $1=_st(self["@registry"])._at_(aString);
  724. return $1;
  725. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},smalltalk.PackageHandler.klass)})},
  726. messageSends: ["at:"]}),
  727. smalltalk.PackageHandler.klass);
  728. smalltalk.addMethod(
  729. smalltalk.method({
  730. selector: "for:",
  731. fn: function (aString){
  732. var self=this;
  733. return smalltalk.withContext(function($ctx1) {
  734. var $1;
  735. $1=_st(self._classRegisteredFor_(aString))._new();
  736. return $1;
  737. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},smalltalk.PackageHandler.klass)})},
  738. messageSends: ["new", "classRegisteredFor:"]}),
  739. smalltalk.PackageHandler.klass);
  740. smalltalk.addMethod(
  741. smalltalk.method({
  742. selector: "initialize",
  743. fn: function (){
  744. var self=this;
  745. return smalltalk.withContext(function($ctx1) {
  746. smalltalk.PackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  747. self["@registry"]=smalltalk.HashedCollection._from_([]);
  748. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.PackageHandler.klass)})},
  749. messageSends: ["initialize"]}),
  750. smalltalk.PackageHandler.klass);
  751. smalltalk.addMethod(
  752. smalltalk.method({
  753. selector: "register:for:",
  754. fn: function (aClass,aString){
  755. var self=this;
  756. return smalltalk.withContext(function($ctx1) {
  757. _st(self["@registry"])._at_put_(aString,aClass);
  758. return self}, function($ctx1) {$ctx1.fill(self,"register:for:",{aClass:aClass,aString:aString},smalltalk.PackageHandler.klass)})},
  759. messageSends: ["at:put:"]}),
  760. smalltalk.PackageHandler.klass);
  761. smalltalk.addMethod(
  762. smalltalk.method({
  763. selector: "registerFor:",
  764. fn: function (aString){
  765. var self=this;
  766. function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
  767. return smalltalk.withContext(function($ctx1) {
  768. _st($PackageHandler())._register_for_(self,aString);
  769. return self}, function($ctx1) {$ctx1.fill(self,"registerFor:",{aString:aString},smalltalk.PackageHandler.klass)})},
  770. messageSends: ["register:for:"]}),
  771. smalltalk.PackageHandler.klass);
  772. smalltalk.addClass('LegacyPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
  773. smalltalk.addMethod(
  774. smalltalk.method({
  775. selector: "commitChannels",
  776. fn: function (){
  777. var self=this;
  778. function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  779. function $StrippedExporter(){return smalltalk.StrippedExporter||(typeof StrippedExporter=="undefined"?nil:StrippedExporter)}
  780. function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  781. return smalltalk.withContext(function($ctx1) {
  782. var $1;
  783. $1=[(function(pkg){
  784. return smalltalk.withContext(function($ctx2) {
  785. return _st(_st($Exporter())._new()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".js"));
  786. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  787. return smalltalk.withContext(function($ctx2) {
  788. return _st(_st($StrippedExporter())._new()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".deploy.js"));
  789. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  790. return smalltalk.withContext(function($ctx2) {
  791. return _st(_st($ChunkExporter())._new()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathSt()).__comma("/")).__comma(_st(pkg)._name())).__comma(".st"));
  792. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})})];
  793. return $1;
  794. }, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.LegacyPackageHandler)})},
  795. messageSends: ["->", ",", "name", "commitPathJs", "new", "commitPathSt"]}),
  796. smalltalk.LegacyPackageHandler);
  797. smalltalk.addMethod(
  798. smalltalk.method({
  799. selector: "commitPathJsFor:",
  800. fn: function (aPackage){
  801. var self=this;
  802. return smalltalk.withContext(function($ctx1) {
  803. var $1;
  804. $1=_st(self._class())._defaultCommitPathJs();
  805. return $1;
  806. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
  807. messageSends: ["defaultCommitPathJs", "class"]}),
  808. smalltalk.LegacyPackageHandler);
  809. smalltalk.addMethod(
  810. smalltalk.method({
  811. selector: "commitPathStFor:",
  812. fn: function (aPackage){
  813. var self=this;
  814. return smalltalk.withContext(function($ctx1) {
  815. var $1;
  816. $1=_st(self._class())._defaultCommitPathSt();
  817. return $1;
  818. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
  819. messageSends: ["defaultCommitPathSt", "class"]}),
  820. smalltalk.LegacyPackageHandler);
  821. smalltalk.addMethod(
  822. smalltalk.method({
  823. selector: "loadPackage:prefix:",
  824. fn: function (packageName,aString){
  825. var self=this;
  826. var url;
  827. return smalltalk.withContext(function($ctx1) {
  828. var $1;
  829. url=_st(_st(_st("/".__comma(aString)).__comma("/js/")).__comma(packageName)).__comma(".js");
  830. _st(jQuery)._ajax_options_(url,smalltalk.HashedCollection._from_(["type".__minus_gt("GET"),"dataType".__minus_gt("script"),"complete".__minus_gt((function(jqXHR,textStatus){
  831. return smalltalk.withContext(function($ctx2) {
  832. $1=_st(_st(jqXHR)._readyState()).__eq((4));
  833. if(smalltalk.assert($1)){
  834. return self._setupPackageNamed_prefix_(packageName,aString);
  835. };
  836. }, function($ctx2) {$ctx2.fillBlock({jqXHR:jqXHR,textStatus:textStatus},$ctx1)})})),"error".__minus_gt((function(){
  837. return smalltalk.withContext(function($ctx2) {
  838. return _st(window)._alert_("Could not load package at: ".__comma(url));
  839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))]));
  840. return self}, function($ctx1) {$ctx1.fill(self,"loadPackage:prefix:",{packageName:packageName,aString:aString,url:url},smalltalk.LegacyPackageHandler)})},
  841. messageSends: [",", "ajax:options:", "->", "ifTrue:", "setupPackageNamed:prefix:", "=", "readyState", "alert:"]}),
  842. smalltalk.LegacyPackageHandler);
  843. smalltalk.addMethod(
  844. smalltalk.method({
  845. selector: "loadPackages:prefix:",
  846. fn: function (aCollection,aString){
  847. var self=this;
  848. return smalltalk.withContext(function($ctx1) {
  849. _st(aCollection)._do_((function(each){
  850. return smalltalk.withContext(function($ctx2) {
  851. return self._loadPackage_prefix_(each,aString);
  852. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  853. return self}, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler)})},
  854. messageSends: ["do:", "loadPackage:prefix:"]}),
  855. smalltalk.LegacyPackageHandler);
  856. smalltalk.addMethod(
  857. smalltalk.method({
  858. selector: "setupPackageNamed:prefix:",
  859. fn: function (packageName,aString){
  860. var self=this;
  861. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  862. return smalltalk.withContext(function($ctx1) {
  863. var $1,$2;
  864. $1=_st($Package())._named_(packageName);
  865. _st($1)._setupClasses();
  866. _st($1)._commitPathJs_(_st("/".__comma(aString)).__comma("/js"));
  867. $2=_st($1)._commitPathSt_(_st("/".__comma(aString)).__comma("/st"));
  868. return self}, function($ctx1) {$ctx1.fill(self,"setupPackageNamed:prefix:",{packageName:packageName,aString:aString},smalltalk.LegacyPackageHandler)})},
  869. messageSends: ["setupClasses", "named:", "commitPathJs:", ",", "commitPathSt:"]}),
  870. smalltalk.LegacyPackageHandler);
  871. smalltalk.LegacyPackageHandler.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  872. smalltalk.addMethod(
  873. smalltalk.method({
  874. selector: "commitPathsFromLoader",
  875. fn: function (){
  876. var self=this;
  877. return smalltalk.withContext(function($ctx1) {
  878. var commitPath = typeof amber !== 'undefined' && amber.commitPath;
  879. if (!commitPath) return;
  880. if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);
  881. if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);
  882. ;
  883. return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.LegacyPackageHandler.klass)})},
  884. messageSends: []}),
  885. smalltalk.LegacyPackageHandler.klass);
  886. smalltalk.addMethod(
  887. smalltalk.method({
  888. selector: "defaultCommitPathJs",
  889. fn: function (){
  890. var self=this;
  891. return smalltalk.withContext(function($ctx1) {
  892. var $2,$1;
  893. $2=self["@defaultCommitPathJs"];
  894. if(($receiver = $2) == nil || $receiver == undefined){
  895. self["@defaultCommitPathJs"]="js";
  896. $1=self["@defaultCommitPathJs"];
  897. } else {
  898. $1=$2;
  899. };
  900. return $1;
  901. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs",{},smalltalk.LegacyPackageHandler.klass)})},
  902. messageSends: ["ifNil:"]}),
  903. smalltalk.LegacyPackageHandler.klass);
  904. smalltalk.addMethod(
  905. smalltalk.method({
  906. selector: "defaultCommitPathJs:",
  907. fn: function (aString){
  908. var self=this;
  909. return smalltalk.withContext(function($ctx1) {
  910. self["@defaultCommitPathJs"]=aString;
  911. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  912. messageSends: []}),
  913. smalltalk.LegacyPackageHandler.klass);
  914. smalltalk.addMethod(
  915. smalltalk.method({
  916. selector: "defaultCommitPathSt",
  917. fn: function (){
  918. var self=this;
  919. return smalltalk.withContext(function($ctx1) {
  920. var $2,$1;
  921. $2=self["@defaultCommitPathSt"];
  922. if(($receiver = $2) == nil || $receiver == undefined){
  923. self["@defaultCommitPathSt"]="st";
  924. $1=self["@defaultCommitPathSt"];
  925. } else {
  926. $1=$2;
  927. };
  928. return $1;
  929. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt",{},smalltalk.LegacyPackageHandler.klass)})},
  930. messageSends: ["ifNil:"]}),
  931. smalltalk.LegacyPackageHandler.klass);
  932. smalltalk.addMethod(
  933. smalltalk.method({
  934. selector: "defaultCommitPathSt:",
  935. fn: function (aString){
  936. var self=this;
  937. return smalltalk.withContext(function($ctx1) {
  938. self["@defaultCommitPathSt"]=aString;
  939. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  940. messageSends: []}),
  941. smalltalk.LegacyPackageHandler.klass);
  942. smalltalk.addMethod(
  943. smalltalk.method({
  944. selector: "initialize",
  945. fn: function (){
  946. var self=this;
  947. return smalltalk.withContext(function($ctx1) {
  948. smalltalk.LegacyPackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  949. self._registerFor_("unknown");
  950. self._commitPathsFromLoader();
  951. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.LegacyPackageHandler.klass)})},
  952. messageSends: ["initialize", "registerFor:", "commitPathsFromLoader"]}),
  953. smalltalk.LegacyPackageHandler.klass);
  954. smalltalk.addMethod(
  955. smalltalk.method({
  956. selector: "loadPackages:prefix:",
  957. fn: function (aCollection,aString){
  958. var self=this;
  959. return smalltalk.withContext(function($ctx1) {
  960. var $1;
  961. $1=_st(self._new())._loadPackages_prefix_(aCollection,aString);
  962. return $1;
  963. }, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  964. messageSends: ["loadPackages:prefix:", "new"]}),
  965. smalltalk.LegacyPackageHandler.klass);
  966. smalltalk.addMethod(
  967. smalltalk.method({
  968. selector: "resetCommitPaths",
  969. fn: function (){
  970. var self=this;
  971. return smalltalk.withContext(function($ctx1) {
  972. self["@defaultCommitPathJs"]=nil;
  973. self["@defaultCommitPathSt"]=nil;
  974. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.LegacyPackageHandler.klass)})},
  975. messageSends: []}),
  976. smalltalk.LegacyPackageHandler.klass);
  977. smalltalk.addMethod(
  978. smalltalk.method({
  979. selector: "commit",
  980. fn: function (){
  981. var self=this;
  982. return smalltalk.withContext(function($ctx1) {
  983. var $1;
  984. $1=_st(self._transport())._commit_(self);
  985. return $1;
  986. }, function($ctx1) {$ctx1.fill(self,"commit",{},smalltalk.Package)})},
  987. messageSends: ["commit:", "transport"]}),
  988. smalltalk.Package);
  989. smalltalk.addMethod(
  990. smalltalk.method({
  991. selector: "commitPathJs",
  992. fn: function (){
  993. var self=this;
  994. return smalltalk.withContext(function($ctx1) {
  995. var $3,$2,$1;
  996. $3=self["@extension"];
  997. if(($receiver = $3) == nil || $receiver == undefined){
  998. self["@extension"]=smalltalk.HashedCollection._from_([]);
  999. $2=self["@extension"];
  1000. } else {
  1001. $2=$3;
  1002. };
  1003. $1=_st($2)._at_ifAbsentPut_("commitPathJs",(function(){
  1004. return smalltalk.withContext(function($ctx2) {
  1005. return _st(self._transport())._commitPathJsFor_(self);
  1006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1007. return $1;
  1008. }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
  1009. messageSends: ["at:ifAbsentPut:", "commitPathJsFor:", "transport", "ifNil:"]}),
  1010. smalltalk.Package);
  1011. smalltalk.addMethod(
  1012. smalltalk.method({
  1013. selector: "commitPathJs:",
  1014. fn: function (aString){
  1015. var self=this;
  1016. return smalltalk.withContext(function($ctx1) {
  1017. var $3,$2,$1;
  1018. $3=self["@extension"];
  1019. if(($receiver = $3) == nil || $receiver == undefined){
  1020. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1021. $2=self["@extension"];
  1022. } else {
  1023. $2=$3;
  1024. };
  1025. $1=_st($2)._at_put_("commitPathJs",aString);
  1026. return $1;
  1027. }, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
  1028. messageSends: ["at:put:", "ifNil:"]}),
  1029. smalltalk.Package);
  1030. smalltalk.addMethod(
  1031. smalltalk.method({
  1032. selector: "commitPathSt",
  1033. fn: function (){
  1034. var self=this;
  1035. return smalltalk.withContext(function($ctx1) {
  1036. var $3,$2,$1;
  1037. $3=self["@extension"];
  1038. if(($receiver = $3) == nil || $receiver == undefined){
  1039. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1040. $2=self["@extension"];
  1041. } else {
  1042. $2=$3;
  1043. };
  1044. $1=_st($2)._at_ifAbsentPut_("commitPathSt",(function(){
  1045. return smalltalk.withContext(function($ctx2) {
  1046. return _st(self._transport())._commitPathStFor_(self);
  1047. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1048. return $1;
  1049. }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
  1050. messageSends: ["at:ifAbsentPut:", "commitPathStFor:", "transport", "ifNil:"]}),
  1051. smalltalk.Package);
  1052. smalltalk.addMethod(
  1053. smalltalk.method({
  1054. selector: "commitPathSt:",
  1055. fn: function (aString){
  1056. var self=this;
  1057. return smalltalk.withContext(function($ctx1) {
  1058. var $3,$2,$1;
  1059. $3=self["@extension"];
  1060. if(($receiver = $3) == nil || $receiver == undefined){
  1061. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1062. $2=self["@extension"];
  1063. } else {
  1064. $2=$3;
  1065. };
  1066. $1=_st($2)._at_put_("commitPathSt",aString);
  1067. return $1;
  1068. }, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
  1069. messageSends: ["at:put:", "ifNil:"]}),
  1070. smalltalk.Package);
  1071. smalltalk.addMethod(
  1072. smalltalk.method({
  1073. selector: "transport",
  1074. fn: function (){
  1075. var self=this;
  1076. function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
  1077. return smalltalk.withContext(function($ctx1) {
  1078. var $1;
  1079. $1=_st($PackageHandler())._for_(self._transportType());
  1080. return $1;
  1081. }, function($ctx1) {$ctx1.fill(self,"transport",{},smalltalk.Package)})},
  1082. messageSends: ["for:", "transportType"]}),
  1083. smalltalk.Package);
  1084. smalltalk.addMethod(
  1085. smalltalk.method({
  1086. selector: "transportType",
  1087. fn: function (){
  1088. var self=this;
  1089. return smalltalk.withContext(function($ctx1) {
  1090. return (self.transport && self.transport.type) || 'unknown';;
  1091. return self}, function($ctx1) {$ctx1.fill(self,"transportType",{},smalltalk.Package)})},
  1092. messageSends: []}),
  1093. smalltalk.Package);
  1094. })(global_smalltalk,global_nil,global__st);