1
0

Importer-Exporter.deploy.js 37 KB

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