Importer-Exporter.deploy.js 79 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001
  1. (function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Importer-Exporter');
  3. smalltalk.addClass('AbstractExporter', 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.AbstractExporter)})},
  14. messageSends: ["trimBoth", "replace:with:"]}),
  15. smalltalk.AbstractExporter);
  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.AbstractExporter)})},
  36. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"]}),
  37. smalltalk.AbstractExporter);
  38. smalltalk.addMethod(
  39. smalltalk.method({
  40. selector: "recipe",
  41. fn: function (){
  42. var self=this;
  43. return smalltalk.withContext(function($ctx1) {
  44. self._subclassResponsibility();
  45. return self}, function($ctx1) {$ctx1.fill(self,"recipe",{},smalltalk.AbstractExporter)})},
  46. messageSends: ["subclassResponsibility"]}),
  47. smalltalk.AbstractExporter);
  48. smalltalk.AbstractExporter.klass.iVarNames = ['default'];
  49. smalltalk.addMethod(
  50. smalltalk.method({
  51. selector: "default",
  52. fn: function (){
  53. var self=this;
  54. return smalltalk.withContext(function($ctx1) {
  55. var $2,$1;
  56. $2=self["@default"];
  57. if(($receiver = $2) == nil || $receiver == undefined){
  58. self["@default"]=self._new();
  59. $1=self["@default"];
  60. } else {
  61. $1=$2;
  62. };
  63. return $1;
  64. }, function($ctx1) {$ctx1.fill(self,"default",{},smalltalk.AbstractExporter.klass)})},
  65. messageSends: ["ifNil:", "new"]}),
  66. smalltalk.AbstractExporter.klass);
  67. smalltalk.addClass('ChunkExporter', smalltalk.AbstractExporter, [], 'Importer-Exporter');
  68. smalltalk.addMethod(
  69. smalltalk.method({
  70. selector: "exportCategoryEpilogueOf:on:",
  71. fn: function (category,aStream){
  72. var self=this;
  73. return smalltalk.withContext(function($ctx1) {
  74. var $1,$2;
  75. $1=aStream;
  76. _st($1)._nextPutAll_(" !");
  77. _st($1)._lf();
  78. $2=_st($1)._lf();
  79. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{category:category,aStream:aStream},smalltalk.ChunkExporter)})},
  80. messageSends: ["nextPutAll:", "lf"]}),
  81. smalltalk.ChunkExporter);
  82. smalltalk.addMethod(
  83. smalltalk.method({
  84. selector: "exportCategoryPrologueOf:on:",
  85. fn: function (category,aStream){
  86. var self=this;
  87. return smalltalk.withContext(function($ctx1) {
  88. var $1,$2;
  89. $1=aStream;
  90. _st($1)._nextPutAll_("!".__comma(self._classNameFor_(_st(category)._theClass())));
  91. $2=_st($1)._nextPutAll_(_st(" methodsFor: '".__comma(_st(category)._name())).__comma("'!"));
  92. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{category:category,aStream:aStream},smalltalk.ChunkExporter)})},
  93. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]}),
  94. smalltalk.ChunkExporter);
  95. smalltalk.addMethod(
  96. smalltalk.method({
  97. selector: "exportDefinitionOf:on:",
  98. fn: function (aClass,aStream){
  99. var self=this;
  100. return smalltalk.withContext(function($ctx1) {
  101. var $1,$2,$3,$4,$5,$6,$7;
  102. $1=aStream;
  103. _st($1)._nextPutAll_(self._classNameFor_(_st(aClass)._superclass()));
  104. _st($1)._nextPutAll_(" subclass: #".__comma(self._classNameFor_(aClass)));
  105. _st($1)._lf();
  106. _st($1)._tab();
  107. $2=_st($1)._nextPutAll_("instanceVariableNames: '");
  108. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  109. return smalltalk.withContext(function($ctx2) {
  110. return _st(aStream)._nextPutAll_(each);
  111. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  112. return smalltalk.withContext(function($ctx2) {
  113. return _st(aStream)._nextPutAll_(" ");
  114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  115. $3=aStream;
  116. _st($3)._nextPutAll_("'");
  117. _st($3)._lf();
  118. _st($3)._tab();
  119. _st($3)._nextPutAll_(_st("package: '".__comma(_st(aClass)._category())).__comma("'!"));
  120. $4=_st($3)._lf();
  121. $5=_st(_st(aClass)._comment())._notEmpty();
  122. if(smalltalk.assert($5)){
  123. $6=aStream;
  124. _st($6)._nextPutAll_(_st("!".__comma(self._classNameFor_(aClass))).__comma(" commentStamp!"));
  125. _st($6)._lf();
  126. _st($6)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
  127. $7=_st($6)._lf();
  128. $7;
  129. };
  130. _st(aStream)._lf();
  131. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  132. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "chunkEscape:", "comment", "notEmpty"]}),
  133. smalltalk.ChunkExporter);
  134. smalltalk.addMethod(
  135. smalltalk.method({
  136. selector: "exportMetaDefinitionOf:on:",
  137. fn: function (aClass,aStream){
  138. var self=this;
  139. return smalltalk.withContext(function($ctx1) {
  140. var $1,$2,$3,$4,$5;
  141. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  142. if(! smalltalk.assert($1)){
  143. $2=aStream;
  144. _st($2)._nextPutAll_(self._classNameFor_(_st(aClass)._class()));
  145. $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
  146. $3;
  147. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  148. return smalltalk.withContext(function($ctx2) {
  149. return _st(aStream)._nextPutAll_(each);
  150. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  151. return smalltalk.withContext(function($ctx2) {
  152. return _st(aStream)._nextPutAll_(" ");
  153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  154. $4=aStream;
  155. _st($4)._nextPutAll_("'!");
  156. _st($4)._lf();
  157. $5=_st($4)._lf();
  158. $5;
  159. };
  160. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  161. messageSends: ["ifFalse:", "nextPutAll:", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"]}),
  162. smalltalk.ChunkExporter);
  163. smalltalk.addMethod(
  164. smalltalk.method({
  165. selector: "exportMethod:on:",
  166. fn: function (aMethod,aStream){
  167. var self=this;
  168. return smalltalk.withContext(function($ctx1) {
  169. var $1,$2;
  170. $1=aStream;
  171. _st($1)._lf();
  172. _st($1)._lf();
  173. _st($1)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
  174. _st($1)._lf();
  175. $2=_st($1)._nextPutAll_("!");
  176. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.ChunkExporter)})},
  177. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]}),
  178. smalltalk.ChunkExporter);
  179. smalltalk.addMethod(
  180. smalltalk.method({
  181. selector: "exportPackageDefinitionOf:on:",
  182. fn: function (package_,aStream){
  183. var self=this;
  184. return smalltalk.withContext(function($ctx1) {
  185. var $1,$2;
  186. $1=aStream;
  187. _st($1)._nextPutAll_(_st("Smalltalk current createPackage: '".__comma(_st(package_)._name())).__comma("'!"));
  188. $2=_st($1)._lf();
  189. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{package_:package_,aStream:aStream},smalltalk.ChunkExporter)})},
  190. messageSends: ["nextPutAll:", ",", "name", "lf"]}),
  191. smalltalk.ChunkExporter);
  192. smalltalk.addMethod(
  193. smalltalk.method({
  194. selector: "extensionCategoriesOfPackage:",
  195. fn: function (package_){
  196. var self=this;
  197. var name,map,result;
  198. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  199. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  200. function $MethodCategory(){return smalltalk.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  201. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  202. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  203. return smalltalk.withContext(function($ctx1) {
  204. var $1,$2;
  205. name=_st(package_)._name();
  206. result=_st($OrderedCollection())._new();
  207. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  208. return smalltalk.withContext(function($ctx2) {
  209. return _st([each,_st(each)._class()])._do_((function(aClass){
  210. return smalltalk.withContext(function($ctx3) {
  211. map=_st($Dictionary())._new();
  212. map;
  213. _st(aClass)._protocolsDo_((function(category,methods){
  214. return smalltalk.withContext(function($ctx4) {
  215. $1=_st(category)._match_("^\x5c*".__comma(name));
  216. if(smalltalk.assert($1)){
  217. return _st(map)._at_put_(category,methods);
  218. };
  219. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3)})}));
  220. return _st(result)._addAll_(_st(_st(_st(map)._keys())._sorted_((function(a,b){
  221. return smalltalk.withContext(function($ctx4) {
  222. return _st(a).__lt_eq(b);
  223. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._collect_((function(category){
  224. return smalltalk.withContext(function($ctx4) {
  225. return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
  226. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3)})})));
  227. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  228. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  229. $2=result;
  230. return $2;
  231. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{package_:package_,name:name,map:map,result:result},smalltalk.ChunkExporter)})},
  232. messageSends: ["name", "new", "do:", "protocolsDo:", "ifTrue:", "at:put:", "match:", ",", "addAll:", "collect:", "name:theClass:methods:", "at:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"]}),
  233. smalltalk.ChunkExporter);
  234. smalltalk.addMethod(
  235. smalltalk.method({
  236. selector: "methodsOfCategory:",
  237. fn: function (category){
  238. var self=this;
  239. return smalltalk.withContext(function($ctx1) {
  240. var $1;
  241. $1=_st(_st(category)._methods())._sorted_((function(a,b){
  242. return smalltalk.withContext(function($ctx2) {
  243. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  244. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}));
  245. return $1;
  246. }, function($ctx1) {$ctx1.fill(self,"methodsOfCategory:",{category:category},smalltalk.ChunkExporter)})},
  247. messageSends: ["sorted:", "<=", "selector", "methods"]}),
  248. smalltalk.ChunkExporter);
  249. smalltalk.addMethod(
  250. smalltalk.method({
  251. selector: "ownCategoriesOfClass:",
  252. fn: function (aClass){
  253. var self=this;
  254. var map;
  255. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  256. function $MethodCategory(){return smalltalk.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  257. return smalltalk.withContext(function($ctx1) {
  258. var $1,$2;
  259. map=_st($Dictionary())._new();
  260. _st(aClass)._protocolsDo_((function(category,methods){
  261. return smalltalk.withContext(function($ctx2) {
  262. $1=_st(category)._match_("^\x5c*");
  263. if(! smalltalk.assert($1)){
  264. return _st(map)._at_put_(category,methods);
  265. };
  266. }, function($ctx2) {$ctx2.fillBlock({category:category,methods:methods},$ctx1)})}));
  267. $2=_st(_st(_st(map)._keys())._sorted_((function(a,b){
  268. return smalltalk.withContext(function($ctx2) {
  269. return _st(a).__lt_eq(b);
  270. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._collect_((function(category){
  271. return smalltalk.withContext(function($ctx2) {
  272. return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
  273. }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1)})}));
  274. return $2;
  275. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},smalltalk.ChunkExporter)})},
  276. messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "collect:", "name:theClass:methods:", "at:", "sorted:", "<=", "keys"]}),
  277. smalltalk.ChunkExporter);
  278. smalltalk.addMethod(
  279. smalltalk.method({
  280. selector: "ownCategoriesOfMetaClass:",
  281. fn: function (aClass){
  282. var self=this;
  283. return smalltalk.withContext(function($ctx1) {
  284. var $1;
  285. $1=self._ownCategoriesOfClass_(_st(aClass)._class());
  286. return $1;
  287. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},smalltalk.ChunkExporter)})},
  288. messageSends: ["ownCategoriesOfClass:", "class"]}),
  289. smalltalk.ChunkExporter);
  290. smalltalk.addMethod(
  291. smalltalk.method({
  292. selector: "recipe",
  293. fn: function (){
  294. var self=this;
  295. var exportCategoryRecipe;
  296. function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
  297. return smalltalk.withContext(function($ctx1) {
  298. var $1;
  299. exportCategoryRecipe=[self.__minus_gt("exportCategoryPrologueOf:on:"),[self.__minus_gt("methodsOfCategory:"),self.__minus_gt("exportMethod:on:")],self.__minus_gt("exportCategoryEpilogueOf:on:")];
  300. $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)];
  301. return $1;
  302. }, function($ctx1) {$ctx1.fill(self,"recipe",{exportCategoryRecipe:exportCategoryRecipe},smalltalk.ChunkExporter)})},
  303. messageSends: ["->", ","]}),
  304. smalltalk.ChunkExporter);
  305. smalltalk.addMethod(
  306. smalltalk.method({
  307. selector: "chunkEscape:",
  308. fn: function (aString){
  309. var self=this;
  310. return smalltalk.withContext(function($ctx1) {
  311. var $1;
  312. $1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
  313. return $1;
  314. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},smalltalk.ChunkExporter.klass)})},
  315. messageSends: ["trimBoth", "replace:with:"]}),
  316. smalltalk.ChunkExporter.klass);
  317. smalltalk.addMethod(
  318. smalltalk.method({
  319. selector: "classNameFor:",
  320. fn: function (aClass){
  321. var self=this;
  322. return smalltalk.withContext(function($ctx1) {
  323. var $2,$3,$1;
  324. $2=_st(aClass)._isMetaclass();
  325. if(smalltalk.assert($2)){
  326. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(" class");
  327. } else {
  328. $3=_st(aClass)._isNil();
  329. if(smalltalk.assert($3)){
  330. $1="nil";
  331. } else {
  332. $1=_st(aClass)._name();
  333. };
  334. };
  335. return $1;
  336. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.ChunkExporter.klass)})},
  337. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"]}),
  338. smalltalk.ChunkExporter.klass);
  339. smalltalk.addMethod(
  340. smalltalk.method({
  341. selector: "exportCategoryEpilogueOf:on:",
  342. fn: function (category,aStream){
  343. var self=this;
  344. return smalltalk.withContext(function($ctx1) {
  345. var $1,$2;
  346. $1=aStream;
  347. _st($1)._nextPutAll_(" !");
  348. _st($1)._lf();
  349. $2=_st($1)._lf();
  350. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{category:category,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  351. messageSends: ["nextPutAll:", "lf"]}),
  352. smalltalk.ChunkExporter.klass);
  353. smalltalk.addMethod(
  354. smalltalk.method({
  355. selector: "exportCategoryPrologueOf:on:",
  356. fn: function (category,aStream){
  357. var self=this;
  358. return smalltalk.withContext(function($ctx1) {
  359. var $1,$2;
  360. $1=aStream;
  361. _st($1)._nextPutAll_("!".__comma(self._classNameFor_(_st(category)._theClass())));
  362. $2=_st($1)._nextPutAll_(_st(" methodsFor: '".__comma(_st(category)._name())).__comma("'!"));
  363. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{category:category,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  364. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]}),
  365. smalltalk.ChunkExporter.klass);
  366. smalltalk.addMethod(
  367. smalltalk.method({
  368. selector: "exportDefinitionOf:on:",
  369. fn: function (aClass,aStream){
  370. var self=this;
  371. return smalltalk.withContext(function($ctx1) {
  372. var $1,$2,$3,$4,$5,$6,$7;
  373. $1=aStream;
  374. _st($1)._nextPutAll_(self._classNameFor_(_st(aClass)._superclass()));
  375. _st($1)._nextPutAll_(" subclass: #".__comma(self._classNameFor_(aClass)));
  376. _st($1)._lf();
  377. _st($1)._tab();
  378. $2=_st($1)._nextPutAll_("instanceVariableNames: '");
  379. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  380. return smalltalk.withContext(function($ctx2) {
  381. return _st(aStream)._nextPutAll_(each);
  382. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  383. return smalltalk.withContext(function($ctx2) {
  384. return _st(aStream)._nextPutAll_(" ");
  385. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  386. $3=aStream;
  387. _st($3)._nextPutAll_("'");
  388. _st($3)._lf();
  389. _st($3)._tab();
  390. _st($3)._nextPutAll_(_st("package: '".__comma(_st(aClass)._category())).__comma("'!"));
  391. $4=_st($3)._lf();
  392. $5=_st(_st(aClass)._comment())._notEmpty();
  393. if(smalltalk.assert($5)){
  394. $6=aStream;
  395. _st($6)._nextPutAll_(_st("!".__comma(self._classNameFor_(aClass))).__comma(" commentStamp!"));
  396. _st($6)._lf();
  397. _st($6)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
  398. $7=_st($6)._lf();
  399. $7;
  400. };
  401. _st(aStream)._lf();
  402. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  403. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "chunkEscape:", "comment", "notEmpty"]}),
  404. smalltalk.ChunkExporter.klass);
  405. smalltalk.addMethod(
  406. smalltalk.method({
  407. selector: "exportMetaDefinitionOf:on:",
  408. fn: function (aClass,aStream){
  409. var self=this;
  410. return smalltalk.withContext(function($ctx1) {
  411. var $1,$2,$3,$4,$5;
  412. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  413. if(! smalltalk.assert($1)){
  414. $2=aStream;
  415. _st($2)._nextPutAll_(self._classNameFor_(_st(aClass)._class()));
  416. $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
  417. $3;
  418. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  419. return smalltalk.withContext(function($ctx2) {
  420. return _st(aStream)._nextPutAll_(each);
  421. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  422. return smalltalk.withContext(function($ctx2) {
  423. return _st(aStream)._nextPutAll_(" ");
  424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  425. $4=aStream;
  426. _st($4)._nextPutAll_("'!");
  427. _st($4)._lf();
  428. $5=_st($4)._lf();
  429. $5;
  430. };
  431. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  432. messageSends: ["ifFalse:", "nextPutAll:", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"]}),
  433. smalltalk.ChunkExporter.klass);
  434. smalltalk.addMethod(
  435. smalltalk.method({
  436. selector: "exportMethod:on:",
  437. fn: function (aMethod,aStream){
  438. var self=this;
  439. return smalltalk.withContext(function($ctx1) {
  440. var $1,$2;
  441. $1=aStream;
  442. _st($1)._lf();
  443. _st($1)._lf();
  444. _st($1)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
  445. _st($1)._lf();
  446. $2=_st($1)._nextPutAll_("!");
  447. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  448. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]}),
  449. smalltalk.ChunkExporter.klass);
  450. smalltalk.addMethod(
  451. smalltalk.method({
  452. selector: "exportPackageDefinitionOf:on:",
  453. fn: function (package_,aStream){
  454. var self=this;
  455. return smalltalk.withContext(function($ctx1) {
  456. var $1,$2;
  457. $1=aStream;
  458. _st($1)._nextPutAll_(_st("Smalltalk current createPackage: '".__comma(_st(package_)._name())).__comma("'!"));
  459. $2=_st($1)._lf();
  460. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{package_:package_,aStream:aStream},smalltalk.ChunkExporter.klass)})},
  461. messageSends: ["nextPutAll:", ",", "name", "lf"]}),
  462. smalltalk.ChunkExporter.klass);
  463. smalltalk.addMethod(
  464. smalltalk.method({
  465. selector: "extensionCategoriesOfPackage:",
  466. fn: function (package_){
  467. var self=this;
  468. var name,map,result;
  469. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  470. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  471. function $MethodCategory(){return smalltalk.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  472. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  473. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  474. return smalltalk.withContext(function($ctx1) {
  475. var $1,$2;
  476. name=_st(package_)._name();
  477. result=_st($OrderedCollection())._new();
  478. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  479. return smalltalk.withContext(function($ctx2) {
  480. return _st([each,_st(each)._class()])._do_((function(aClass){
  481. return smalltalk.withContext(function($ctx3) {
  482. map=_st($Dictionary())._new();
  483. map;
  484. _st(aClass)._protocolsDo_((function(category,methods){
  485. return smalltalk.withContext(function($ctx4) {
  486. $1=_st(category)._match_("^\x5c*".__comma(name));
  487. if(smalltalk.assert($1)){
  488. return _st(map)._at_put_(category,methods);
  489. };
  490. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3)})}));
  491. return _st(result)._addAll_(_st(_st(_st(map)._keys())._sorted_((function(a,b){
  492. return smalltalk.withContext(function($ctx4) {
  493. return _st(a).__lt_eq(b);
  494. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._collect_((function(category){
  495. return smalltalk.withContext(function($ctx4) {
  496. return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
  497. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3)})})));
  498. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  499. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  500. $2=result;
  501. return $2;
  502. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{package_:package_,name:name,map:map,result:result},smalltalk.ChunkExporter.klass)})},
  503. messageSends: ["name", "new", "do:", "protocolsDo:", "ifTrue:", "at:put:", "match:", ",", "addAll:", "collect:", "name:theClass:methods:", "at:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"]}),
  504. smalltalk.ChunkExporter.klass);
  505. smalltalk.addMethod(
  506. smalltalk.method({
  507. selector: "methodsOfCategory:",
  508. fn: function (category){
  509. var self=this;
  510. return smalltalk.withContext(function($ctx1) {
  511. var $1;
  512. $1=_st(_st(category)._methods())._sorted_((function(a,b){
  513. return smalltalk.withContext(function($ctx2) {
  514. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  515. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})}));
  516. return $1;
  517. }, function($ctx1) {$ctx1.fill(self,"methodsOfCategory:",{category:category},smalltalk.ChunkExporter.klass)})},
  518. messageSends: ["sorted:", "<=", "selector", "methods"]}),
  519. smalltalk.ChunkExporter.klass);
  520. smalltalk.addMethod(
  521. smalltalk.method({
  522. selector: "ownCategoriesOfClass:",
  523. fn: function (aClass){
  524. var self=this;
  525. var map;
  526. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  527. function $MethodCategory(){return smalltalk.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  528. return smalltalk.withContext(function($ctx1) {
  529. var $1,$2;
  530. map=_st($Dictionary())._new();
  531. _st(aClass)._protocolsDo_((function(category,methods){
  532. return smalltalk.withContext(function($ctx2) {
  533. $1=_st(category)._match_("^\x5c*");
  534. if(! smalltalk.assert($1)){
  535. return _st(map)._at_put_(category,methods);
  536. };
  537. }, function($ctx2) {$ctx2.fillBlock({category:category,methods:methods},$ctx1)})}));
  538. $2=_st(_st(_st(map)._keys())._sorted_((function(a,b){
  539. return smalltalk.withContext(function($ctx2) {
  540. return _st(a).__lt_eq(b);
  541. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._collect_((function(category){
  542. return smalltalk.withContext(function($ctx2) {
  543. return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
  544. }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1)})}));
  545. return $2;
  546. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},smalltalk.ChunkExporter.klass)})},
  547. messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "collect:", "name:theClass:methods:", "at:", "sorted:", "<=", "keys"]}),
  548. smalltalk.ChunkExporter.klass);
  549. smalltalk.addMethod(
  550. smalltalk.method({
  551. selector: "ownCategoriesOfMetaClass:",
  552. fn: function (aClass){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) {
  555. var $1;
  556. $1=self._ownCategoriesOfClass_(_st(aClass)._class());
  557. return $1;
  558. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},smalltalk.ChunkExporter.klass)})},
  559. messageSends: ["ownCategoriesOfClass:", "class"]}),
  560. smalltalk.ChunkExporter.klass);
  561. smalltalk.addMethod(
  562. smalltalk.method({
  563. selector: "recipe",
  564. fn: function (){
  565. var self=this;
  566. var exportCategoryRecipe;
  567. function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
  568. return smalltalk.withContext(function($ctx1) {
  569. var $1;
  570. exportCategoryRecipe=[self.__minus_gt("exportCategoryPrologueOf:on:"),[self.__minus_gt("methodsOfCategory:"),self.__minus_gt("exportMethod:on:")],self.__minus_gt("exportCategoryEpilogueOf:on:")];
  571. $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)];
  572. return $1;
  573. }, function($ctx1) {$ctx1.fill(self,"recipe",{exportCategoryRecipe:exportCategoryRecipe},smalltalk.ChunkExporter.klass)})},
  574. messageSends: ["->", ","]}),
  575. smalltalk.ChunkExporter.klass);
  576. smalltalk.addClass('Exporter', smalltalk.AbstractExporter, [], 'Importer-Exporter');
  577. smalltalk.addMethod(
  578. smalltalk.method({
  579. selector: "classNameFor:",
  580. fn: function (aClass){
  581. var self=this;
  582. return smalltalk.withContext(function($ctx1) {
  583. var $2,$3,$1;
  584. $2=_st(aClass)._isMetaclass();
  585. if(smalltalk.assert($2)){
  586. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(".klass");
  587. } else {
  588. $3=_st(aClass)._isNil();
  589. if(smalltalk.assert($3)){
  590. $1="nil";
  591. } else {
  592. $1=_st(aClass)._name();
  593. };
  594. };
  595. return $1;
  596. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.Exporter)})},
  597. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"]}),
  598. smalltalk.Exporter);
  599. smalltalk.addMethod(
  600. smalltalk.method({
  601. selector: "exportDefinitionOf:on:",
  602. fn: function (aClass,aStream){
  603. var self=this;
  604. return smalltalk.withContext(function($ctx1) {
  605. var $1,$2,$3,$4,$5,$6,$7;
  606. $1=aStream;
  607. _st($1)._lf();
  608. _st($1)._nextPutAll_("smalltalk.addClass(");
  609. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  610. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  611. $2=_st($1)._nextPutAll_(", [");
  612. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  613. return smalltalk.withContext(function($ctx2) {
  614. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  615. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  616. return smalltalk.withContext(function($ctx2) {
  617. return _st(aStream)._nextPutAll_(", ");
  618. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  619. $3=aStream;
  620. _st($3)._nextPutAll_("], '");
  621. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  622. $4=_st($3)._nextPutAll_(");");
  623. $5=_st(_st(aClass)._comment())._notEmpty();
  624. if(smalltalk.assert($5)){
  625. $6=aStream;
  626. _st($6)._lf();
  627. _st($6)._nextPutAll_("smalltalk.");
  628. _st($6)._nextPutAll_(self._classNameFor_(aClass));
  629. _st($6)._nextPutAll_(".comment=");
  630. _st($6)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
  631. $7=_st($6)._nextPutAll_(";");
  632. $7;
  633. };
  634. _st(aStream)._lf();
  635. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  636. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "asJavascript", "comment", "notEmpty"]}),
  637. smalltalk.Exporter);
  638. smalltalk.addMethod(
  639. smalltalk.method({
  640. selector: "exportMetaDefinitionOf:on:",
  641. fn: function (aClass,aStream){
  642. var self=this;
  643. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  644. return smalltalk.withContext(function($ctx1) {
  645. var $1,$2,$3;
  646. _st(aStream)._lf();
  647. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  648. if(! smalltalk.assert($1)){
  649. $2=aStream;
  650. _st($2)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._class())));
  651. $3=_st($2)._nextPutAll_(".iVarNames = [");
  652. $3;
  653. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  654. return smalltalk.withContext(function($ctx2) {
  655. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  656. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  657. return smalltalk.withContext(function($ctx2) {
  658. return _st(aStream)._nextPutAll_(",");
  659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  660. _st(aStream)._nextPutAll_("];".__comma(_st($String())._lf()));
  661. };
  662. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  663. messageSends: ["lf", "ifFalse:", "nextPutAll:", ",", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "isEmpty"]}),
  664. smalltalk.Exporter);
  665. smalltalk.addMethod(
  666. smalltalk.method({
  667. selector: "exportMethod:on:",
  668. fn: function (aMethod,aStream){
  669. var self=this;
  670. return smalltalk.withContext(function($ctx1) {
  671. var $1,$2,$3,$4;
  672. $1=aStream;
  673. _st($1)._nextPutAll_("smalltalk.addMethod(");
  674. _st($1)._lf();
  675. _st($1)._nextPutAll_("smalltalk.method({");
  676. _st($1)._lf();
  677. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  678. _st($1)._lf();
  679. _st($1)._nextPutAll_(_st("category: '".__comma(_st(aMethod)._category())).__comma("',"));
  680. _st($1)._lf();
  681. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  682. _st($1)._lf();
  683. _st($1)._nextPutAll_(_st("args: ".__comma(_st(_st(aMethod)._arguments())._asJavascript())).__comma(","));
  684. _st($1)._lf();
  685. _st($1)._nextPutAll_(_st("source: ".__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
  686. _st($1)._lf();
  687. _st($1)._nextPutAll_(_st("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript())).__comma(","));
  688. _st($1)._lf();
  689. $2=_st($1)._nextPutAll_("referencedClasses: ".__comma(_st(_st(aMethod)._referencedClasses())._asJavascript()));
  690. $3=aStream;
  691. _st($3)._lf();
  692. _st($3)._nextPutAll_("}),");
  693. _st($3)._lf();
  694. _st($3)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
  695. _st($3)._nextPutAll_(");");
  696. _st($3)._lf();
  697. $4=_st($3)._lf();
  698. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.Exporter)})},
  699. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "category", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:", "methodClass"]}),
  700. smalltalk.Exporter);
  701. smalltalk.addMethod(
  702. smalltalk.method({
  703. selector: "exportPackageDefinitionOf:on:",
  704. fn: function (package_,aStream){
  705. var self=this;
  706. return smalltalk.withContext(function($ctx1) {
  707. var $1,$2;
  708. $1=aStream;
  709. _st($1)._nextPutAll_("smalltalk.addPackage(");
  710. _st($1)._nextPutAll_(_st("'".__comma(_st(package_)._name())).__comma("');"));
  711. $2=_st($1)._lf();
  712. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{package_:package_,aStream:aStream},smalltalk.Exporter)})},
  713. messageSends: ["nextPutAll:", ",", "name", "lf"]}),
  714. smalltalk.Exporter);
  715. smalltalk.addMethod(
  716. smalltalk.method({
  717. selector: "exportPackageEpilogueOf:on:",
  718. fn: function (aPackage,aStream){
  719. var self=this;
  720. return smalltalk.withContext(function($ctx1) {
  721. var $1,$2;
  722. $1=aStream;
  723. _st($1)._nextPutAll_("})(global_smalltalk,global_nil,global__st);");
  724. $2=_st($1)._lf();
  725. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  726. messageSends: ["nextPutAll:", "lf"]}),
  727. smalltalk.Exporter);
  728. smalltalk.addMethod(
  729. smalltalk.method({
  730. selector: "exportPackagePrologueOf:on:",
  731. fn: function (aPackage,aStream){
  732. var self=this;
  733. return smalltalk.withContext(function($ctx1) {
  734. var $1,$2;
  735. $1=aStream;
  736. _st($1)._nextPutAll_("(function(smalltalk,nil,_st){");
  737. $2=_st($1)._lf();
  738. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  739. messageSends: ["nextPutAll:", "lf"]}),
  740. smalltalk.Exporter);
  741. smalltalk.addMethod(
  742. smalltalk.method({
  743. selector: "extensionMethodsOfPackage:",
  744. fn: function (package_){
  745. var self=this;
  746. var name,result;
  747. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  748. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  749. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  750. return smalltalk.withContext(function($ctx1) {
  751. var $1;
  752. name=_st(package_)._name();
  753. result=_st($OrderedCollection())._new();
  754. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  755. return smalltalk.withContext(function($ctx2) {
  756. return _st([each,_st(each)._class()])._do_((function(aClass){
  757. return smalltalk.withContext(function($ctx3) {
  758. return _st(result)._addAll_(_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  759. return smalltalk.withContext(function($ctx4) {
  760. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  761. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._select_((function(method){
  762. return smalltalk.withContext(function($ctx4) {
  763. return _st(_st(method)._category())._match_("^\x5c*".__comma(name));
  764. }, function($ctx4) {$ctx4.fillBlock({method:method},$ctx3)})})));
  765. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  766. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  767. $1=result;
  768. return $1;
  769. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{package_:package_,name:name,result:result},smalltalk.Exporter)})},
  770. messageSends: ["name", "new", "do:", "addAll:", "select:", "match:", ",", "category", "sorted:", "<=", "selector", "values", "methodDictionary", "class", "sortedClasses:", "classes", "current"]}),
  771. smalltalk.Exporter);
  772. smalltalk.addMethod(
  773. smalltalk.method({
  774. selector: "ownMethodsOfClass:",
  775. fn: function (aClass){
  776. var self=this;
  777. return smalltalk.withContext(function($ctx1) {
  778. var $1;
  779. $1=_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  780. return smalltalk.withContext(function($ctx2) {
  781. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  782. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._reject_((function(each){
  783. return smalltalk.withContext(function($ctx2) {
  784. return _st(_st(each)._category())._match_("^\x5c*");
  785. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  786. return $1;
  787. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},smalltalk.Exporter)})},
  788. messageSends: ["reject:", "match:", "category", "sorted:", "<=", "selector", "values", "methodDictionary"]}),
  789. smalltalk.Exporter);
  790. smalltalk.addMethod(
  791. smalltalk.method({
  792. selector: "ownMethodsOfMetaClass:",
  793. fn: function (aClass){
  794. var self=this;
  795. return smalltalk.withContext(function($ctx1) {
  796. var $1;
  797. $1=self._ownMethodsOfClass_(_st(aClass)._class());
  798. return $1;
  799. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},smalltalk.Exporter)})},
  800. messageSends: ["ownMethodsOfClass:", "class"]}),
  801. smalltalk.Exporter);
  802. smalltalk.addMethod(
  803. smalltalk.method({
  804. selector: "recipe",
  805. fn: function (){
  806. var self=this;
  807. function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
  808. return smalltalk.withContext(function($ctx1) {
  809. var $1;
  810. $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:")];
  811. return $1;
  812. }, function($ctx1) {$ctx1.fill(self,"recipe",{},smalltalk.Exporter)})},
  813. messageSends: ["->"]}),
  814. smalltalk.Exporter);
  815. smalltalk.addMethod(
  816. smalltalk.method({
  817. selector: "classNameFor:",
  818. fn: function (aClass){
  819. var self=this;
  820. return smalltalk.withContext(function($ctx1) {
  821. var $2,$3,$1;
  822. $2=_st(aClass)._isMetaclass();
  823. if(smalltalk.assert($2)){
  824. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(".klass");
  825. } else {
  826. $3=_st(aClass)._isNil();
  827. if(smalltalk.assert($3)){
  828. $1="nil";
  829. } else {
  830. $1=_st(aClass)._name();
  831. };
  832. };
  833. return $1;
  834. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.Exporter.klass)})},
  835. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"]}),
  836. smalltalk.Exporter.klass);
  837. smalltalk.addMethod(
  838. smalltalk.method({
  839. selector: "exportDefinitionOf:on:",
  840. fn: function (aClass,aStream){
  841. var self=this;
  842. return smalltalk.withContext(function($ctx1) {
  843. var $1,$2,$3,$4,$5,$6,$7;
  844. $1=aStream;
  845. _st($1)._lf();
  846. _st($1)._nextPutAll_("smalltalk.addClass(");
  847. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  848. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  849. $2=_st($1)._nextPutAll_(", [");
  850. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  851. return smalltalk.withContext(function($ctx2) {
  852. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  853. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  854. return smalltalk.withContext(function($ctx2) {
  855. return _st(aStream)._nextPutAll_(", ");
  856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  857. $3=aStream;
  858. _st($3)._nextPutAll_("], '");
  859. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  860. $4=_st($3)._nextPutAll_(");");
  861. $5=_st(_st(aClass)._comment())._notEmpty();
  862. if(smalltalk.assert($5)){
  863. $6=aStream;
  864. _st($6)._lf();
  865. _st($6)._nextPutAll_("smalltalk.");
  866. _st($6)._nextPutAll_(self._classNameFor_(aClass));
  867. _st($6)._nextPutAll_(".comment=");
  868. _st($6)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
  869. $7=_st($6)._nextPutAll_(";");
  870. $7;
  871. };
  872. _st(aStream)._lf();
  873. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter.klass)})},
  874. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "asJavascript", "comment", "notEmpty"]}),
  875. smalltalk.Exporter.klass);
  876. smalltalk.addMethod(
  877. smalltalk.method({
  878. selector: "exportMetaDefinitionOf:on:",
  879. fn: function (aClass,aStream){
  880. var self=this;
  881. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  882. return smalltalk.withContext(function($ctx1) {
  883. var $1,$2,$3;
  884. _st(aStream)._lf();
  885. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  886. if(! smalltalk.assert($1)){
  887. $2=aStream;
  888. _st($2)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._class())));
  889. $3=_st($2)._nextPutAll_(".iVarNames = [");
  890. $3;
  891. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  892. return smalltalk.withContext(function($ctx2) {
  893. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  894. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  895. return smalltalk.withContext(function($ctx2) {
  896. return _st(aStream)._nextPutAll_(",");
  897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  898. _st(aStream)._nextPutAll_("];".__comma(_st($String())._lf()));
  899. };
  900. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter.klass)})},
  901. messageSends: ["lf", "ifFalse:", "nextPutAll:", ",", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "isEmpty"]}),
  902. smalltalk.Exporter.klass);
  903. smalltalk.addMethod(
  904. smalltalk.method({
  905. selector: "exportMethod:on:",
  906. fn: function (aMethod,aStream){
  907. var self=this;
  908. return smalltalk.withContext(function($ctx1) {
  909. var $1,$2,$3,$4;
  910. $1=aStream;
  911. _st($1)._nextPutAll_("smalltalk.addMethod(");
  912. _st($1)._lf();
  913. _st($1)._nextPutAll_("smalltalk.method({");
  914. _st($1)._lf();
  915. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  916. _st($1)._lf();
  917. _st($1)._nextPutAll_(_st("category: '".__comma(_st(aMethod)._category())).__comma("',"));
  918. _st($1)._lf();
  919. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  920. _st($1)._lf();
  921. _st($1)._nextPutAll_(_st("args: ".__comma(_st(_st(aMethod)._arguments())._asJavascript())).__comma(","));
  922. _st($1)._lf();
  923. _st($1)._nextPutAll_(_st("source: ".__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
  924. _st($1)._lf();
  925. _st($1)._nextPutAll_(_st("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript())).__comma(","));
  926. _st($1)._lf();
  927. $2=_st($1)._nextPutAll_("referencedClasses: ".__comma(_st(_st(aMethod)._referencedClasses())._asJavascript()));
  928. $3=aStream;
  929. _st($3)._lf();
  930. _st($3)._nextPutAll_("}),");
  931. _st($3)._lf();
  932. _st($3)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
  933. _st($3)._nextPutAll_(");");
  934. _st($3)._lf();
  935. $4=_st($3)._lf();
  936. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.Exporter.klass)})},
  937. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "category", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:", "methodClass"]}),
  938. smalltalk.Exporter.klass);
  939. smalltalk.addMethod(
  940. smalltalk.method({
  941. selector: "exportPackageDefinitionOf:on:",
  942. fn: function (package_,aStream){
  943. var self=this;
  944. return smalltalk.withContext(function($ctx1) {
  945. var $1,$2;
  946. $1=aStream;
  947. _st($1)._nextPutAll_("smalltalk.addPackage(");
  948. _st($1)._nextPutAll_(_st("'".__comma(_st(package_)._name())).__comma("');"));
  949. $2=_st($1)._lf();
  950. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{package_:package_,aStream:aStream},smalltalk.Exporter.klass)})},
  951. messageSends: ["nextPutAll:", ",", "name", "lf"]}),
  952. smalltalk.Exporter.klass);
  953. smalltalk.addMethod(
  954. smalltalk.method({
  955. selector: "exportPackageEpilogueOf:on:",
  956. fn: function (aPackage,aStream){
  957. var self=this;
  958. return smalltalk.withContext(function($ctx1) {
  959. var $1,$2;
  960. $1=aStream;
  961. _st($1)._nextPutAll_("})(global_smalltalk,global_nil,global__st);");
  962. $2=_st($1)._lf();
  963. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter.klass)})},
  964. messageSends: ["nextPutAll:", "lf"]}),
  965. smalltalk.Exporter.klass);
  966. smalltalk.addMethod(
  967. smalltalk.method({
  968. selector: "exportPackagePrologueOf:on:",
  969. fn: function (aPackage,aStream){
  970. var self=this;
  971. return smalltalk.withContext(function($ctx1) {
  972. var $1,$2;
  973. $1=aStream;
  974. _st($1)._nextPutAll_("(function(smalltalk,nil,_st){");
  975. $2=_st($1)._lf();
  976. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter.klass)})},
  977. messageSends: ["nextPutAll:", "lf"]}),
  978. smalltalk.Exporter.klass);
  979. smalltalk.addMethod(
  980. smalltalk.method({
  981. selector: "extensionMethodsOfPackage:",
  982. fn: function (package_){
  983. var self=this;
  984. var name,result;
  985. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  986. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  987. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  988. return smalltalk.withContext(function($ctx1) {
  989. var $1;
  990. name=_st(package_)._name();
  991. result=_st($OrderedCollection())._new();
  992. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  993. return smalltalk.withContext(function($ctx2) {
  994. return _st([each,_st(each)._class()])._do_((function(aClass){
  995. return smalltalk.withContext(function($ctx3) {
  996. return _st(result)._addAll_(_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  997. return smalltalk.withContext(function($ctx4) {
  998. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  999. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._select_((function(method){
  1000. return smalltalk.withContext(function($ctx4) {
  1001. return _st(_st(method)._category())._match_("^\x5c*".__comma(name));
  1002. }, function($ctx4) {$ctx4.fillBlock({method:method},$ctx3)})})));
  1003. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  1004. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1005. $1=result;
  1006. return $1;
  1007. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{package_:package_,name:name,result:result},smalltalk.Exporter.klass)})},
  1008. messageSends: ["name", "new", "do:", "addAll:", "select:", "match:", ",", "category", "sorted:", "<=", "selector", "values", "methodDictionary", "class", "sortedClasses:", "classes", "current"]}),
  1009. smalltalk.Exporter.klass);
  1010. smalltalk.addMethod(
  1011. smalltalk.method({
  1012. selector: "ownMethodsOfClass:",
  1013. fn: function (aClass){
  1014. var self=this;
  1015. return smalltalk.withContext(function($ctx1) {
  1016. var $1;
  1017. $1=_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  1018. return smalltalk.withContext(function($ctx2) {
  1019. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  1020. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._reject_((function(each){
  1021. return smalltalk.withContext(function($ctx2) {
  1022. return _st(_st(each)._category())._match_("^\x5c*");
  1023. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1024. return $1;
  1025. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},smalltalk.Exporter.klass)})},
  1026. messageSends: ["reject:", "match:", "category", "sorted:", "<=", "selector", "values", "methodDictionary"]}),
  1027. smalltalk.Exporter.klass);
  1028. smalltalk.addMethod(
  1029. smalltalk.method({
  1030. selector: "ownMethodsOfMetaClass:",
  1031. fn: function (aClass){
  1032. var self=this;
  1033. return smalltalk.withContext(function($ctx1) {
  1034. var $1;
  1035. $1=self._ownMethodsOfClass_(_st(aClass)._class());
  1036. return $1;
  1037. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},smalltalk.Exporter.klass)})},
  1038. messageSends: ["ownMethodsOfClass:", "class"]}),
  1039. smalltalk.Exporter.klass);
  1040. smalltalk.addMethod(
  1041. smalltalk.method({
  1042. selector: "recipe",
  1043. fn: function (){
  1044. var self=this;
  1045. function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
  1046. return smalltalk.withContext(function($ctx1) {
  1047. var $1;
  1048. $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:")];
  1049. return $1;
  1050. }, function($ctx1) {$ctx1.fill(self,"recipe",{},smalltalk.Exporter.klass)})},
  1051. messageSends: ["->"]}),
  1052. smalltalk.Exporter.klass);
  1053. smalltalk.addClass('StrippedExporter', smalltalk.Exporter, [], 'Importer-Exporter');
  1054. smalltalk.addMethod(
  1055. smalltalk.method({
  1056. selector: "exportDefinitionOf:on:",
  1057. fn: function (aClass,aStream){
  1058. var self=this;
  1059. return smalltalk.withContext(function($ctx1) {
  1060. var $1,$2,$3,$4;
  1061. $1=aStream;
  1062. _st($1)._lf();
  1063. _st($1)._nextPutAll_("smalltalk.addClass(");
  1064. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  1065. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  1066. $2=_st($1)._nextPutAll_(", [");
  1067. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  1068. return smalltalk.withContext(function($ctx2) {
  1069. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  1070. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  1071. return smalltalk.withContext(function($ctx2) {
  1072. return _st(aStream)._nextPutAll_(", ");
  1073. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1074. $3=aStream;
  1075. _st($3)._nextPutAll_("], '");
  1076. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  1077. $4=_st($3)._nextPutAll_(");");
  1078. _st(aStream)._lf();
  1079. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.StrippedExporter)})},
  1080. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category"]}),
  1081. smalltalk.StrippedExporter);
  1082. smalltalk.addMethod(
  1083. smalltalk.method({
  1084. selector: "exportMethod:on:",
  1085. fn: function (aMethod,aStream){
  1086. var self=this;
  1087. return smalltalk.withContext(function($ctx1) {
  1088. var $1,$2;
  1089. $1=aStream;
  1090. _st($1)._nextPutAll_("smalltalk.addMethod(");
  1091. _st($1)._lf();
  1092. _st($1)._nextPutAll_("smalltalk.method({");
  1093. _st($1)._lf();
  1094. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  1095. _st($1)._lf();
  1096. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  1097. _st($1)._lf();
  1098. _st($1)._nextPutAll_("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript()));
  1099. _st($1)._nextPutAll_("}),");
  1100. _st($1)._lf();
  1101. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
  1102. _st($1)._nextPutAll_(");");
  1103. _st($1)._lf();
  1104. $2=_st($1)._lf();
  1105. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.StrippedExporter)})},
  1106. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "compiledSource", "fn", "messageSends", "classNameFor:", "methodClass"]}),
  1107. smalltalk.StrippedExporter);
  1108. smalltalk.addMethod(
  1109. smalltalk.method({
  1110. selector: "exportDefinitionOf:on:",
  1111. fn: function (aClass,aStream){
  1112. var self=this;
  1113. return smalltalk.withContext(function($ctx1) {
  1114. var $1,$2,$3,$4;
  1115. $1=aStream;
  1116. _st($1)._lf();
  1117. _st($1)._nextPutAll_("smalltalk.addClass(");
  1118. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  1119. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  1120. $2=_st($1)._nextPutAll_(", [");
  1121. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  1122. return smalltalk.withContext(function($ctx2) {
  1123. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  1124. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  1125. return smalltalk.withContext(function($ctx2) {
  1126. return _st(aStream)._nextPutAll_(", ");
  1127. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1128. $3=aStream;
  1129. _st($3)._nextPutAll_("], '");
  1130. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  1131. $4=_st($3)._nextPutAll_(");");
  1132. _st(aStream)._lf();
  1133. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.StrippedExporter.klass)})},
  1134. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category"]}),
  1135. smalltalk.StrippedExporter.klass);
  1136. smalltalk.addMethod(
  1137. smalltalk.method({
  1138. selector: "exportMethod:on:",
  1139. fn: function (aMethod,aStream){
  1140. var self=this;
  1141. return smalltalk.withContext(function($ctx1) {
  1142. var $1,$2;
  1143. $1=aStream;
  1144. _st($1)._nextPutAll_("smalltalk.addMethod(");
  1145. _st($1)._lf();
  1146. _st($1)._nextPutAll_("smalltalk.method({");
  1147. _st($1)._lf();
  1148. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  1149. _st($1)._lf();
  1150. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  1151. _st($1)._lf();
  1152. _st($1)._nextPutAll_("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript()));
  1153. _st($1)._nextPutAll_("}),");
  1154. _st($1)._lf();
  1155. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
  1156. _st($1)._nextPutAll_(");");
  1157. _st($1)._lf();
  1158. $2=_st($1)._lf();
  1159. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.StrippedExporter.klass)})},
  1160. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "compiledSource", "fn", "messageSends", "classNameFor:", "methodClass"]}),
  1161. smalltalk.StrippedExporter.klass);
  1162. smalltalk.addClass('ChunkParser', smalltalk.Object, ['stream'], 'Importer-Exporter');
  1163. smalltalk.addMethod(
  1164. smalltalk.method({
  1165. selector: "nextChunk",
  1166. fn: function (){
  1167. var self=this;
  1168. var char,result,chunk;
  1169. return smalltalk.withContext(function($ctx1) {
  1170. var $1,$2,$3;
  1171. var $early={};
  1172. try {
  1173. result=""._writeStream();
  1174. _st((function(){
  1175. return smalltalk.withContext(function($ctx2) {
  1176. char=_st(self["@stream"])._next();
  1177. char;
  1178. return _st(char)._notNil();
  1179. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  1180. return smalltalk.withContext(function($ctx2) {
  1181. $1=_st(char).__eq("!");
  1182. if(smalltalk.assert($1)){
  1183. $2=_st(_st(self["@stream"])._peek()).__eq("!");
  1184. if(smalltalk.assert($2)){
  1185. _st(self["@stream"])._next();
  1186. } else {
  1187. $3=_st(_st(result)._contents())._trimBoth();
  1188. throw $early=[$3];
  1189. };
  1190. };
  1191. return _st(result)._nextPut_(char);
  1192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1193. return nil;
  1194. }
  1195. catch(e) {if(e===$early)return e[0]; throw e}
  1196. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},smalltalk.ChunkParser)})},
  1197. messageSends: ["writeStream", "whileTrue:", "ifTrue:", "ifTrue:ifFalse:", "next", "trimBoth", "contents", "=", "peek", "nextPut:", "notNil"]}),
  1198. smalltalk.ChunkParser);
  1199. smalltalk.addMethod(
  1200. smalltalk.method({
  1201. selector: "stream:",
  1202. fn: function (aStream){
  1203. var self=this;
  1204. return smalltalk.withContext(function($ctx1) {
  1205. self["@stream"]=aStream;
  1206. return self}, function($ctx1) {$ctx1.fill(self,"stream:",{aStream:aStream},smalltalk.ChunkParser)})},
  1207. messageSends: []}),
  1208. smalltalk.ChunkParser);
  1209. smalltalk.addMethod(
  1210. smalltalk.method({
  1211. selector: "on:",
  1212. fn: function (aStream){
  1213. var self=this;
  1214. return smalltalk.withContext(function($ctx1) {
  1215. var $1;
  1216. $1=_st(self._new())._stream_(aStream);
  1217. return $1;
  1218. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},smalltalk.ChunkParser.klass)})},
  1219. messageSends: ["stream:", "new"]}),
  1220. smalltalk.ChunkParser.klass);
  1221. smalltalk.addClass('Importer', smalltalk.Object, [], 'Importer-Exporter');
  1222. smalltalk.addMethod(
  1223. smalltalk.method({
  1224. selector: "import:",
  1225. fn: function (aStream){
  1226. var self=this;
  1227. var chunk,result,parser,lastEmpty;
  1228. function $ChunkParser(){return smalltalk.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  1229. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  1230. return smalltalk.withContext(function($ctx1) {
  1231. var $1,$2;
  1232. parser=_st($ChunkParser())._on_(aStream);
  1233. lastEmpty=false;
  1234. _st((function(){
  1235. return smalltalk.withContext(function($ctx2) {
  1236. chunk=_st(parser)._nextChunk();
  1237. chunk;
  1238. return _st(chunk)._isNil();
  1239. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  1240. return smalltalk.withContext(function($ctx2) {
  1241. $1=_st(chunk)._isEmpty();
  1242. if(smalltalk.assert($1)){
  1243. lastEmpty=true;
  1244. return lastEmpty;
  1245. } else {
  1246. result=_st(_st($Compiler())._new())._evaluateExpression_(chunk);
  1247. result;
  1248. $2=lastEmpty;
  1249. if(smalltalk.assert($2)){
  1250. lastEmpty=false;
  1251. lastEmpty;
  1252. return _st(result)._scanFrom_(parser);
  1253. };
  1254. };
  1255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1256. return self}, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},smalltalk.Importer)})},
  1257. messageSends: ["on:", "whileFalse:", "ifTrue:ifFalse:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "isEmpty", "nextChunk", "isNil"]}),
  1258. smalltalk.Importer);
  1259. smalltalk.addClass('MethodCategory', smalltalk.Object, ['methods', 'name', 'theClass'], 'Importer-Exporter');
  1260. smalltalk.addMethod(
  1261. smalltalk.method({
  1262. selector: "methods",
  1263. fn: function (){
  1264. var self=this;
  1265. return smalltalk.withContext(function($ctx1) {
  1266. var $1;
  1267. $1=self["@methods"];
  1268. return $1;
  1269. }, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.MethodCategory)})},
  1270. messageSends: []}),
  1271. smalltalk.MethodCategory);
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "methods:",
  1275. fn: function (anArray){
  1276. var self=this;
  1277. return smalltalk.withContext(function($ctx1) {
  1278. self["@methods"]=anArray;
  1279. return self}, function($ctx1) {$ctx1.fill(self,"methods:",{anArray:anArray},smalltalk.MethodCategory)})},
  1280. messageSends: []}),
  1281. smalltalk.MethodCategory);
  1282. smalltalk.addMethod(
  1283. smalltalk.method({
  1284. selector: "name",
  1285. fn: function (){
  1286. var self=this;
  1287. return smalltalk.withContext(function($ctx1) {
  1288. var $1;
  1289. $1=self["@name"];
  1290. return $1;
  1291. }, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.MethodCategory)})},
  1292. messageSends: []}),
  1293. smalltalk.MethodCategory);
  1294. smalltalk.addMethod(
  1295. smalltalk.method({
  1296. selector: "name:",
  1297. fn: function (aString){
  1298. var self=this;
  1299. return smalltalk.withContext(function($ctx1) {
  1300. self["@name"]=aString;
  1301. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.MethodCategory)})},
  1302. messageSends: []}),
  1303. smalltalk.MethodCategory);
  1304. smalltalk.addMethod(
  1305. smalltalk.method({
  1306. selector: "theClass",
  1307. fn: function (){
  1308. var self=this;
  1309. return smalltalk.withContext(function($ctx1) {
  1310. var $1;
  1311. $1=self["@theClass"];
  1312. return $1;
  1313. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.MethodCategory)})},
  1314. messageSends: []}),
  1315. smalltalk.MethodCategory);
  1316. smalltalk.addMethod(
  1317. smalltalk.method({
  1318. selector: "theClass:",
  1319. fn: function (aClass){
  1320. var self=this;
  1321. return smalltalk.withContext(function($ctx1) {
  1322. self["@theClass"]=aClass;
  1323. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.MethodCategory)})},
  1324. messageSends: []}),
  1325. smalltalk.MethodCategory);
  1326. smalltalk.addMethod(
  1327. smalltalk.method({
  1328. selector: "name:theClass:methods:",
  1329. fn: function (aString,aClass,anArray){
  1330. var self=this;
  1331. return smalltalk.withContext(function($ctx1) {
  1332. var $2,$3,$1;
  1333. $2=self._new();
  1334. _st($2)._name_(aString);
  1335. _st($2)._theClass_(aClass);
  1336. _st($2)._methods_(anArray);
  1337. $3=_st($2)._yourself();
  1338. $1=$3;
  1339. return $1;
  1340. }, function($ctx1) {$ctx1.fill(self,"name:theClass:methods:",{aString:aString,aClass:aClass,anArray:anArray},smalltalk.MethodCategory.klass)})},
  1341. messageSends: ["name:", "new", "theClass:", "methods:", "yourself"]}),
  1342. smalltalk.MethodCategory.klass);
  1343. smalltalk.addClass('PackageHandler', smalltalk.InterfacingObject, [], 'Importer-Exporter');
  1344. smalltalk.addMethod(
  1345. smalltalk.method({
  1346. selector: "ajaxPutAt:data:",
  1347. fn: function (aURL,aString){
  1348. var self=this;
  1349. return smalltalk.withContext(function($ctx1) {
  1350. self._ajax_(smalltalk.HashedCollection._from_(["url".__minus_gt(aURL),"type".__minus_gt("PUT"),"data".__minus_gt(aString),"contentType".__minus_gt("text/plain;charset=UTF-8"),"error".__minus_gt((function(xhr){
  1351. return smalltalk.withContext(function($ctx2) {
  1352. return self._error_(_st(_st(_st("Commiting ".__comma(aURL)).__comma(" failed with reason: \x22")).__comma(_st(xhr)._responseText())).__comma("\x22"));
  1353. }, function($ctx2) {$ctx2.fillBlock({xhr:xhr},$ctx1)})}))]));
  1354. return self}, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:",{aURL:aURL,aString:aString},smalltalk.PackageHandler)})},
  1355. messageSends: ["ajax:", "->", "error:", ",", "responseText"]}),
  1356. smalltalk.PackageHandler);
  1357. smalltalk.addMethod(
  1358. smalltalk.method({
  1359. selector: "commit:",
  1360. fn: function (aPackage){
  1361. var self=this;
  1362. function $PluggableExporter(){return smalltalk.PluggableExporter||(typeof PluggableExporter=="undefined"?nil:PluggableExporter)}
  1363. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1364. return smalltalk.withContext(function($ctx1) {
  1365. _st(self._commitChannels())._do_displayingProgress_((function(commitStrategyFactory){
  1366. var fileContents,commitStrategy;
  1367. return smalltalk.withContext(function($ctx2) {
  1368. commitStrategy=_st(commitStrategyFactory)._value_(aPackage);
  1369. commitStrategy;
  1370. fileContents=_st($String())._streamContents_((function(stream){
  1371. return smalltalk.withContext(function($ctx3) {
  1372. return _st(_st($PluggableExporter())._newUsing_(_st(commitStrategy)._key()))._exportPackage_on_(aPackage,stream);
  1373. }, function($ctx3) {$ctx3.fillBlock({stream:stream},$ctx2)})}));
  1374. fileContents;
  1375. return self._ajaxPutAt_data_(_st(commitStrategy)._value(),fileContents);
  1376. }, function($ctx2) {$ctx2.fillBlock({commitStrategyFactory:commitStrategyFactory,fileContents:fileContents,commitStrategy:commitStrategy},$ctx1)})}),"Committing package ".__comma(_st(aPackage)._name()));
  1377. return self}, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  1378. messageSends: ["do:displayingProgress:", "value:", "streamContents:", "exportPackage:on:", "newUsing:", "key", "ajaxPutAt:data:", "value", ",", "name", "commitChannels"]}),
  1379. smalltalk.PackageHandler);
  1380. smalltalk.addMethod(
  1381. smalltalk.method({
  1382. selector: "commitChannels",
  1383. fn: function (){
  1384. var self=this;
  1385. return smalltalk.withContext(function($ctx1) {
  1386. self._subclassResponsibility();
  1387. return self}, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.PackageHandler)})},
  1388. messageSends: ["subclassResponsibility"]}),
  1389. smalltalk.PackageHandler);
  1390. smalltalk.PackageHandler.klass.iVarNames = ['registry'];
  1391. smalltalk.addMethod(
  1392. smalltalk.method({
  1393. selector: "classRegisteredFor:",
  1394. fn: function (aString){
  1395. var self=this;
  1396. return smalltalk.withContext(function($ctx1) {
  1397. var $1;
  1398. $1=_st(self["@registry"])._at_(aString);
  1399. return $1;
  1400. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},smalltalk.PackageHandler.klass)})},
  1401. messageSends: ["at:"]}),
  1402. smalltalk.PackageHandler.klass);
  1403. smalltalk.addMethod(
  1404. smalltalk.method({
  1405. selector: "for:",
  1406. fn: function (aString){
  1407. var self=this;
  1408. return smalltalk.withContext(function($ctx1) {
  1409. var $1;
  1410. $1=_st(self._classRegisteredFor_(aString))._new();
  1411. return $1;
  1412. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},smalltalk.PackageHandler.klass)})},
  1413. messageSends: ["new", "classRegisteredFor:"]}),
  1414. smalltalk.PackageHandler.klass);
  1415. smalltalk.addMethod(
  1416. smalltalk.method({
  1417. selector: "initialize",
  1418. fn: function (){
  1419. var self=this;
  1420. return smalltalk.withContext(function($ctx1) {
  1421. smalltalk.PackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  1422. self["@registry"]=smalltalk.HashedCollection._from_([]);
  1423. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.PackageHandler.klass)})},
  1424. messageSends: ["initialize"]}),
  1425. smalltalk.PackageHandler.klass);
  1426. smalltalk.addMethod(
  1427. smalltalk.method({
  1428. selector: "register:for:",
  1429. fn: function (aClass,aString){
  1430. var self=this;
  1431. return smalltalk.withContext(function($ctx1) {
  1432. _st(self["@registry"])._at_put_(aString,aClass);
  1433. return self}, function($ctx1) {$ctx1.fill(self,"register:for:",{aClass:aClass,aString:aString},smalltalk.PackageHandler.klass)})},
  1434. messageSends: ["at:put:"]}),
  1435. smalltalk.PackageHandler.klass);
  1436. smalltalk.addMethod(
  1437. smalltalk.method({
  1438. selector: "registerFor:",
  1439. fn: function (aString){
  1440. var self=this;
  1441. function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
  1442. return smalltalk.withContext(function($ctx1) {
  1443. _st($PackageHandler())._register_for_(self,aString);
  1444. return self}, function($ctx1) {$ctx1.fill(self,"registerFor:",{aString:aString},smalltalk.PackageHandler.klass)})},
  1445. messageSends: ["register:for:"]}),
  1446. smalltalk.PackageHandler.klass);
  1447. smalltalk.addClass('LegacyPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
  1448. smalltalk.addMethod(
  1449. smalltalk.method({
  1450. selector: "commitChannels",
  1451. fn: function (){
  1452. var self=this;
  1453. function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  1454. function $StrippedExporter(){return smalltalk.StrippedExporter||(typeof StrippedExporter=="undefined"?nil:StrippedExporter)}
  1455. function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  1456. return smalltalk.withContext(function($ctx1) {
  1457. var $1;
  1458. $1=[(function(pkg){
  1459. return smalltalk.withContext(function($ctx2) {
  1460. return _st(_st(_st($Exporter())._default())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".js"));
  1461. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  1462. return smalltalk.withContext(function($ctx2) {
  1463. return _st(_st(_st($StrippedExporter())._default())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".deploy.js"));
  1464. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  1465. return smalltalk.withContext(function($ctx2) {
  1466. return _st(_st(_st($ChunkExporter())._default())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathSt()).__comma("/")).__comma(_st(pkg)._name())).__comma(".st"));
  1467. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})})];
  1468. return $1;
  1469. }, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.LegacyPackageHandler)})},
  1470. messageSends: ["->", ",", "name", "commitPathJs", "recipe", "default", "commitPathSt"]}),
  1471. smalltalk.LegacyPackageHandler);
  1472. smalltalk.addMethod(
  1473. smalltalk.method({
  1474. selector: "commitPathJsFor:",
  1475. fn: function (aPackage){
  1476. var self=this;
  1477. return smalltalk.withContext(function($ctx1) {
  1478. var $1;
  1479. $1=_st(self._class())._defaultCommitPathJs();
  1480. return $1;
  1481. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
  1482. messageSends: ["defaultCommitPathJs", "class"]}),
  1483. smalltalk.LegacyPackageHandler);
  1484. smalltalk.addMethod(
  1485. smalltalk.method({
  1486. selector: "commitPathStFor:",
  1487. fn: function (aPackage){
  1488. var self=this;
  1489. return smalltalk.withContext(function($ctx1) {
  1490. var $1;
  1491. $1=_st(self._class())._defaultCommitPathSt();
  1492. return $1;
  1493. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
  1494. messageSends: ["defaultCommitPathSt", "class"]}),
  1495. smalltalk.LegacyPackageHandler);
  1496. smalltalk.addMethod(
  1497. smalltalk.method({
  1498. selector: "loadPackage:prefix:",
  1499. fn: function (packageName,aString){
  1500. var self=this;
  1501. var url;
  1502. return smalltalk.withContext(function($ctx1) {
  1503. var $1;
  1504. url=_st(_st(_st("/".__comma(aString)).__comma("/js/")).__comma(packageName)).__comma(".js");
  1505. self._ajax_(smalltalk.HashedCollection._from_(["url".__minus_gt(url),"type".__minus_gt("GET"),"dataType".__minus_gt("script"),"complete".__minus_gt((function(jqXHR,textStatus){
  1506. return smalltalk.withContext(function($ctx2) {
  1507. $1=_st(_st(jqXHR)._readyState()).__eq((4));
  1508. if(smalltalk.assert($1)){
  1509. return self._setupPackageNamed_prefix_(packageName,aString);
  1510. };
  1511. }, function($ctx2) {$ctx2.fillBlock({jqXHR:jqXHR,textStatus:textStatus},$ctx1)})})),"error".__minus_gt((function(){
  1512. return smalltalk.withContext(function($ctx2) {
  1513. return self._alert_("Could not load package at: ".__comma(url));
  1514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))]));
  1515. return self}, function($ctx1) {$ctx1.fill(self,"loadPackage:prefix:",{packageName:packageName,aString:aString,url:url},smalltalk.LegacyPackageHandler)})},
  1516. messageSends: [",", "ajax:", "->", "ifTrue:", "setupPackageNamed:prefix:", "=", "readyState", "alert:"]}),
  1517. smalltalk.LegacyPackageHandler);
  1518. smalltalk.addMethod(
  1519. smalltalk.method({
  1520. selector: "loadPackages:prefix:",
  1521. fn: function (aCollection,aString){
  1522. var self=this;
  1523. return smalltalk.withContext(function($ctx1) {
  1524. _st(aCollection)._do_((function(each){
  1525. return smalltalk.withContext(function($ctx2) {
  1526. return self._loadPackage_prefix_(each,aString);
  1527. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1528. return self}, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler)})},
  1529. messageSends: ["do:", "loadPackage:prefix:"]}),
  1530. smalltalk.LegacyPackageHandler);
  1531. smalltalk.addMethod(
  1532. smalltalk.method({
  1533. selector: "setupPackageNamed:prefix:",
  1534. fn: function (packageName,aString){
  1535. var self=this;
  1536. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  1537. return smalltalk.withContext(function($ctx1) {
  1538. var $1,$2;
  1539. $1=_st($Package())._named_(packageName);
  1540. _st($1)._setupClasses();
  1541. _st($1)._commitPathJs_(_st("/".__comma(aString)).__comma("/js"));
  1542. $2=_st($1)._commitPathSt_(_st("/".__comma(aString)).__comma("/st"));
  1543. return self}, function($ctx1) {$ctx1.fill(self,"setupPackageNamed:prefix:",{packageName:packageName,aString:aString},smalltalk.LegacyPackageHandler)})},
  1544. messageSends: ["setupClasses", "named:", "commitPathJs:", ",", "commitPathSt:"]}),
  1545. smalltalk.LegacyPackageHandler);
  1546. smalltalk.LegacyPackageHandler.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  1547. smalltalk.addMethod(
  1548. smalltalk.method({
  1549. selector: "commitPathsFromLoader",
  1550. fn: function (){
  1551. var self=this;
  1552. return smalltalk.withContext(function($ctx1) {
  1553. var commitPath = typeof amber !== 'undefined' && amber.commitPath;
  1554. if (!commitPath) return;
  1555. if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);
  1556. if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);
  1557. ;
  1558. return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.LegacyPackageHandler.klass)})},
  1559. messageSends: []}),
  1560. smalltalk.LegacyPackageHandler.klass);
  1561. smalltalk.addMethod(
  1562. smalltalk.method({
  1563. selector: "defaultCommitPathJs",
  1564. fn: function (){
  1565. var self=this;
  1566. return smalltalk.withContext(function($ctx1) {
  1567. var $2,$1;
  1568. $2=self["@defaultCommitPathJs"];
  1569. if(($receiver = $2) == nil || $receiver == undefined){
  1570. self["@defaultCommitPathJs"]="js";
  1571. $1=self["@defaultCommitPathJs"];
  1572. } else {
  1573. $1=$2;
  1574. };
  1575. return $1;
  1576. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs",{},smalltalk.LegacyPackageHandler.klass)})},
  1577. messageSends: ["ifNil:"]}),
  1578. smalltalk.LegacyPackageHandler.klass);
  1579. smalltalk.addMethod(
  1580. smalltalk.method({
  1581. selector: "defaultCommitPathJs:",
  1582. fn: function (aString){
  1583. var self=this;
  1584. return smalltalk.withContext(function($ctx1) {
  1585. self["@defaultCommitPathJs"]=aString;
  1586. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1587. messageSends: []}),
  1588. smalltalk.LegacyPackageHandler.klass);
  1589. smalltalk.addMethod(
  1590. smalltalk.method({
  1591. selector: "defaultCommitPathSt",
  1592. fn: function (){
  1593. var self=this;
  1594. return smalltalk.withContext(function($ctx1) {
  1595. var $2,$1;
  1596. $2=self["@defaultCommitPathSt"];
  1597. if(($receiver = $2) == nil || $receiver == undefined){
  1598. self["@defaultCommitPathSt"]="st";
  1599. $1=self["@defaultCommitPathSt"];
  1600. } else {
  1601. $1=$2;
  1602. };
  1603. return $1;
  1604. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt",{},smalltalk.LegacyPackageHandler.klass)})},
  1605. messageSends: ["ifNil:"]}),
  1606. smalltalk.LegacyPackageHandler.klass);
  1607. smalltalk.addMethod(
  1608. smalltalk.method({
  1609. selector: "defaultCommitPathSt:",
  1610. fn: function (aString){
  1611. var self=this;
  1612. return smalltalk.withContext(function($ctx1) {
  1613. self["@defaultCommitPathSt"]=aString;
  1614. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1615. messageSends: []}),
  1616. smalltalk.LegacyPackageHandler.klass);
  1617. smalltalk.addMethod(
  1618. smalltalk.method({
  1619. selector: "initialize",
  1620. fn: function (){
  1621. var self=this;
  1622. return smalltalk.withContext(function($ctx1) {
  1623. smalltalk.LegacyPackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  1624. self._registerFor_("unknown");
  1625. self._commitPathsFromLoader();
  1626. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.LegacyPackageHandler.klass)})},
  1627. messageSends: ["initialize", "registerFor:", "commitPathsFromLoader"]}),
  1628. smalltalk.LegacyPackageHandler.klass);
  1629. smalltalk.addMethod(
  1630. smalltalk.method({
  1631. selector: "loadPackages:prefix:",
  1632. fn: function (aCollection,aString){
  1633. var self=this;
  1634. return smalltalk.withContext(function($ctx1) {
  1635. var $1;
  1636. $1=_st(self._new())._loadPackages_prefix_(aCollection,aString);
  1637. return $1;
  1638. }, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1639. messageSends: ["loadPackages:prefix:", "new"]}),
  1640. smalltalk.LegacyPackageHandler.klass);
  1641. smalltalk.addMethod(
  1642. smalltalk.method({
  1643. selector: "resetCommitPaths",
  1644. fn: function (){
  1645. var self=this;
  1646. return smalltalk.withContext(function($ctx1) {
  1647. self["@defaultCommitPathJs"]=nil;
  1648. self["@defaultCommitPathSt"]=nil;
  1649. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.LegacyPackageHandler.klass)})},
  1650. messageSends: []}),
  1651. smalltalk.LegacyPackageHandler.klass);
  1652. smalltalk.addClass('PluggableExporter', smalltalk.Object, ['recipe'], 'Importer-Exporter');
  1653. smalltalk.addMethod(
  1654. smalltalk.method({
  1655. selector: "export:usingRecipe:on:",
  1656. fn: function (anObject,anArray,aStream){
  1657. var self=this;
  1658. var args;
  1659. return smalltalk.withContext(function($ctx1) {
  1660. var $1;
  1661. args=[anObject,aStream];
  1662. _st(anArray)._do_((function(each){
  1663. var val;
  1664. return smalltalk.withContext(function($ctx2) {
  1665. val=_st(each)._value();
  1666. val;
  1667. $1=_st(val).__eq_eq(each);
  1668. if(smalltalk.assert($1)){
  1669. var selection;
  1670. selection=_st(_st(_st(each)._first())._key())._perform_withArguments_(_st(_st(each)._first())._value(),[anObject]);
  1671. selection;
  1672. return _st(selection)._do_((function(eachPart){
  1673. return smalltalk.withContext(function($ctx3) {
  1674. return self._export_usingRecipe_on_(eachPart,_st(each)._allButFirst(),aStream);
  1675. }, function($ctx3) {$ctx3.fillBlock({eachPart:eachPart},$ctx2)})}));
  1676. } else {
  1677. return _st(_st(each)._key())._perform_withArguments_(val,args);
  1678. };
  1679. }, function($ctx2) {$ctx2.fillBlock({each:each,val:val},$ctx1)})}));
  1680. return self}, function($ctx1) {$ctx1.fill(self,"export:usingRecipe:on:",{anObject:anObject,anArray:anArray,aStream:aStream,args:args},smalltalk.PluggableExporter)})},
  1681. messageSends: ["do:", "value", "ifFalse:ifTrue:", "perform:withArguments:", "key", "first", "export:usingRecipe:on:", "allButFirst", "=="]}),
  1682. smalltalk.PluggableExporter);
  1683. smalltalk.addMethod(
  1684. smalltalk.method({
  1685. selector: "exportAll",
  1686. fn: function (){
  1687. var self=this;
  1688. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1689. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1690. return smalltalk.withContext(function($ctx1) {
  1691. var $1;
  1692. $1=_st($String())._streamContents_((function(stream){
  1693. return smalltalk.withContext(function($ctx2) {
  1694. return _st(_st(_st($Smalltalk())._current())._packages())._do_((function(pkg){
  1695. return smalltalk.withContext(function($ctx3) {
  1696. return self._exportPackage_on_(pkg,stream);
  1697. }, function($ctx3) {$ctx3.fillBlock({pkg:pkg},$ctx2)})}));
  1698. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  1699. return $1;
  1700. }, function($ctx1) {$ctx1.fill(self,"exportAll",{},smalltalk.PluggableExporter)})},
  1701. messageSends: ["streamContents:", "do:", "exportPackage:on:", "packages", "current"]}),
  1702. smalltalk.PluggableExporter);
  1703. smalltalk.addMethod(
  1704. smalltalk.method({
  1705. selector: "exportPackage:on:",
  1706. fn: function (aPackage,aStream){
  1707. var self=this;
  1708. return smalltalk.withContext(function($ctx1) {
  1709. self._export_usingRecipe_on_(aPackage,self._recipe(),aStream);
  1710. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},smalltalk.PluggableExporter)})},
  1711. messageSends: ["export:usingRecipe:on:", "recipe"]}),
  1712. smalltalk.PluggableExporter);
  1713. smalltalk.addMethod(
  1714. smalltalk.method({
  1715. selector: "recipe",
  1716. fn: function (){
  1717. var self=this;
  1718. return smalltalk.withContext(function($ctx1) {
  1719. var $1;
  1720. $1=self["@recipe"];
  1721. return $1;
  1722. }, function($ctx1) {$ctx1.fill(self,"recipe",{},smalltalk.PluggableExporter)})},
  1723. messageSends: []}),
  1724. smalltalk.PluggableExporter);
  1725. smalltalk.addMethod(
  1726. smalltalk.method({
  1727. selector: "recipe:",
  1728. fn: function (anArray){
  1729. var self=this;
  1730. return smalltalk.withContext(function($ctx1) {
  1731. self["@recipe"]=anArray;
  1732. return self}, function($ctx1) {$ctx1.fill(self,"recipe:",{anArray:anArray},smalltalk.PluggableExporter)})},
  1733. messageSends: []}),
  1734. smalltalk.PluggableExporter);
  1735. smalltalk.addMethod(
  1736. smalltalk.method({
  1737. selector: "newUsing:",
  1738. fn: function (recipe){
  1739. var self=this;
  1740. return smalltalk.withContext(function($ctx1) {
  1741. var $2,$3,$1;
  1742. $2=self._new();
  1743. _st($2)._recipe_(recipe);
  1744. $3=_st($2)._yourself();
  1745. $1=$3;
  1746. return $1;
  1747. }, function($ctx1) {$ctx1.fill(self,"newUsing:",{recipe:recipe},smalltalk.PluggableExporter.klass)})},
  1748. messageSends: ["recipe:", "new", "yourself"]}),
  1749. smalltalk.PluggableExporter.klass);
  1750. smalltalk.addMethod(
  1751. smalltalk.method({
  1752. selector: "ownClassesOfPackage:",
  1753. fn: function (package_){
  1754. var self=this;
  1755. return smalltalk.withContext(function($ctx1) {
  1756. var $1;
  1757. $1=_st(_st(package_)._sortedClasses())._asSet();
  1758. return $1;
  1759. }, function($ctx1) {$ctx1.fill(self,"ownClassesOfPackage:",{package_:package_},smalltalk.PluggableExporter.klass)})},
  1760. messageSends: ["asSet", "sortedClasses"]}),
  1761. smalltalk.PluggableExporter.klass);
  1762. smalltalk.addMethod(
  1763. smalltalk.method({
  1764. selector: "commit",
  1765. fn: function (){
  1766. var self=this;
  1767. return smalltalk.withContext(function($ctx1) {
  1768. var $1;
  1769. $1=_st(self._transport())._commit_(self);
  1770. return $1;
  1771. }, function($ctx1) {$ctx1.fill(self,"commit",{},smalltalk.Package)})},
  1772. messageSends: ["commit:", "transport"]}),
  1773. smalltalk.Package);
  1774. smalltalk.addMethod(
  1775. smalltalk.method({
  1776. selector: "commitPathJs",
  1777. fn: function (){
  1778. var self=this;
  1779. return smalltalk.withContext(function($ctx1) {
  1780. var $3,$2,$1;
  1781. $3=self["@extension"];
  1782. if(($receiver = $3) == nil || $receiver == undefined){
  1783. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1784. $2=self["@extension"];
  1785. } else {
  1786. $2=$3;
  1787. };
  1788. $1=_st($2)._at_ifAbsentPut_("commitPathJs",(function(){
  1789. return smalltalk.withContext(function($ctx2) {
  1790. return _st(self._transport())._commitPathJsFor_(self);
  1791. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1792. return $1;
  1793. }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
  1794. messageSends: ["at:ifAbsentPut:", "commitPathJsFor:", "transport", "ifNil:"]}),
  1795. smalltalk.Package);
  1796. smalltalk.addMethod(
  1797. smalltalk.method({
  1798. selector: "commitPathJs:",
  1799. fn: function (aString){
  1800. var self=this;
  1801. return smalltalk.withContext(function($ctx1) {
  1802. var $3,$2,$1;
  1803. $3=self["@extension"];
  1804. if(($receiver = $3) == nil || $receiver == undefined){
  1805. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1806. $2=self["@extension"];
  1807. } else {
  1808. $2=$3;
  1809. };
  1810. $1=_st($2)._at_put_("commitPathJs",aString);
  1811. return $1;
  1812. }, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
  1813. messageSends: ["at:put:", "ifNil:"]}),
  1814. smalltalk.Package);
  1815. smalltalk.addMethod(
  1816. smalltalk.method({
  1817. selector: "commitPathSt",
  1818. fn: function (){
  1819. var self=this;
  1820. return smalltalk.withContext(function($ctx1) {
  1821. var $3,$2,$1;
  1822. $3=self["@extension"];
  1823. if(($receiver = $3) == nil || $receiver == undefined){
  1824. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1825. $2=self["@extension"];
  1826. } else {
  1827. $2=$3;
  1828. };
  1829. $1=_st($2)._at_ifAbsentPut_("commitPathSt",(function(){
  1830. return smalltalk.withContext(function($ctx2) {
  1831. return _st(self._transport())._commitPathStFor_(self);
  1832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1833. return $1;
  1834. }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
  1835. messageSends: ["at:ifAbsentPut:", "commitPathStFor:", "transport", "ifNil:"]}),
  1836. smalltalk.Package);
  1837. smalltalk.addMethod(
  1838. smalltalk.method({
  1839. selector: "commitPathSt:",
  1840. fn: function (aString){
  1841. var self=this;
  1842. return smalltalk.withContext(function($ctx1) {
  1843. var $3,$2,$1;
  1844. $3=self["@extension"];
  1845. if(($receiver = $3) == nil || $receiver == undefined){
  1846. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1847. $2=self["@extension"];
  1848. } else {
  1849. $2=$3;
  1850. };
  1851. $1=_st($2)._at_put_("commitPathSt",aString);
  1852. return $1;
  1853. }, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
  1854. messageSends: ["at:put:", "ifNil:"]}),
  1855. smalltalk.Package);
  1856. smalltalk.addMethod(
  1857. smalltalk.method({
  1858. selector: "transport",
  1859. fn: function (){
  1860. var self=this;
  1861. function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
  1862. return smalltalk.withContext(function($ctx1) {
  1863. var $1;
  1864. $1=_st($PackageHandler())._for_(self._transportType());
  1865. return $1;
  1866. }, function($ctx1) {$ctx1.fill(self,"transport",{},smalltalk.Package)})},
  1867. messageSends: ["for:", "transportType"]}),
  1868. smalltalk.Package);
  1869. smalltalk.addMethod(
  1870. smalltalk.method({
  1871. selector: "transportType",
  1872. fn: function (){
  1873. var self=this;
  1874. return smalltalk.withContext(function($ctx1) {
  1875. return (self.transport && self.transport.type) || 'unknown';;
  1876. return self}, function($ctx1) {$ctx1.fill(self,"transportType",{},smalltalk.Package)})},
  1877. messageSends: []}),
  1878. smalltalk.Package);
  1879. })(global_smalltalk,global_nil,global__st);