Importer-Exporter.js 67 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460
  1. define("amber/Importer-Exporter", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Importer-Exporter');
  3. smalltalk.addClass('ChunkParser', smalltalk.Object, ['stream'], 'Importer-Exporter');
  4. 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";
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "nextChunk",
  8. category: 'reading',
  9. fn: function (){
  10. var self=this;
  11. var char,result,chunk;
  12. return smalltalk.withContext(function($ctx1) {
  13. var $1,$2,$3;
  14. var $early={};
  15. try {
  16. result=""._writeStream();
  17. _st((function(){
  18. return smalltalk.withContext(function($ctx2) {
  19. char=_st(self["@stream"])._next();
  20. char;
  21. return _st(char)._notNil();
  22. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  23. return smalltalk.withContext(function($ctx2) {
  24. $1=_st(char).__eq("!");
  25. if(smalltalk.assert($1)){
  26. $2=_st(_st(self["@stream"])._peek()).__eq("!");
  27. if(smalltalk.assert($2)){
  28. _st(self["@stream"])._next();
  29. } else {
  30. $3=_st(_st(result)._contents())._trimBoth();
  31. throw $early=[$3];
  32. };
  33. };
  34. return _st(result)._nextPut_(char);
  35. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  36. return nil;
  37. }
  38. catch(e) {if(e===$early)return e[0]; throw e}
  39. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},smalltalk.ChunkParser)})},
  40. args: [],
  41. 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",
  42. messageSends: ["writeStream", "whileTrue:", "ifTrue:", "ifTrue:ifFalse:", "next", "trimBoth", "contents", "=", "peek", "nextPut:", "notNil"],
  43. referencedClasses: []
  44. }),
  45. smalltalk.ChunkParser);
  46. smalltalk.addMethod(
  47. smalltalk.method({
  48. selector: "stream:",
  49. category: 'accessing',
  50. fn: function (aStream){
  51. var self=this;
  52. return smalltalk.withContext(function($ctx1) {
  53. self["@stream"]=aStream;
  54. return self}, function($ctx1) {$ctx1.fill(self,"stream:",{aStream:aStream},smalltalk.ChunkParser)})},
  55. args: ["aStream"],
  56. source: "stream: aStream\x0a\x09stream := aStream",
  57. messageSends: [],
  58. referencedClasses: []
  59. }),
  60. smalltalk.ChunkParser);
  61. smalltalk.addMethod(
  62. smalltalk.method({
  63. selector: "on:",
  64. category: 'not yet classified',
  65. fn: function (aStream){
  66. var self=this;
  67. return smalltalk.withContext(function($ctx1) {
  68. var $1;
  69. $1=_st(self._new())._stream_(aStream);
  70. return $1;
  71. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},smalltalk.ChunkParser.klass)})},
  72. args: ["aStream"],
  73. source: "on: aStream\x0a\x09^self new stream: aStream",
  74. messageSends: ["stream:", "new"],
  75. referencedClasses: []
  76. }),
  77. smalltalk.ChunkParser.klass);
  78. smalltalk.addClass('Exporter', smalltalk.Object, [], 'Importer-Exporter');
  79. 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.";
  80. smalltalk.addMethod(
  81. smalltalk.method({
  82. selector: "classNameFor:",
  83. category: 'private',
  84. fn: function (aClass){
  85. var self=this;
  86. return smalltalk.withContext(function($ctx1) {
  87. var $2,$3,$1;
  88. $2=_st(aClass)._isMetaclass();
  89. if(smalltalk.assert($2)){
  90. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(".klass");
  91. } else {
  92. $3=_st(aClass)._isNil();
  93. if(smalltalk.assert($3)){
  94. $1="nil";
  95. } else {
  96. $1=_st(aClass)._name();
  97. };
  98. };
  99. return $1;
  100. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.Exporter)})},
  101. args: ["aClass"],
  102. source: "classNameFor: aClass\x0a\x09^aClass isMetaclass\x0a\x09\x09ifTrue: [aClass instanceClass name, '.klass']\x0a\x09\x09ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09\x09ifTrue: ['nil']\x0a\x09\x09\x09ifFalse: [aClass name]]",
  103. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"],
  104. referencedClasses: []
  105. }),
  106. smalltalk.Exporter);
  107. smalltalk.addMethod(
  108. smalltalk.method({
  109. selector: "exportAll",
  110. category: 'fileOut',
  111. fn: function (){
  112. var self=this;
  113. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  114. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  115. return smalltalk.withContext(function($ctx1) {
  116. var $1;
  117. $1=_st($String())._streamContents_((function(stream){
  118. return smalltalk.withContext(function($ctx2) {
  119. return _st(_st(_st($Smalltalk())._current())._packages())._do_((function(pkg){
  120. return smalltalk.withContext(function($ctx3) {
  121. return _st(stream)._nextPutAll_(self._exportPackage_(_st(pkg)._name()));
  122. }, function($ctx3) {$ctx3.fillBlock({pkg:pkg},$ctx2)})}));
  123. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  124. return $1;
  125. }, function($ctx1) {$ctx1.fill(self,"exportAll",{},smalltalk.Exporter)})},
  126. args: [],
  127. source: "exportAll\x0a\x09\x22Export all packages in the system.\x22\x0a\x0a\x09^String streamContents: [:stream |\x0a\x09\x09Smalltalk current packages do: [:pkg |\x0a\x09\x09stream nextPutAll: (self exportPackage: pkg name)]]",
  128. messageSends: ["streamContents:", "do:", "nextPutAll:", "exportPackage:", "name", "packages", "current"],
  129. referencedClasses: ["Smalltalk", "String"]
  130. }),
  131. smalltalk.Exporter);
  132. smalltalk.addMethod(
  133. smalltalk.method({
  134. selector: "exportClass:",
  135. category: 'fileOut',
  136. fn: function (aClass){
  137. var self=this;
  138. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  139. return smalltalk.withContext(function($ctx1) {
  140. var $1;
  141. $1=_st($String())._streamContents_((function(stream){
  142. return smalltalk.withContext(function($ctx2) {
  143. self._exportDefinitionOf_on_(aClass,stream);
  144. self._exportMethodsOf_on_(aClass,stream);
  145. self._exportMetaDefinitionOf_on_(aClass,stream);
  146. return self._exportMethodsOf_on_(_st(aClass)._class(),stream);
  147. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  148. return $1;
  149. }, function($ctx1) {$ctx1.fill(self,"exportClass:",{aClass:aClass},smalltalk.Exporter)})},
  150. args: ["aClass"],
  151. source: "exportClass: aClass\x0a\x09\x22Export a single class. Subclasses override these methods.\x22\x0a\x0a\x09^String streamContents: [:stream |\x0a\x09\x09self exportDefinitionOf: aClass on: stream.\x0a\x09\x09self exportMethodsOf: aClass on: stream.\x0a\x09\x09self exportMetaDefinitionOf: aClass on: stream.\x0a\x09\x09self exportMethodsOf: aClass class on: stream]",
  152. messageSends: ["streamContents:", "exportDefinitionOf:on:", "exportMethodsOf:on:", "exportMetaDefinitionOf:on:", "class"],
  153. referencedClasses: ["String"]
  154. }),
  155. smalltalk.Exporter);
  156. smalltalk.addMethod(
  157. smalltalk.method({
  158. selector: "exportDefinitionOf:on:",
  159. category: 'private',
  160. fn: function (aClass,aStream){
  161. var self=this;
  162. return smalltalk.withContext(function($ctx1) {
  163. var $1,$2,$3,$4,$5,$6,$7;
  164. $1=aStream;
  165. _st($1)._nextPutAll_("smalltalk.addClass(");
  166. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  167. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  168. $2=_st($1)._nextPutAll_(", [");
  169. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  170. return smalltalk.withContext(function($ctx2) {
  171. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  172. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  173. return smalltalk.withContext(function($ctx2) {
  174. return _st(aStream)._nextPutAll_(", ");
  175. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  176. $3=aStream;
  177. _st($3)._nextPutAll_("], '");
  178. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  179. $4=_st($3)._nextPutAll_(");");
  180. $5=_st(_st(aClass)._comment())._notEmpty();
  181. if(smalltalk.assert($5)){
  182. $6=aStream;
  183. _st($6)._lf();
  184. _st($6)._nextPutAll_("smalltalk.");
  185. _st($6)._nextPutAll_(self._classNameFor_(aClass));
  186. _st($6)._nextPutAll_(".comment=");
  187. _st($6)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
  188. $7=_st($6)._nextPutAll_(";");
  189. $7;
  190. };
  191. _st(aStream)._lf();
  192. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  193. args: ["aClass", "aStream"],
  194. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\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",
  195. messageSends: ["nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "lf", "asJavascript", "comment", "notEmpty"],
  196. referencedClasses: []
  197. }),
  198. smalltalk.Exporter);
  199. smalltalk.addMethod(
  200. smalltalk.method({
  201. selector: "exportMetaDefinitionOf:on:",
  202. category: 'private',
  203. fn: function (aClass,aStream){
  204. var self=this;
  205. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  206. return smalltalk.withContext(function($ctx1) {
  207. var $1,$2,$3;
  208. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  209. if(! smalltalk.assert($1)){
  210. $2=aStream;
  211. _st($2)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._class())));
  212. $3=_st($2)._nextPutAll_(".iVarNames = [");
  213. $3;
  214. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  215. return smalltalk.withContext(function($ctx2) {
  216. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  218. return smalltalk.withContext(function($ctx2) {
  219. return _st(aStream)._nextPutAll_(",");
  220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  221. _st(aStream)._nextPutAll_("];".__comma(_st($String())._lf()));
  222. };
  223. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  224. args: ["aClass", "aStream"],
  225. source: "exportMetaDefinitionOf: aClass on: aStream\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]",
  226. messageSends: ["ifFalse:", "nextPutAll:", ",", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"],
  227. referencedClasses: ["String"]
  228. }),
  229. smalltalk.Exporter);
  230. smalltalk.addMethod(
  231. smalltalk.method({
  232. selector: "exportMethod:of:on:",
  233. category: 'private',
  234. fn: function (aMethod,aClass,aStream){
  235. var self=this;
  236. return smalltalk.withContext(function($ctx1) {
  237. var $1,$2,$3,$4;
  238. $1=aStream;
  239. _st($1)._nextPutAll_("smalltalk.addMethod(");
  240. _st($1)._lf();
  241. _st($1)._nextPutAll_("smalltalk.method({");
  242. _st($1)._lf();
  243. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  244. _st($1)._lf();
  245. _st($1)._nextPutAll_(_st("category: '".__comma(_st(aMethod)._category())).__comma("',"));
  246. _st($1)._lf();
  247. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  248. _st($1)._lf();
  249. _st($1)._nextPutAll_(_st("args: ".__comma(_st(_st(aMethod)._arguments())._asJavascript())).__comma(","));
  250. _st($1)._lf();
  251. _st($1)._nextPutAll_(_st("source: ".__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
  252. _st($1)._lf();
  253. _st($1)._nextPutAll_(_st("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript())).__comma(","));
  254. _st($1)._lf();
  255. $2=_st($1)._nextPutAll_("referencedClasses: ".__comma(_st(_st(aMethod)._referencedClasses())._asJavascript()));
  256. $3=aStream;
  257. _st($3)._lf();
  258. _st($3)._nextPutAll_("}),");
  259. _st($3)._lf();
  260. _st($3)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(aClass)));
  261. _st($3)._nextPutAll_(");");
  262. _st($3)._lf();
  263. $4=_st($3)._lf();
  264. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:of:on:",{aMethod:aMethod,aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  265. args: ["aMethod", "aClass", "aStream"],
  266. source: "exportMethod: aMethod of: aClass 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: aClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
  267. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "category", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:"],
  268. referencedClasses: []
  269. }),
  270. smalltalk.Exporter);
  271. smalltalk.addMethod(
  272. smalltalk.method({
  273. selector: "exportMethodsOf:on:",
  274. category: 'private',
  275. fn: function (aClass,aStream){
  276. var self=this;
  277. return smalltalk.withContext(function($ctx1) {
  278. var $1;
  279. _st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  280. return smalltalk.withContext(function($ctx2) {
  281. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  282. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(each){
  283. return smalltalk.withContext(function($ctx2) {
  284. $1=_st(_st(each)._category())._match_("^\x5c*");
  285. if(! smalltalk.assert($1)){
  286. return self._exportMethod_of_on_(each,aClass,aStream);
  287. };
  288. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  289. _st(aStream)._lf();
  290. return self}, function($ctx1) {$ctx1.fill(self,"exportMethodsOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  291. args: ["aClass", "aStream"],
  292. source: "exportMethodsOf: aClass on: aStream\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09((aClass methodDictionary values) sorted: [:a :b | a selector <= b selector]) do: [:each |\x0a\x09\x09(each category match: '^\x5c*') ifFalse: [\x0a\x09\x09\x09self exportMethod: each of: aClass on: aStream]].\x0a\x09aStream lf",
  293. messageSends: ["do:", "ifFalse:", "exportMethod:of:on:", "match:", "category", "sorted:", "<=", "selector", "values", "methodDictionary", "lf"],
  294. referencedClasses: []
  295. }),
  296. smalltalk.Exporter);
  297. smalltalk.addMethod(
  298. smalltalk.method({
  299. selector: "exportPackage:",
  300. category: 'fileOut',
  301. fn: function (packageName){
  302. var self=this;
  303. var package_;
  304. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  305. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  306. return smalltalk.withContext(function($ctx1) {
  307. var $1;
  308. $1=_st($String())._streamContents_((function(stream){
  309. return smalltalk.withContext(function($ctx2) {
  310. package_=_st(_st($Smalltalk())._current())._packageAt_(packageName);
  311. package_;
  312. self._exportPackagePrologueOf_on_(package_,stream);
  313. return _st((function(){
  314. return smalltalk.withContext(function($ctx3) {
  315. self._exportPackageDefinitionOf_on_(package_,stream);
  316. _st(_st(_st(package_)._sortedClasses())._asSet())._do_((function(each){
  317. return smalltalk.withContext(function($ctx4) {
  318. return _st(stream)._nextPutAll_(self._exportClass_(each));
  319. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3)})}));
  320. return self._exportPackageExtensionsOf_on_(package_,stream);
  321. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}))._ensure_((function(){
  322. return smalltalk.withContext(function($ctx3) {
  323. return self._exportPackageEpilogueOn_(stream);
  324. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  325. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  326. return $1;
  327. }, function($ctx1) {$ctx1.fill(self,"exportPackage:",{packageName:packageName,package_:package_},smalltalk.Exporter)})},
  328. args: ["packageName"],
  329. source: "exportPackage: packageName\x0a\x09\x22Export a given package by name.\x22\x0a\x0a\x09| package |\x0a\x09^String streamContents: [:stream |\x0a\x09\x09package := Smalltalk current packageAt: packageName.\x0a\x09\x09self exportPackagePrologueOf: package on: stream.\x0a\x09\x09[\x0a\x09\x09\x09self exportPackageDefinitionOf: package on: stream.\x0a\x0a\x09\x09\x09\x22Export classes in dependency order.\x0a\x09\x09\x09Update (issue #171): Remove duplicates for export\x22\x0a\x09\x09\x09package sortedClasses asSet do: [:each |\x0a\x09\x09\x09\x09\x09\x09stream nextPutAll: (self exportClass: each)].\x0a\x09\x09\x09self exportPackageExtensionsOf: package on: stream\x0a\x09\x09] ensure: [\x0a\x09\x09\x09self exportPackageEpilogueOn: stream\x0a\x09\x09]]",
  330. messageSends: ["streamContents:", "packageAt:", "current", "exportPackagePrologueOf:on:", "ensure:", "exportPackageEpilogueOn:", "exportPackageDefinitionOf:on:", "do:", "nextPutAll:", "exportClass:", "asSet", "sortedClasses", "exportPackageExtensionsOf:on:"],
  331. referencedClasses: ["Smalltalk", "String"]
  332. }),
  333. smalltalk.Exporter);
  334. smalltalk.addMethod(
  335. smalltalk.method({
  336. selector: "exportPackageDefinitionOf:on:",
  337. category: 'private',
  338. fn: function (package_,aStream){
  339. var self=this;
  340. return smalltalk.withContext(function($ctx1) {
  341. var $1,$2;
  342. $1=aStream;
  343. _st($1)._nextPutAll_("smalltalk.addPackage(");
  344. _st($1)._nextPutAll_(_st("'".__comma(_st(package_)._name())).__comma("');"));
  345. $2=_st($1)._lf();
  346. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{package_:package_,aStream:aStream},smalltalk.Exporter)})},
  347. args: ["package", "aStream"],
  348. source: "exportPackageDefinitionOf: package on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addPackage(';\x0a\x09\x09nextPutAll: '''', package name, ''');';\x0a\x09\x09lf",
  349. messageSends: ["nextPutAll:", ",", "name", "lf"],
  350. referencedClasses: []
  351. }),
  352. smalltalk.Exporter);
  353. smalltalk.addMethod(
  354. smalltalk.method({
  355. selector: "exportPackageEpilogueOn:",
  356. category: 'private',
  357. fn: function (aStream){
  358. var self=this;
  359. return smalltalk.withContext(function($ctx1) {
  360. var $1,$2;
  361. $1=aStream;
  362. _st($1)._nextPutAll_("});");
  363. $2=_st($1)._lf();
  364. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOn:",{aStream:aStream},smalltalk.Exporter)})},
  365. args: ["aStream"],
  366. source: "exportPackageEpilogueOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  367. messageSends: ["nextPutAll:", "lf"],
  368. referencedClasses: []
  369. }),
  370. smalltalk.Exporter);
  371. smalltalk.addMethod(
  372. smalltalk.method({
  373. selector: "exportPackageExtensionsOf:on:",
  374. category: 'private',
  375. fn: function (package_,aStream){
  376. var self=this;
  377. var name;
  378. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  379. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  380. return smalltalk.withContext(function($ctx1) {
  381. var $1;
  382. name=_st(package_)._name();
  383. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  384. return smalltalk.withContext(function($ctx2) {
  385. return _st([each,_st(each)._class()])._do_((function(aClass){
  386. return smalltalk.withContext(function($ctx3) {
  387. return _st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  388. return smalltalk.withContext(function($ctx4) {
  389. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  390. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._do_((function(method){
  391. return smalltalk.withContext(function($ctx4) {
  392. $1=_st(_st(method)._category())._match_("^\x5c*".__comma(name));
  393. if(smalltalk.assert($1)){
  394. return self._exportMethod_of_on_(method,aClass,aStream);
  395. };
  396. }, function($ctx4) {$ctx4.fillBlock({method:method},$ctx3)})}));
  397. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  398. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  399. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageExtensionsOf:on:",{package_:package_,aStream:aStream,name:name},smalltalk.Exporter)})},
  400. args: ["package", "aStream"],
  401. source: "exportPackageExtensionsOf: package on: aStream\x0a\x09\x22Issue #143: sort classes and methods alphabetically\x22\x0a\x0a\x09| name |\x0a\x09name := package name.\x0a\x09(Package sortedClasses: Smalltalk current classes) do: [:each |\x0a\x09\x09{each. each class} do: [:aClass |\x0a\x09\x09\x09((aClass methodDictionary values) sorted: [:a :b | a selector <= b selector]) do: [:method |\x0a\x09\x09\x09\x09(method category match: '^\x5c*', name) ifTrue: [\x0a\x09\x09\x09\x09\x09self exportMethod: method of: aClass on: aStream ]]]]",
  402. messageSends: ["name", "do:", "ifTrue:", "exportMethod:of:on:", "match:", ",", "category", "sorted:", "<=", "selector", "values", "methodDictionary", "class", "sortedClasses:", "classes", "current"],
  403. referencedClasses: ["Smalltalk", "Package"]
  404. }),
  405. smalltalk.Exporter);
  406. smalltalk.addMethod(
  407. smalltalk.method({
  408. selector: "exportPackagePrologueOf:on:",
  409. category: 'private',
  410. fn: function (aPackage,aStream){
  411. var self=this;
  412. return smalltalk.withContext(function($ctx1) {
  413. var $1,$2;
  414. $1=aStream;
  415. _st($1)._nextPutAll_("define(\x22amber/");
  416. _st($1)._nextPutAll_(_st(aPackage)._name());
  417. _st($1)._nextPutAll_("\x22, [\x22amber_vm/smalltalk\x22,\x22amber_vm/nil\x22,\x22amber_vm/_st\x22], function(smalltalk,nil,_st){");
  418. $2=_st($1)._lf();
  419. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  420. args: ["aPackage", "aStream"],
  421. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'define(\x22amber/';\x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, [\x22amber_vm/smalltalk\x22,\x22amber_vm/nil\x22,\x22amber_vm/_st\x22], function(smalltalk,nil,_st){';\x0a\x09\x09lf",
  422. messageSends: ["nextPutAll:", "name", "lf"],
  423. referencedClasses: []
  424. }),
  425. smalltalk.Exporter);
  426. smalltalk.addClass('ChunkExporter', smalltalk.Exporter, [], 'Importer-Exporter');
  427. 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.";
  428. smalltalk.addMethod(
  429. smalltalk.method({
  430. selector: "chunkEscape:",
  431. category: 'private',
  432. fn: function (aString){
  433. var self=this;
  434. return smalltalk.withContext(function($ctx1) {
  435. var $1;
  436. $1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
  437. return $1;
  438. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},smalltalk.ChunkExporter)})},
  439. args: ["aString"],
  440. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^(aString replace: '!' with: '!!') trimBoth",
  441. messageSends: ["trimBoth", "replace:with:"],
  442. referencedClasses: []
  443. }),
  444. smalltalk.ChunkExporter);
  445. smalltalk.addMethod(
  446. smalltalk.method({
  447. selector: "classNameFor:",
  448. category: 'private',
  449. fn: function (aClass){
  450. var self=this;
  451. return smalltalk.withContext(function($ctx1) {
  452. var $2,$3,$1;
  453. $2=_st(aClass)._isMetaclass();
  454. if(smalltalk.assert($2)){
  455. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(" class");
  456. } else {
  457. $3=_st(aClass)._isNil();
  458. if(smalltalk.assert($3)){
  459. $1="nil";
  460. } else {
  461. $1=_st(aClass)._name();
  462. };
  463. };
  464. return $1;
  465. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.ChunkExporter)})},
  466. args: ["aClass"],
  467. source: "classNameFor: aClass\x0a\x09^aClass isMetaclass\x0a\x09\x09ifTrue: [aClass instanceClass name, ' class']\x0a\x09\x09ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09\x09ifTrue: ['nil']\x0a\x09\x09\x09ifFalse: [aClass name]]",
  468. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"],
  469. referencedClasses: []
  470. }),
  471. smalltalk.ChunkExporter);
  472. smalltalk.addMethod(
  473. smalltalk.method({
  474. selector: "exportDefinitionOf:on:",
  475. category: 'private',
  476. fn: function (aClass,aStream){
  477. var self=this;
  478. return smalltalk.withContext(function($ctx1) {
  479. var $1,$2,$3,$4,$5,$6,$7;
  480. $1=aStream;
  481. _st($1)._nextPutAll_(self._classNameFor_(_st(aClass)._superclass()));
  482. _st($1)._nextPutAll_(" subclass: #".__comma(self._classNameFor_(aClass)));
  483. _st($1)._lf();
  484. _st($1)._tab();
  485. $2=_st($1)._nextPutAll_("instanceVariableNames: '");
  486. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  487. return smalltalk.withContext(function($ctx2) {
  488. return _st(aStream)._nextPutAll_(each);
  489. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  490. return smalltalk.withContext(function($ctx2) {
  491. return _st(aStream)._nextPutAll_(" ");
  492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  493. $3=aStream;
  494. _st($3)._nextPutAll_("'");
  495. _st($3)._lf();
  496. _st($3)._tab();
  497. _st($3)._nextPutAll_(_st("package: '".__comma(_st(aClass)._category())).__comma("'!"));
  498. $4=_st($3)._lf();
  499. $5=_st(_st(aClass)._comment())._notEmpty();
  500. if(smalltalk.assert($5)){
  501. $6=aStream;
  502. _st($6)._nextPutAll_(_st("!".__comma(self._classNameFor_(aClass))).__comma(" commentStamp!"));
  503. _st($6)._lf();
  504. _st($6)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
  505. $7=_st($6)._lf();
  506. $7;
  507. };
  508. _st(aStream)._lf();
  509. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  510. args: ["aClass", "aStream"],
  511. 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",
  512. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "chunkEscape:", "comment", "notEmpty"],
  513. referencedClasses: []
  514. }),
  515. smalltalk.ChunkExporter);
  516. smalltalk.addMethod(
  517. smalltalk.method({
  518. selector: "exportMetaDefinitionOf:on:",
  519. category: 'private',
  520. fn: function (aClass,aStream){
  521. var self=this;
  522. return smalltalk.withContext(function($ctx1) {
  523. var $1,$2,$3,$4,$5;
  524. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  525. if(! smalltalk.assert($1)){
  526. $2=aStream;
  527. _st($2)._nextPutAll_(self._classNameFor_(_st(aClass)._class()));
  528. $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
  529. $3;
  530. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  531. return smalltalk.withContext(function($ctx2) {
  532. return _st(aStream)._nextPutAll_(each);
  533. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  534. return smalltalk.withContext(function($ctx2) {
  535. return _st(aStream)._nextPutAll_(" ");
  536. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  537. $4=aStream;
  538. _st($4)._nextPutAll_("'!");
  539. _st($4)._lf();
  540. $5=_st($4)._lf();
  541. $5;
  542. };
  543. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  544. args: ["aClass", "aStream"],
  545. 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]",
  546. messageSends: ["ifFalse:", "nextPutAll:", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"],
  547. referencedClasses: []
  548. }),
  549. smalltalk.ChunkExporter);
  550. smalltalk.addMethod(
  551. smalltalk.method({
  552. selector: "exportMethod:of:on:",
  553. category: 'private',
  554. fn: function (aMethod,aClass,aStream){
  555. var self=this;
  556. return smalltalk.withContext(function($ctx1) {
  557. var $1,$2;
  558. $1=aStream;
  559. _st($1)._lf();
  560. _st($1)._lf();
  561. _st($1)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
  562. _st($1)._lf();
  563. $2=_st($1)._nextPutAll_("!");
  564. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:of:on:",{aMethod:aMethod,aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  565. args: ["aMethod", "aClass", "aStream"],
  566. source: "exportMethod: aMethod of: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  567. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"],
  568. referencedClasses: []
  569. }),
  570. smalltalk.ChunkExporter);
  571. smalltalk.addMethod(
  572. smalltalk.method({
  573. selector: "exportMethods:category:of:on:",
  574. category: 'private',
  575. fn: function (methods,category,aClass,aStream){
  576. var self=this;
  577. return smalltalk.withContext(function($ctx1) {
  578. var $1,$2,$3,$4;
  579. $1=aStream;
  580. _st($1)._nextPutAll_("!".__comma(self._classNameFor_(aClass)));
  581. $2=_st($1)._nextPutAll_(_st(" methodsFor: '".__comma(category)).__comma("'!"));
  582. _st(_st(methods)._sorted_((function(a,b){
  583. return smalltalk.withContext(function($ctx2) {
  584. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  585. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(each){
  586. return smalltalk.withContext(function($ctx2) {
  587. return self._exportMethod_of_on_(each,aClass,aStream);
  588. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  589. $3=aStream;
  590. _st($3)._nextPutAll_(" !");
  591. _st($3)._lf();
  592. $4=_st($3)._lf();
  593. return self}, function($ctx1) {$ctx1.fill(self,"exportMethods:category:of:on:",{methods:methods,category:category,aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  594. args: ["methods", "category", "aClass", "aStream"],
  595. source: "exportMethods: methods category: category of: aClass on: aStream\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', category, '''!'.\x0a\x09\x09(methods sorted: [:a :b | a selector <= b selector]) do: [:each |\x0a\x09\x09\x09\x09self exportMethod: each of: aClass on: aStream].\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  596. messageSends: ["nextPutAll:", ",", "classNameFor:", "do:", "exportMethod:of:on:", "sorted:", "<=", "selector", "lf"],
  597. referencedClasses: []
  598. }),
  599. smalltalk.ChunkExporter);
  600. smalltalk.addMethod(
  601. smalltalk.method({
  602. selector: "exportMethodsOf:on:",
  603. category: 'private',
  604. fn: function (aClass,aStream){
  605. var self=this;
  606. var map;
  607. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  608. return smalltalk.withContext(function($ctx1) {
  609. var $1;
  610. map=_st($Dictionary())._new();
  611. _st(aClass)._protocolsDo_((function(category,methods){
  612. return smalltalk.withContext(function($ctx2) {
  613. $1=_st(category)._match_("^\x5c*");
  614. if(! smalltalk.assert($1)){
  615. return _st(map)._at_put_(category,methods);
  616. };
  617. }, function($ctx2) {$ctx2.fillBlock({category:category,methods:methods},$ctx1)})}));
  618. _st(_st(_st(map)._keys())._sorted_((function(a,b){
  619. return smalltalk.withContext(function($ctx2) {
  620. return _st(a).__lt_eq(b);
  621. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(category){
  622. var methods;
  623. return smalltalk.withContext(function($ctx2) {
  624. methods=_st(map)._at_(category);
  625. methods;
  626. return self._exportMethods_category_of_on_(methods,category,aClass,aStream);
  627. }, function($ctx2) {$ctx2.fillBlock({category:category,methods:methods},$ctx1)})}));
  628. return self}, function($ctx1) {$ctx1.fill(self,"exportMethodsOf:on:",{aClass:aClass,aStream:aStream,map:map},smalltalk.ChunkExporter)})},
  629. args: ["aClass", "aStream"],
  630. source: "exportMethodsOf: aClass on: aStream\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 ]) do: [:category | | methods |\x0a\x09\x09methods := map at: category.\x0a\x09\x09self\x0a\x09\x09\x09exportMethods: methods\x0a\x09\x09\x09category: category\x0a\x09\x09\x09of: aClass\x0a\x09\x09\x09on: aStream ]",
  631. messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "do:", "at:", "exportMethods:category:of:on:", "sorted:", "<=", "keys"],
  632. referencedClasses: ["Dictionary"]
  633. }),
  634. smalltalk.ChunkExporter);
  635. smalltalk.addMethod(
  636. smalltalk.method({
  637. selector: "exportPackageDefinitionOf:on:",
  638. category: 'private',
  639. fn: function (package_,aStream){
  640. var self=this;
  641. return smalltalk.withContext(function($ctx1) {
  642. var $1,$2;
  643. $1=aStream;
  644. _st($1)._nextPutAll_(_st("Smalltalk current createPackage: '".__comma(_st(package_)._name())).__comma("'!"));
  645. $2=_st($1)._lf();
  646. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{package_:package_,aStream:aStream},smalltalk.ChunkExporter)})},
  647. args: ["package", "aStream"],
  648. source: "exportPackageDefinitionOf: package on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk current createPackage: ''', package name, '''!';\x0a\x09\x09lf",
  649. messageSends: ["nextPutAll:", ",", "name", "lf"],
  650. referencedClasses: []
  651. }),
  652. smalltalk.ChunkExporter);
  653. smalltalk.addMethod(
  654. smalltalk.method({
  655. selector: "exportPackageEpilogueOn:",
  656. category: 'private',
  657. fn: function (aStream){
  658. var self=this;
  659. return smalltalk.withContext(function($ctx1) {
  660. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOn:",{aStream:aStream},smalltalk.ChunkExporter)})},
  661. args: ["aStream"],
  662. source: "exportPackageEpilogueOn: aStream",
  663. messageSends: [],
  664. referencedClasses: []
  665. }),
  666. smalltalk.ChunkExporter);
  667. smalltalk.addMethod(
  668. smalltalk.method({
  669. selector: "exportPackageExtensionsOf:on:",
  670. category: 'private',
  671. fn: function (package_,aStream){
  672. var self=this;
  673. var name,map;
  674. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  675. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  676. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  677. return smalltalk.withContext(function($ctx1) {
  678. var $1;
  679. name=_st(package_)._name();
  680. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  681. return smalltalk.withContext(function($ctx2) {
  682. return _st([each,_st(each)._class()])._do_((function(aClass){
  683. return smalltalk.withContext(function($ctx3) {
  684. map=_st($Dictionary())._new();
  685. map;
  686. _st(aClass)._protocolsDo_((function(category,methods){
  687. return smalltalk.withContext(function($ctx4) {
  688. $1=_st(category)._match_("^\x5c*".__comma(name));
  689. if(smalltalk.assert($1)){
  690. return _st(map)._at_put_(category,methods);
  691. };
  692. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3)})}));
  693. return _st(_st(_st(map)._keys())._sorted_((function(a,b){
  694. return smalltalk.withContext(function($ctx4) {
  695. return _st(a).__lt_eq(b);
  696. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._do_((function(category){
  697. var methods;
  698. return smalltalk.withContext(function($ctx4) {
  699. methods=_st(map)._at_(category);
  700. methods;
  701. return self._exportMethods_category_of_on_(methods,category,aClass,aStream);
  702. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3)})}));
  703. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  704. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  705. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageExtensionsOf:on:",{package_:package_,aStream:aStream,name:name,map:map},smalltalk.ChunkExporter)})},
  706. args: ["package", "aStream"],
  707. source: "exportPackageExtensionsOf: package on: aStream\x0a\x09\x22We need to override this one too since we need to group\x0a\x09all methods in a given protocol under a leading methodsFor: chunk\x0a\x09for that class.\x22\x0a\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map |\x0a\x09name := package name.\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\x09(category match: '^\x5c*', name) ifTrue: [ map at: category put: methods ]].\x0a\x09\x09\x09(map keys sorted: [:a :b | a <= b ]) do: [:category | | methods |\x0a\x09\x09\x09\x09methods := map at: category.\x0a\x09\x09\x09\x09self exportMethods: methods category: category of: aClass on: aStream ]]]",
  708. messageSends: ["name", "do:", "new", "protocolsDo:", "ifTrue:", "at:put:", "match:", ",", "at:", "exportMethods:category:of:on:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"],
  709. referencedClasses: ["Dictionary", "Smalltalk", "Package"]
  710. }),
  711. smalltalk.ChunkExporter);
  712. smalltalk.addMethod(
  713. smalltalk.method({
  714. selector: "exportPackagePrologueOn:",
  715. category: 'private',
  716. fn: function (aStream){
  717. var self=this;
  718. return smalltalk.withContext(function($ctx1) {
  719. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOn:",{aStream:aStream},smalltalk.ChunkExporter)})},
  720. args: ["aStream"],
  721. source: "exportPackagePrologueOn: aStream",
  722. messageSends: [],
  723. referencedClasses: []
  724. }),
  725. smalltalk.ChunkExporter);
  726. smalltalk.addClass('StrippedExporter', smalltalk.Exporter, [], 'Importer-Exporter');
  727. smalltalk.StrippedExporter.comment="I export Amber code into a JavaScript string, but without any optional associated data like the Amber source code.";
  728. smalltalk.addMethod(
  729. smalltalk.method({
  730. selector: "exportDefinitionOf:on:",
  731. category: 'private',
  732. fn: function (aClass,aStream){
  733. var self=this;
  734. return smalltalk.withContext(function($ctx1) {
  735. var $1,$2,$3,$4;
  736. $1=aStream;
  737. _st($1)._nextPutAll_("smalltalk.addClass(");
  738. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  739. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  740. $2=_st($1)._nextPutAll_(", [");
  741. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  742. return smalltalk.withContext(function($ctx2) {
  743. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  744. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  745. return smalltalk.withContext(function($ctx2) {
  746. return _st(aStream)._nextPutAll_(", ");
  747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  748. $3=aStream;
  749. _st($3)._nextPutAll_("], '");
  750. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  751. $4=_st($3)._nextPutAll_(");");
  752. _st(aStream)._lf();
  753. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.StrippedExporter)})},
  754. args: ["aClass", "aStream"],
  755. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\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",
  756. messageSends: ["nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "lf"],
  757. referencedClasses: []
  758. }),
  759. smalltalk.StrippedExporter);
  760. smalltalk.addMethod(
  761. smalltalk.method({
  762. selector: "exportMethod:of:on:",
  763. category: 'private',
  764. fn: function (aMethod,aClass,aStream){
  765. var self=this;
  766. return smalltalk.withContext(function($ctx1) {
  767. var $1,$2;
  768. $1=aStream;
  769. _st($1)._nextPutAll_("smalltalk.addMethod(");
  770. _st($1)._lf();
  771. _st($1)._nextPutAll_("smalltalk.method({");
  772. _st($1)._lf();
  773. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  774. _st($1)._lf();
  775. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  776. _st($1)._lf();
  777. _st($1)._nextPutAll_("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript()));
  778. _st($1)._nextPutAll_("}),");
  779. _st($1)._lf();
  780. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(aClass)));
  781. _st($1)._nextPutAll_(");");
  782. _st($1)._lf();
  783. $2=_st($1)._lf();
  784. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:of:on:",{aMethod:aMethod,aClass:aClass,aStream:aStream},smalltalk.StrippedExporter)})},
  785. args: ["aMethod", "aClass", "aStream"],
  786. source: "exportMethod: aMethod of: aClass 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: aClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
  787. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "compiledSource", "fn", "messageSends", "classNameFor:"],
  788. referencedClasses: []
  789. }),
  790. smalltalk.StrippedExporter);
  791. smalltalk.addClass('Importer', smalltalk.Object, [], 'Importer-Exporter');
  792. smalltalk.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  793. smalltalk.addMethod(
  794. smalltalk.method({
  795. selector: "import:",
  796. category: 'fileIn',
  797. fn: function (aStream){
  798. var self=this;
  799. var chunk,result,parser,lastEmpty;
  800. function $ChunkParser(){return smalltalk.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  801. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  802. return smalltalk.withContext(function($ctx1) {
  803. var $1,$2;
  804. parser=_st($ChunkParser())._on_(aStream);
  805. lastEmpty=false;
  806. _st((function(){
  807. return smalltalk.withContext(function($ctx2) {
  808. chunk=_st(parser)._nextChunk();
  809. chunk;
  810. return _st(chunk)._isNil();
  811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  812. return smalltalk.withContext(function($ctx2) {
  813. $1=_st(chunk)._isEmpty();
  814. if(smalltalk.assert($1)){
  815. lastEmpty=true;
  816. return lastEmpty;
  817. } else {
  818. result=_st(_st($Compiler())._new())._evaluateExpression_(chunk);
  819. result;
  820. $2=lastEmpty;
  821. if(smalltalk.assert($2)){
  822. lastEmpty=false;
  823. lastEmpty;
  824. return _st(result)._scanFrom_(parser);
  825. };
  826. };
  827. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  828. return self}, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},smalltalk.Importer)})},
  829. args: ["aStream"],
  830. 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]]]",
  831. messageSends: ["on:", "whileFalse:", "ifTrue:ifFalse:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "isEmpty", "nextChunk", "isNil"],
  832. referencedClasses: ["ChunkParser", "Compiler"]
  833. }),
  834. smalltalk.Importer);
  835. smalltalk.addClass('PackageHandler', smalltalk.Object, [], 'Importer-Exporter');
  836. 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.";
  837. smalltalk.addMethod(
  838. smalltalk.method({
  839. selector: "ajaxPutAt:data:",
  840. category: 'private',
  841. fn: function (aURL,aString){
  842. var self=this;
  843. return smalltalk.withContext(function($ctx1) {
  844. _st(jQuery)._ajax_options_(aURL,smalltalk.HashedCollection._from_(["type".__minus_gt("PUT"),"data".__minus_gt(aString),"contentType".__minus_gt("text/plain;charset=UTF-8"),"error".__minus_gt((function(xhr){
  845. return smalltalk.withContext(function($ctx2) {
  846. return self._error_(_st(_st(_st("Commiting ".__comma(aURL)).__comma(" failed with reason: \x22")).__comma(_st(xhr)._responseText())).__comma("\x22"));
  847. }, function($ctx2) {$ctx2.fillBlock({xhr:xhr},$ctx1)})}))]));
  848. return self}, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:",{aURL:aURL,aString:aString},smalltalk.PackageHandler)})},
  849. args: ["aURL", "aString"],
  850. source: "ajaxPutAt: aURL data: aString\x0a\x09jQuery\x0a\x09\x09ajax: aURL \x0a\x09\x09options: #{ \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'] }",
  851. messageSends: ["ajax:options:", "->", "error:", ",", "responseText"],
  852. referencedClasses: []
  853. }),
  854. smalltalk.PackageHandler);
  855. smalltalk.addMethod(
  856. smalltalk.method({
  857. selector: "commit:",
  858. category: 'committing',
  859. fn: function (aPackage){
  860. var self=this;
  861. return smalltalk.withContext(function($ctx1) {
  862. _st(self._commitChannels())._do_displayingProgress_((function(commitStrategyFactory){
  863. var fileContents,commitStrategy;
  864. return smalltalk.withContext(function($ctx2) {
  865. commitStrategy=_st(commitStrategyFactory)._value_(aPackage);
  866. commitStrategy;
  867. fileContents=_st(_st(commitStrategy)._key())._exportPackage_(_st(aPackage)._name());
  868. fileContents;
  869. return self._ajaxPutAt_data_(_st(commitStrategy)._value(),fileContents);
  870. }, function($ctx2) {$ctx2.fillBlock({commitStrategyFactory:commitStrategyFactory,fileContents:fileContents,commitStrategy:commitStrategy},$ctx1)})}),"Committing package ".__comma(_st(aPackage)._name()));
  871. return self}, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  872. args: ["aPackage"],
  873. source: "commit: aPackage\x0a\x09self commitChannels\x0a\x09\x09do: [ :commitStrategyFactory || fileContents commitStrategy |\x0a\x09\x09\x09commitStrategy := commitStrategyFactory value: aPackage.\x0a\x09\x09\x09fileContents := (commitStrategy key exportPackage: aPackage name).\x0a\x09\x09\x09self ajaxPutAt: commitStrategy value data: fileContents ]\x0a\x09\x09displayingProgress: 'Committing package ', aPackage name",
  874. messageSends: ["do:displayingProgress:", "value:", "exportPackage:", "name", "key", "ajaxPutAt:data:", "value", ",", "commitChannels"],
  875. referencedClasses: []
  876. }),
  877. smalltalk.PackageHandler);
  878. smalltalk.PackageHandler.klass.iVarNames = ['registry'];
  879. smalltalk.addMethod(
  880. smalltalk.method({
  881. selector: "classRegisteredFor:",
  882. category: 'accessing',
  883. fn: function (aString){
  884. var self=this;
  885. return smalltalk.withContext(function($ctx1) {
  886. var $1;
  887. $1=_st(self["@registry"])._at_(aString);
  888. return $1;
  889. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},smalltalk.PackageHandler.klass)})},
  890. args: ["aString"],
  891. source: "classRegisteredFor: aString\x0a\x09^registry at: aString",
  892. messageSends: ["at:"],
  893. referencedClasses: []
  894. }),
  895. smalltalk.PackageHandler.klass);
  896. smalltalk.addMethod(
  897. smalltalk.method({
  898. selector: "for:",
  899. category: 'accessing',
  900. fn: function (aString){
  901. var self=this;
  902. return smalltalk.withContext(function($ctx1) {
  903. var $1;
  904. $1=_st(self._classRegisteredFor_(aString))._new();
  905. return $1;
  906. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},smalltalk.PackageHandler.klass)})},
  907. args: ["aString"],
  908. source: "for: aString\x0a\x09^(self classRegisteredFor: aString) new",
  909. messageSends: ["new", "classRegisteredFor:"],
  910. referencedClasses: []
  911. }),
  912. smalltalk.PackageHandler.klass);
  913. smalltalk.addMethod(
  914. smalltalk.method({
  915. selector: "initialize",
  916. category: 'initialization',
  917. fn: function (){
  918. var self=this;
  919. return smalltalk.withContext(function($ctx1) {
  920. smalltalk.PackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  921. self["@registry"]=smalltalk.HashedCollection._from_([]);
  922. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.PackageHandler.klass)})},
  923. args: [],
  924. source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}",
  925. messageSends: ["initialize"],
  926. referencedClasses: []
  927. }),
  928. smalltalk.PackageHandler.klass);
  929. smalltalk.addMethod(
  930. smalltalk.method({
  931. selector: "register:for:",
  932. category: 'registry',
  933. fn: function (aClass,aString){
  934. var self=this;
  935. return smalltalk.withContext(function($ctx1) {
  936. _st(self["@registry"])._at_put_(aString,aClass);
  937. return self}, function($ctx1) {$ctx1.fill(self,"register:for:",{aClass:aClass,aString:aString},smalltalk.PackageHandler.klass)})},
  938. args: ["aClass", "aString"],
  939. source: "register: aClass for: aString\x0a\x09registry at: aString put: aClass",
  940. messageSends: ["at:put:"],
  941. referencedClasses: []
  942. }),
  943. smalltalk.PackageHandler.klass);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "registerFor:",
  947. category: 'registry',
  948. fn: function (aString){
  949. var self=this;
  950. function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
  951. return smalltalk.withContext(function($ctx1) {
  952. _st($PackageHandler())._register_for_(self,aString);
  953. return self}, function($ctx1) {$ctx1.fill(self,"registerFor:",{aString:aString},smalltalk.PackageHandler.klass)})},
  954. args: ["aString"],
  955. source: "registerFor: aString\x0a\x09PackageHandler register: self for: aString",
  956. messageSends: ["register:for:"],
  957. referencedClasses: ["PackageHandler"]
  958. }),
  959. smalltalk.PackageHandler.klass);
  960. smalltalk.addClass('LegacyPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
  961. smalltalk.LegacyPackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  962. smalltalk.addMethod(
  963. smalltalk.method({
  964. selector: "commitChannels",
  965. category: 'committing',
  966. fn: function (){
  967. var self=this;
  968. function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  969. function $StrippedExporter(){return smalltalk.StrippedExporter||(typeof StrippedExporter=="undefined"?nil:StrippedExporter)}
  970. function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  971. return smalltalk.withContext(function($ctx1) {
  972. var $1;
  973. $1=[(function(pkg){
  974. return smalltalk.withContext(function($ctx2) {
  975. return _st(_st($Exporter())._new()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".js"));
  976. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  977. return smalltalk.withContext(function($ctx2) {
  978. return _st(_st($StrippedExporter())._new()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".deploy.js"));
  979. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
  980. return smalltalk.withContext(function($ctx2) {
  981. return _st(_st($ChunkExporter())._new()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathSt()).__comma("/")).__comma(_st(pkg)._name())).__comma(".st"));
  982. }, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})})];
  983. return $1;
  984. }, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.LegacyPackageHandler)})},
  985. args: [],
  986. source: "commitChannels\x0a\x09^{ \x0a\x09\x09[ :pkg | Exporter new -> (pkg commitPathJs, '/', pkg name, '.js') ].\x0a\x09\x09[ :pkg | StrippedExporter new -> (pkg commitPathJs, '/', pkg name, '.deploy.js') ].\x0a\x09\x09[ :pkg | ChunkExporter new -> (pkg commitPathSt, '/', pkg name, '.st') ]\x0a\x09}",
  987. messageSends: ["->", ",", "name", "commitPathJs", "new", "commitPathSt"],
  988. referencedClasses: ["Exporter", "StrippedExporter", "ChunkExporter"]
  989. }),
  990. smalltalk.LegacyPackageHandler);
  991. smalltalk.addMethod(
  992. smalltalk.method({
  993. selector: "commitPathJsFor:",
  994. category: 'committing',
  995. fn: function (aPackage){
  996. var self=this;
  997. return smalltalk.withContext(function($ctx1) {
  998. var $1;
  999. $1=_st(self._class())._defaultCommitPathJs();
  1000. return $1;
  1001. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
  1002. args: ["aPackage"],
  1003. source: "commitPathJsFor: aPackage\x0a\x09^self class defaultCommitPathJs",
  1004. messageSends: ["defaultCommitPathJs", "class"],
  1005. referencedClasses: []
  1006. }),
  1007. smalltalk.LegacyPackageHandler);
  1008. smalltalk.addMethod(
  1009. smalltalk.method({
  1010. selector: "commitPathStFor:",
  1011. category: 'committing',
  1012. fn: function (aPackage){
  1013. var self=this;
  1014. return smalltalk.withContext(function($ctx1) {
  1015. var $1;
  1016. $1=_st(self._class())._defaultCommitPathSt();
  1017. return $1;
  1018. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.LegacyPackageHandler)})},
  1019. args: ["aPackage"],
  1020. source: "commitPathStFor: aPackage\x0a\x09^self class defaultCommitPathSt",
  1021. messageSends: ["defaultCommitPathSt", "class"],
  1022. referencedClasses: []
  1023. }),
  1024. smalltalk.LegacyPackageHandler);
  1025. smalltalk.addMethod(
  1026. smalltalk.method({
  1027. selector: "loadPackage:prefix:",
  1028. category: 'loading',
  1029. fn: function (packageName,aString){
  1030. var self=this;
  1031. var url;
  1032. return smalltalk.withContext(function($ctx1) {
  1033. var $1;
  1034. url=_st(_st(_st("/".__comma(aString)).__comma("/js/")).__comma(packageName)).__comma(".js");
  1035. _st(jQuery)._ajax_options_(url,smalltalk.HashedCollection._from_(["type".__minus_gt("GET"),"dataType".__minus_gt("script"),"complete".__minus_gt((function(jqXHR,textStatus){
  1036. return smalltalk.withContext(function($ctx2) {
  1037. $1=_st(_st(jqXHR)._readyState()).__eq((4));
  1038. if(smalltalk.assert($1)){
  1039. return self._setupPackageNamed_prefix_(packageName,aString);
  1040. };
  1041. }, function($ctx2) {$ctx2.fillBlock({jqXHR:jqXHR,textStatus:textStatus},$ctx1)})})),"error".__minus_gt((function(){
  1042. return smalltalk.withContext(function($ctx2) {
  1043. return _st(window)._alert_("Could not load package at: ".__comma(url));
  1044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))]));
  1045. return self}, function($ctx1) {$ctx1.fill(self,"loadPackage:prefix:",{packageName:packageName,aString:aString,url:url},smalltalk.LegacyPackageHandler)})},
  1046. args: ["packageName", "aString"],
  1047. source: "loadPackage: packageName prefix: aString\x0a\x09| url |\x0a\x09url := '/', aString, '/js/', packageName, '.js'.\x0a\x09jQuery\x0a\x09\x09ajax: url\x0a\x09\x09options: #{\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' -> [ window alert: 'Could not load package at: ', url ]\x0a\x09\x09}",
  1048. messageSends: [",", "ajax:options:", "->", "ifTrue:", "setupPackageNamed:prefix:", "=", "readyState", "alert:"],
  1049. referencedClasses: []
  1050. }),
  1051. smalltalk.LegacyPackageHandler);
  1052. smalltalk.addMethod(
  1053. smalltalk.method({
  1054. selector: "loadPackages:prefix:",
  1055. category: 'loading',
  1056. fn: function (aCollection,aString){
  1057. var self=this;
  1058. return smalltalk.withContext(function($ctx1) {
  1059. _st(aCollection)._do_((function(each){
  1060. return smalltalk.withContext(function($ctx2) {
  1061. return self._loadPackage_prefix_(each,aString);
  1062. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1063. return self}, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler)})},
  1064. args: ["aCollection", "aString"],
  1065. source: "loadPackages: aCollection prefix: aString\x0a\x09aCollection do: [ :each |\x0a\x09\x09self loadPackage: each prefix: aString ]",
  1066. messageSends: ["do:", "loadPackage:prefix:"],
  1067. referencedClasses: []
  1068. }),
  1069. smalltalk.LegacyPackageHandler);
  1070. smalltalk.addMethod(
  1071. smalltalk.method({
  1072. selector: "setupPackageNamed:prefix:",
  1073. category: 'private',
  1074. fn: function (packageName,aString){
  1075. var self=this;
  1076. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  1077. return smalltalk.withContext(function($ctx1) {
  1078. var $1,$2;
  1079. $1=_st($Package())._named_(packageName);
  1080. _st($1)._setupClasses();
  1081. _st($1)._commitPathJs_(_st("/".__comma(aString)).__comma("/js"));
  1082. $2=_st($1)._commitPathSt_(_st("/".__comma(aString)).__comma("/st"));
  1083. return self}, function($ctx1) {$ctx1.fill(self,"setupPackageNamed:prefix:",{packageName:packageName,aString:aString},smalltalk.LegacyPackageHandler)})},
  1084. args: ["packageName", "aString"],
  1085. source: "setupPackageNamed: packageName prefix: aString\x0a\x0a\x09(Package named: packageName)\x0a\x09\x09setupClasses;\x0a\x09\x09commitPathJs: '/', aString, '/js';\x0a\x09\x09commitPathSt: '/', aString, '/st'",
  1086. messageSends: ["setupClasses", "named:", "commitPathJs:", ",", "commitPathSt:"],
  1087. referencedClasses: ["Package"]
  1088. }),
  1089. smalltalk.LegacyPackageHandler);
  1090. smalltalk.LegacyPackageHandler.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  1091. smalltalk.addMethod(
  1092. smalltalk.method({
  1093. selector: "commitPathsFromLoader",
  1094. category: 'commit paths',
  1095. fn: function (){
  1096. var self=this;
  1097. return smalltalk.withContext(function($ctx1) {
  1098. var commitPath = typeof amber !== 'undefined' && amber.commitPath;
  1099. if (!commitPath) return;
  1100. if (commitPath.js) self._defaultCommitPathJs_(commitPath.js);
  1101. if (commitPath.st) self._defaultCommitPathSt_(commitPath.st);
  1102. ;
  1103. return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.LegacyPackageHandler.klass)})},
  1104. args: [],
  1105. 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>",
  1106. messageSends: [],
  1107. referencedClasses: []
  1108. }),
  1109. smalltalk.LegacyPackageHandler.klass);
  1110. smalltalk.addMethod(
  1111. smalltalk.method({
  1112. selector: "defaultCommitPathJs",
  1113. category: 'commit paths',
  1114. fn: function (){
  1115. var self=this;
  1116. return smalltalk.withContext(function($ctx1) {
  1117. var $2,$1;
  1118. $2=self["@defaultCommitPathJs"];
  1119. if(($receiver = $2) == nil || $receiver == undefined){
  1120. self["@defaultCommitPathJs"]="js";
  1121. $1=self["@defaultCommitPathJs"];
  1122. } else {
  1123. $1=$2;
  1124. };
  1125. return $1;
  1126. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs",{},smalltalk.LegacyPackageHandler.klass)})},
  1127. args: [],
  1128. source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']",
  1129. messageSends: ["ifNil:"],
  1130. referencedClasses: []
  1131. }),
  1132. smalltalk.LegacyPackageHandler.klass);
  1133. smalltalk.addMethod(
  1134. smalltalk.method({
  1135. selector: "defaultCommitPathJs:",
  1136. category: 'commit paths',
  1137. fn: function (aString){
  1138. var self=this;
  1139. return smalltalk.withContext(function($ctx1) {
  1140. self["@defaultCommitPathJs"]=aString;
  1141. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathJs:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1142. args: ["aString"],
  1143. source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString",
  1144. messageSends: [],
  1145. referencedClasses: []
  1146. }),
  1147. smalltalk.LegacyPackageHandler.klass);
  1148. smalltalk.addMethod(
  1149. smalltalk.method({
  1150. selector: "defaultCommitPathSt",
  1151. category: 'commit paths',
  1152. fn: function (){
  1153. var self=this;
  1154. return smalltalk.withContext(function($ctx1) {
  1155. var $2,$1;
  1156. $2=self["@defaultCommitPathSt"];
  1157. if(($receiver = $2) == nil || $receiver == undefined){
  1158. self["@defaultCommitPathSt"]="st";
  1159. $1=self["@defaultCommitPathSt"];
  1160. } else {
  1161. $1=$2;
  1162. };
  1163. return $1;
  1164. }, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt",{},smalltalk.LegacyPackageHandler.klass)})},
  1165. args: [],
  1166. source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']",
  1167. messageSends: ["ifNil:"],
  1168. referencedClasses: []
  1169. }),
  1170. smalltalk.LegacyPackageHandler.klass);
  1171. smalltalk.addMethod(
  1172. smalltalk.method({
  1173. selector: "defaultCommitPathSt:",
  1174. category: 'commit paths',
  1175. fn: function (aString){
  1176. var self=this;
  1177. return smalltalk.withContext(function($ctx1) {
  1178. self["@defaultCommitPathSt"]=aString;
  1179. return self}, function($ctx1) {$ctx1.fill(self,"defaultCommitPathSt:",{aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1180. args: ["aString"],
  1181. source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString",
  1182. messageSends: [],
  1183. referencedClasses: []
  1184. }),
  1185. smalltalk.LegacyPackageHandler.klass);
  1186. smalltalk.addMethod(
  1187. smalltalk.method({
  1188. selector: "initialize",
  1189. category: 'initialization',
  1190. fn: function (){
  1191. var self=this;
  1192. return smalltalk.withContext(function($ctx1) {
  1193. smalltalk.LegacyPackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  1194. self._registerFor_("unknown");
  1195. self._commitPathsFromLoader();
  1196. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.LegacyPackageHandler.klass)})},
  1197. args: [],
  1198. source: "initialize\x0a\x09super initialize.\x0a\x09self registerFor: 'unknown'.\x0a\x09self commitPathsFromLoader",
  1199. messageSends: ["initialize", "registerFor:", "commitPathsFromLoader"],
  1200. referencedClasses: []
  1201. }),
  1202. smalltalk.LegacyPackageHandler.klass);
  1203. smalltalk.addMethod(
  1204. smalltalk.method({
  1205. selector: "loadPackages:prefix:",
  1206. category: 'loading',
  1207. fn: function (aCollection,aString){
  1208. var self=this;
  1209. return smalltalk.withContext(function($ctx1) {
  1210. var $1;
  1211. $1=_st(self._new())._loadPackages_prefix_(aCollection,aString);
  1212. return $1;
  1213. }, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.LegacyPackageHandler.klass)})},
  1214. args: ["aCollection", "aString"],
  1215. source: "loadPackages: aCollection prefix: aString\x0a\x09^ self new loadPackages: aCollection prefix: aString",
  1216. messageSends: ["loadPackages:prefix:", "new"],
  1217. referencedClasses: []
  1218. }),
  1219. smalltalk.LegacyPackageHandler.klass);
  1220. smalltalk.addMethod(
  1221. smalltalk.method({
  1222. selector: "resetCommitPaths",
  1223. category: 'commit paths',
  1224. fn: function (){
  1225. var self=this;
  1226. return smalltalk.withContext(function($ctx1) {
  1227. self["@defaultCommitPathJs"]=nil;
  1228. self["@defaultCommitPathSt"]=nil;
  1229. return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.LegacyPackageHandler.klass)})},
  1230. args: [],
  1231. source: "resetCommitPaths\x0a\x09defaultCommitPathJs := nil.\x0a\x09defaultCommitPathSt := nil",
  1232. messageSends: [],
  1233. referencedClasses: []
  1234. }),
  1235. smalltalk.LegacyPackageHandler.klass);
  1236. smalltalk.addMethod(
  1237. smalltalk.method({
  1238. selector: "commit",
  1239. category: '*Importer-Exporter',
  1240. fn: function (){
  1241. var self=this;
  1242. return smalltalk.withContext(function($ctx1) {
  1243. var $1;
  1244. $1=_st(self._transport())._commit_(self);
  1245. return $1;
  1246. }, function($ctx1) {$ctx1.fill(self,"commit",{},smalltalk.Package)})},
  1247. args: [],
  1248. source: "commit\x0a\x09^ self transport commit: self",
  1249. messageSends: ["commit:", "transport"],
  1250. referencedClasses: []
  1251. }),
  1252. smalltalk.Package);
  1253. smalltalk.addMethod(
  1254. smalltalk.method({
  1255. selector: "commitPathJs",
  1256. category: '*Importer-Exporter',
  1257. fn: function (){
  1258. var self=this;
  1259. return smalltalk.withContext(function($ctx1) {
  1260. var $3,$2,$1;
  1261. $3=self["@extension"];
  1262. if(($receiver = $3) == nil || $receiver == undefined){
  1263. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1264. $2=self["@extension"];
  1265. } else {
  1266. $2=$3;
  1267. };
  1268. $1=_st($2)._at_ifAbsentPut_("commitPathJs",(function(){
  1269. return smalltalk.withContext(function($ctx2) {
  1270. return _st(self._transport())._commitPathJsFor_(self);
  1271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1272. return $1;
  1273. }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
  1274. args: [],
  1275. source: "commitPathJs\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathJs ifAbsentPut: [self transport commitPathJsFor: self]",
  1276. messageSends: ["at:ifAbsentPut:", "commitPathJsFor:", "transport", "ifNil:"],
  1277. referencedClasses: []
  1278. }),
  1279. smalltalk.Package);
  1280. smalltalk.addMethod(
  1281. smalltalk.method({
  1282. selector: "commitPathJs:",
  1283. category: '*Importer-Exporter',
  1284. fn: function (aString){
  1285. var self=this;
  1286. return smalltalk.withContext(function($ctx1) {
  1287. var $3,$2,$1;
  1288. $3=self["@extension"];
  1289. if(($receiver = $3) == nil || $receiver == undefined){
  1290. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1291. $2=self["@extension"];
  1292. } else {
  1293. $2=$3;
  1294. };
  1295. $1=_st($2)._at_put_("commitPathJs",aString);
  1296. return $1;
  1297. }, function($ctx1) {$ctx1.fill(self,"commitPathJs:",{aString:aString},smalltalk.Package)})},
  1298. args: ["aString"],
  1299. source: "commitPathJs: aString\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathJs put: aString",
  1300. messageSends: ["at:put:", "ifNil:"],
  1301. referencedClasses: []
  1302. }),
  1303. smalltalk.Package);
  1304. smalltalk.addMethod(
  1305. smalltalk.method({
  1306. selector: "commitPathSt",
  1307. category: '*Importer-Exporter',
  1308. fn: function (){
  1309. var self=this;
  1310. return smalltalk.withContext(function($ctx1) {
  1311. var $3,$2,$1;
  1312. $3=self["@extension"];
  1313. if(($receiver = $3) == nil || $receiver == undefined){
  1314. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1315. $2=self["@extension"];
  1316. } else {
  1317. $2=$3;
  1318. };
  1319. $1=_st($2)._at_ifAbsentPut_("commitPathSt",(function(){
  1320. return smalltalk.withContext(function($ctx2) {
  1321. return _st(self._transport())._commitPathStFor_(self);
  1322. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1323. return $1;
  1324. }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
  1325. args: [],
  1326. source: "commitPathSt\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathSt ifAbsentPut: [self transport commitPathStFor: self]",
  1327. messageSends: ["at:ifAbsentPut:", "commitPathStFor:", "transport", "ifNil:"],
  1328. referencedClasses: []
  1329. }),
  1330. smalltalk.Package);
  1331. smalltalk.addMethod(
  1332. smalltalk.method({
  1333. selector: "commitPathSt:",
  1334. category: '*Importer-Exporter',
  1335. fn: function (aString){
  1336. var self=this;
  1337. return smalltalk.withContext(function($ctx1) {
  1338. var $3,$2,$1;
  1339. $3=self["@extension"];
  1340. if(($receiver = $3) == nil || $receiver == undefined){
  1341. self["@extension"]=smalltalk.HashedCollection._from_([]);
  1342. $2=self["@extension"];
  1343. } else {
  1344. $2=$3;
  1345. };
  1346. $1=_st($2)._at_put_("commitPathSt",aString);
  1347. return $1;
  1348. }, function($ctx1) {$ctx1.fill(self,"commitPathSt:",{aString:aString},smalltalk.Package)})},
  1349. args: ["aString"],
  1350. source: "commitPathSt: aString\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathSt put: aString",
  1351. messageSends: ["at:put:", "ifNil:"],
  1352. referencedClasses: []
  1353. }),
  1354. smalltalk.Package);
  1355. smalltalk.addMethod(
  1356. smalltalk.method({
  1357. selector: "transport",
  1358. category: '*Importer-Exporter',
  1359. fn: function (){
  1360. var self=this;
  1361. function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
  1362. return smalltalk.withContext(function($ctx1) {
  1363. var $1;
  1364. $1=_st($PackageHandler())._for_(self._transportType());
  1365. return $1;
  1366. }, function($ctx1) {$ctx1.fill(self,"transport",{},smalltalk.Package)})},
  1367. args: [],
  1368. source: "transport\x0a\x09^ PackageHandler for: self transportType",
  1369. messageSends: ["for:", "transportType"],
  1370. referencedClasses: ["PackageHandler"]
  1371. }),
  1372. smalltalk.Package);
  1373. smalltalk.addMethod(
  1374. smalltalk.method({
  1375. selector: "transportType",
  1376. category: '*Importer-Exporter',
  1377. fn: function (){
  1378. var self=this;
  1379. return smalltalk.withContext(function($ctx1) {
  1380. return (self.transport && self.transport.type) || 'unknown';;
  1381. return self}, function($ctx1) {$ctx1.fill(self,"transportType",{},smalltalk.Package)})},
  1382. args: [],
  1383. source: "transportType\x0a\x09<return (self.transport && self.transport.type) || 'unknown';>",
  1384. messageSends: [],
  1385. referencedClasses: []
  1386. }),
  1387. smalltalk.Package);
  1388. });