Importer-Exporter.deploy.js 39 KB

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