Importer-Exporter.js 101 KB

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