Importer-Exporter.js 85 KB

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