Importer-Exporter.deploy.js 40 KB

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