2
0

Kernel-ImportExport.js 99 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549
  1. define("amber_core/Kernel-ImportExport", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Infrastructure"], function($boot){
  2. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  3. smalltalk.addPackage('Kernel-ImportExport');
  4. smalltalk.packages["Kernel-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5. smalltalk.addClass('AbstractExporter', globals.Object, [], 'Kernel-ImportExport');
  6. globals.AbstractExporter.comment="I am an abstract exporter for Amber source code.\x0a\x0a## API\x0a\x0aUse `#exportPackage:on:` to export a given package on a Stream.";
  7. smalltalk.addMethod(
  8. smalltalk.method({
  9. selector: "chunkEscape:",
  10. protocol: 'convenience',
  11. fn: function (aString){
  12. var self=this;
  13. return smalltalk.withContext(function($ctx1) {
  14. var $1;
  15. $1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
  16. return $1;
  17. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},globals.AbstractExporter)})},
  18. args: ["aString"],
  19. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  20. messageSends: ["trimBoth", "replace:with:"],
  21. referencedClasses: []
  22. }),
  23. globals.AbstractExporter);
  24. smalltalk.addMethod(
  25. smalltalk.method({
  26. selector: "classNameFor:",
  27. protocol: 'convenience',
  28. fn: function (aClass){
  29. var self=this;
  30. return smalltalk.withContext(function($ctx1) {
  31. var $2,$3,$4,$1;
  32. $2=_st(aClass)._isMetaclass();
  33. if(smalltalk.assert($2)){
  34. $3=_st(_st(aClass)._instanceClass())._name();
  35. $ctx1.sendIdx["name"]=1;
  36. $1=_st($3).__comma(" class");
  37. } else {
  38. $4=_st(aClass)._isNil();
  39. if(smalltalk.assert($4)){
  40. $1="nil";
  41. } else {
  42. $1=_st(aClass)._name();
  43. };
  44. };
  45. return $1;
  46. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},globals.AbstractExporter)})},
  47. args: ["aClass"],
  48. 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 ] ]",
  49. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"],
  50. referencedClasses: []
  51. }),
  52. globals.AbstractExporter);
  53. smalltalk.addMethod(
  54. smalltalk.method({
  55. selector: "exportPackage:on:",
  56. protocol: 'output',
  57. fn: function (aPackage,aStream){
  58. var self=this;
  59. return smalltalk.withContext(function($ctx1) {
  60. self._subclassResponsibility();
  61. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},globals.AbstractExporter)})},
  62. args: ["aPackage", "aStream"],
  63. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  64. messageSends: ["subclassResponsibility"],
  65. referencedClasses: []
  66. }),
  67. globals.AbstractExporter);
  68. smalltalk.addMethod(
  69. smalltalk.method({
  70. selector: "extensionMethodsOfPackage:",
  71. protocol: 'accessing',
  72. fn: function (aPackage){
  73. var self=this;
  74. var result;
  75. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  76. return smalltalk.withContext(function($ctx1) {
  77. var $1;
  78. result=_st($OrderedCollection())._new();
  79. _st(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  80. return smalltalk.withContext(function($ctx2) {
  81. return _st(result)._addAll_(_st(each)._methods());
  82. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  83. $1=result;
  84. return $1;
  85. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},globals.AbstractExporter)})},
  86. args: ["aPackage"],
  87. source: "extensionMethodsOfPackage: aPackage\x0a\x09| result |\x0a\x09\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09(self extensionProtocolsOfPackage: aPackage) do: [ :each |\x0a\x09\x09result addAll: each methods ].\x0a\x09\x09\x0a\x09^ result",
  88. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"],
  89. referencedClasses: ["OrderedCollection"]
  90. }),
  91. globals.AbstractExporter);
  92. smalltalk.addMethod(
  93. smalltalk.method({
  94. selector: "extensionProtocolsOfPackage:",
  95. protocol: 'accessing',
  96. fn: function (aPackage){
  97. var self=this;
  98. var extensionName,result;
  99. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  100. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  101. function $ExportMethodProtocol(){return globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  102. return smalltalk.withContext(function($ctx1) {
  103. var $1,$2,$3,$4;
  104. $1=_st(aPackage)._name();
  105. $ctx1.sendIdx["name"]=1;
  106. extensionName="*".__comma($1);
  107. result=_st($OrderedCollection())._new();
  108. _st(_st(_st(_st($Smalltalk())._classes())._asArray())._sorted_((function(a,b){
  109. return smalltalk.withContext(function($ctx2) {
  110. $2=_st(a)._name();
  111. $ctx2.sendIdx["name"]=2;
  112. return _st($2).__lt(_st(b)._name());
  113. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})})))._do_((function(each){
  114. return smalltalk.withContext(function($ctx2) {
  115. return _st([each,_st(each)._class()])._do_((function(behavior){
  116. return smalltalk.withContext(function($ctx3) {
  117. $3=_st(_st(behavior)._protocols())._includes_(extensionName);
  118. if(smalltalk.assert($3)){
  119. return _st(result)._add_(_st($ExportMethodProtocol())._name_theClass_(extensionName,behavior));
  120. };
  121. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)})}));
  122. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  123. $ctx1.sendIdx["do:"]=1;
  124. $4=result;
  125. return $4;
  126. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},globals.AbstractExporter)})},
  127. args: ["aPackage"],
  128. source: "extensionProtocolsOfPackage: aPackage\x0a\x09| extensionName result |\x0a\x09\x0a\x09extensionName := '*', aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09\x22The classes must be loaded since it is extensions only.\x0a\x09Therefore topological sorting (dependency resolution) does not matter here.\x0a\x09Not sorting topologically improves the speed by a number of magnitude.\x0a\x09\x0a\x09Not to shuffle diffs, classes are sorted by their name.\x22\x0a\x09\x0a\x09(Smalltalk classes asArray sorted: [ :a :b | a name < b name ]) do: [ :each |\x0a\x09\x09{each. each class} do: [ :behavior |\x0a\x09\x09\x09(behavior protocols includes: extensionName) ifTrue: [\x0a\x09\x09\x09\x09result add: (ExportMethodProtocol name: extensionName theClass: behavior) ] ] ].\x0a\x0a\x09^ result",
  129. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"],
  130. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"]
  131. }),
  132. globals.AbstractExporter);
  133. smalltalk.addClass('ChunkExporter', globals.AbstractExporter, [], 'Kernel-ImportExport');
  134. globals.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.";
  135. smalltalk.addMethod(
  136. smalltalk.method({
  137. selector: "exportCategoryEpilogueOf:on:",
  138. protocol: 'output',
  139. fn: function (aCategory,aStream){
  140. var self=this;
  141. return smalltalk.withContext(function($ctx1) {
  142. var $1;
  143. _st(aStream)._nextPutAll_(" !");
  144. _st(aStream)._lf();
  145. $ctx1.sendIdx["lf"]=1;
  146. $1=_st(aStream)._lf();
  147. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},globals.ChunkExporter)})},
  148. args: ["aCategory", "aStream"],
  149. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  150. messageSends: ["nextPutAll:", "lf"],
  151. referencedClasses: []
  152. }),
  153. globals.ChunkExporter);
  154. smalltalk.addMethod(
  155. smalltalk.method({
  156. selector: "exportCategoryPrologueOf:on:",
  157. protocol: 'output',
  158. fn: function (aCategory,aStream){
  159. var self=this;
  160. return smalltalk.withContext(function($ctx1) {
  161. var $1,$3,$2;
  162. $1="!".__comma(self._classNameFor_(_st(aCategory)._theClass()));
  163. $ctx1.sendIdx[","]=1;
  164. _st(aStream)._nextPutAll_($1);
  165. $ctx1.sendIdx["nextPutAll:"]=1;
  166. $3=_st(" methodsFor: '".__comma(_st(aCategory)._name())).__comma("'!");
  167. $ctx1.sendIdx[","]=2;
  168. $2=_st(aStream)._nextPutAll_($3);
  169. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},globals.ChunkExporter)})},
  170. args: ["aCategory", "aStream"],
  171. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  172. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"],
  173. referencedClasses: []
  174. }),
  175. globals.ChunkExporter);
  176. smalltalk.addMethod(
  177. smalltalk.method({
  178. selector: "exportDefinitionOf:on:",
  179. protocol: 'output',
  180. fn: function (aClass,aStream){
  181. var self=this;
  182. return smalltalk.withContext(function($ctx1) {
  183. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12;
  184. $1=self._classNameFor_(_st(aClass)._superclass());
  185. $ctx1.sendIdx["classNameFor:"]=1;
  186. _st(aStream)._nextPutAll_($1);
  187. $ctx1.sendIdx["nextPutAll:"]=1;
  188. $3=self._classNameFor_(aClass);
  189. $ctx1.sendIdx["classNameFor:"]=2;
  190. $2=" subclass: #".__comma($3);
  191. $ctx1.sendIdx[","]=1;
  192. _st(aStream)._nextPutAll_($2);
  193. $ctx1.sendIdx["nextPutAll:"]=2;
  194. _st(aStream)._lf();
  195. $ctx1.sendIdx["lf"]=1;
  196. _st(aStream)._tab();
  197. $ctx1.sendIdx["tab"]=1;
  198. $4=_st(aStream)._nextPutAll_("instanceVariableNames: '");
  199. $ctx1.sendIdx["nextPutAll:"]=3;
  200. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  201. return smalltalk.withContext(function($ctx2) {
  202. return _st(aStream)._nextPutAll_(each);
  203. $ctx2.sendIdx["nextPutAll:"]=4;
  204. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  205. return smalltalk.withContext(function($ctx2) {
  206. return _st(aStream)._nextPutAll_(" ");
  207. $ctx2.sendIdx["nextPutAll:"]=5;
  208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  209. _st(aStream)._nextPutAll_("'");
  210. $ctx1.sendIdx["nextPutAll:"]=6;
  211. _st(aStream)._lf();
  212. $ctx1.sendIdx["lf"]=2;
  213. _st(aStream)._tab();
  214. $6="package: '".__comma(_st(aClass)._category());
  215. $ctx1.sendIdx[","]=3;
  216. $5=_st($6).__comma("'!");
  217. $ctx1.sendIdx[","]=2;
  218. _st(aStream)._nextPutAll_($5);
  219. $ctx1.sendIdx["nextPutAll:"]=7;
  220. $7=_st(aStream)._lf();
  221. $ctx1.sendIdx["lf"]=3;
  222. $9=_st(aClass)._comment();
  223. $ctx1.sendIdx["comment"]=1;
  224. $8=_st($9)._notEmpty();
  225. if(smalltalk.assert($8)){
  226. $11="!".__comma(self._classNameFor_(aClass));
  227. $ctx1.sendIdx[","]=5;
  228. $10=_st($11).__comma(" commentStamp!");
  229. $ctx1.sendIdx[","]=4;
  230. _st(aStream)._nextPutAll_($10);
  231. $ctx1.sendIdx["nextPutAll:"]=8;
  232. _st(aStream)._lf();
  233. $ctx1.sendIdx["lf"]=4;
  234. _st(aStream)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
  235. $12=_st(aStream)._lf();
  236. $ctx1.sendIdx["lf"]=5;
  237. $12;
  238. };
  239. _st(aStream)._lf();
  240. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.ChunkExporter)})},
  241. args: ["aClass", "aStream"],
  242. 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",
  243. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"],
  244. referencedClasses: []
  245. }),
  246. globals.ChunkExporter);
  247. smalltalk.addMethod(
  248. smalltalk.method({
  249. selector: "exportMetaDefinitionOf:on:",
  250. protocol: 'output',
  251. fn: function (aClass,aStream){
  252. var self=this;
  253. return smalltalk.withContext(function($ctx1) {
  254. var $3,$2,$1,$5,$4,$6,$7;
  255. $3=_st(aClass)._class();
  256. $ctx1.sendIdx["class"]=1;
  257. $2=_st($3)._instanceVariableNames();
  258. $ctx1.sendIdx["instanceVariableNames"]=1;
  259. $1=_st($2)._isEmpty();
  260. if(! smalltalk.assert($1)){
  261. $5=_st(aClass)._class();
  262. $ctx1.sendIdx["class"]=2;
  263. $4=self._classNameFor_($5);
  264. _st(aStream)._nextPutAll_($4);
  265. $ctx1.sendIdx["nextPutAll:"]=1;
  266. $6=_st(aStream)._nextPutAll_(" instanceVariableNames: '");
  267. $ctx1.sendIdx["nextPutAll:"]=2;
  268. $6;
  269. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  270. return smalltalk.withContext(function($ctx2) {
  271. return _st(aStream)._nextPutAll_(each);
  272. $ctx2.sendIdx["nextPutAll:"]=3;
  273. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  274. return smalltalk.withContext(function($ctx2) {
  275. return _st(aStream)._nextPutAll_(" ");
  276. $ctx2.sendIdx["nextPutAll:"]=4;
  277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  278. _st(aStream)._nextPutAll_("'!");
  279. _st(aStream)._lf();
  280. $ctx1.sendIdx["lf"]=1;
  281. $7=_st(aStream)._lf();
  282. $7;
  283. };
  284. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.ChunkExporter)})},
  285. args: ["aClass", "aStream"],
  286. 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 ]",
  287. messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"],
  288. referencedClasses: []
  289. }),
  290. globals.ChunkExporter);
  291. smalltalk.addMethod(
  292. smalltalk.method({
  293. selector: "exportMethod:on:",
  294. protocol: 'output',
  295. fn: function (aMethod,aStream){
  296. var self=this;
  297. return smalltalk.withContext(function($ctx1) {
  298. var $1;
  299. _st(aStream)._lf();
  300. $ctx1.sendIdx["lf"]=1;
  301. _st(aStream)._lf();
  302. $ctx1.sendIdx["lf"]=2;
  303. _st(aStream)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
  304. $ctx1.sendIdx["nextPutAll:"]=1;
  305. _st(aStream)._lf();
  306. $1=_st(aStream)._nextPutAll_("!");
  307. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},globals.ChunkExporter)})},
  308. args: ["aMethod", "aStream"],
  309. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  310. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"],
  311. referencedClasses: []
  312. }),
  313. globals.ChunkExporter);
  314. smalltalk.addMethod(
  315. smalltalk.method({
  316. selector: "exportPackage:on:",
  317. protocol: 'output',
  318. fn: function (aPackage,aStream){
  319. var self=this;
  320. return smalltalk.withContext(function($ctx1) {
  321. var $1;
  322. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  323. _st(_st(aPackage)._sortedClasses())._do_((function(each){
  324. return smalltalk.withContext(function($ctx2) {
  325. self._exportDefinitionOf_on_(each,aStream);
  326. $1=self._ownMethodProtocolsOfClass_(each);
  327. $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
  328. self._exportProtocols_on_($1,aStream);
  329. $ctx2.sendIdx["exportProtocols:on:"]=1;
  330. self._exportMetaDefinitionOf_on_(each,aStream);
  331. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_(_st(each)._class()),aStream);
  332. $ctx2.sendIdx["exportProtocols:on:"]=2;
  333. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  334. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  335. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},globals.ChunkExporter)})},
  336. args: ["aPackage", "aStream"],
  337. source: "exportPackage: aPackage on: aStream\x0a\x0a\x09self exportPackageDefinitionOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each)\x0a\x09\x09\x09on: aStream.\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each class)\x0a\x09\x09\x09on: aStream ].\x0a\x09\x09\x09\x0a\x09self \x0a\x09\x09exportProtocols: (self extensionProtocolsOfPackage: aPackage)\x0a\x09\x09on: aStream",
  338. messageSends: ["exportPackageDefinitionOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"],
  339. referencedClasses: []
  340. }),
  341. globals.ChunkExporter);
  342. smalltalk.addMethod(
  343. smalltalk.method({
  344. selector: "exportPackageDefinitionOf:on:",
  345. protocol: 'output',
  346. fn: function (aPackage,aStream){
  347. var self=this;
  348. return smalltalk.withContext(function($ctx1) {
  349. var $1,$2;
  350. $1=_st("Smalltalk createPackage: '".__comma(_st(aPackage)._name())).__comma("'!");
  351. $ctx1.sendIdx[","]=1;
  352. _st(aStream)._nextPutAll_($1);
  353. $2=_st(aStream)._lf();
  354. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},globals.ChunkExporter)})},
  355. args: ["aPackage", "aStream"],
  356. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  357. messageSends: ["nextPutAll:", ",", "name", "lf"],
  358. referencedClasses: []
  359. }),
  360. globals.ChunkExporter);
  361. smalltalk.addMethod(
  362. smalltalk.method({
  363. selector: "exportProtocol:on:",
  364. protocol: 'output',
  365. fn: function (aProtocol,aStream){
  366. var self=this;
  367. return smalltalk.withContext(function($ctx1) {
  368. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  369. _st(_st(aProtocol)._methods())._do_((function(method){
  370. return smalltalk.withContext(function($ctx2) {
  371. return self._exportMethod_on_(method,aStream);
  372. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)})}));
  373. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  374. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},globals.ChunkExporter)})},
  375. args: ["aProtocol", "aStream"],
  376. source: "exportProtocol: aProtocol on: aStream\x0a\x09self exportProtocolPrologueOf: aProtocol on: aStream.\x0a\x09aProtocol methods do: [ :method | \x0a\x09\x09self exportMethod: method on: aStream ].\x0a\x09self exportProtocolEpilogueOf: aProtocol on: aStream",
  377. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"],
  378. referencedClasses: []
  379. }),
  380. globals.ChunkExporter);
  381. smalltalk.addMethod(
  382. smalltalk.method({
  383. selector: "exportProtocolEpilogueOf:on:",
  384. protocol: 'output',
  385. fn: function (aProtocol,aStream){
  386. var self=this;
  387. return smalltalk.withContext(function($ctx1) {
  388. var $1;
  389. _st(aStream)._nextPutAll_(" !");
  390. _st(aStream)._lf();
  391. $ctx1.sendIdx["lf"]=1;
  392. $1=_st(aStream)._lf();
  393. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},globals.ChunkExporter)})},
  394. args: ["aProtocol", "aStream"],
  395. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  396. messageSends: ["nextPutAll:", "lf"],
  397. referencedClasses: []
  398. }),
  399. globals.ChunkExporter);
  400. smalltalk.addMethod(
  401. smalltalk.method({
  402. selector: "exportProtocolPrologueOf:on:",
  403. protocol: 'output',
  404. fn: function (aProtocol,aStream){
  405. var self=this;
  406. return smalltalk.withContext(function($ctx1) {
  407. var $1,$3,$2;
  408. $1="!".__comma(self._classNameFor_(_st(aProtocol)._theClass()));
  409. $ctx1.sendIdx[","]=1;
  410. _st(aStream)._nextPutAll_($1);
  411. $ctx1.sendIdx["nextPutAll:"]=1;
  412. $3=_st(" methodsFor: '".__comma(_st(aProtocol)._name())).__comma("'!");
  413. $ctx1.sendIdx[","]=2;
  414. $2=_st(aStream)._nextPutAll_($3);
  415. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},globals.ChunkExporter)})},
  416. args: ["aProtocol", "aStream"],
  417. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  418. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"],
  419. referencedClasses: []
  420. }),
  421. globals.ChunkExporter);
  422. smalltalk.addMethod(
  423. smalltalk.method({
  424. selector: "exportProtocols:on:",
  425. protocol: 'output',
  426. fn: function (aCollection,aStream){
  427. var self=this;
  428. return smalltalk.withContext(function($ctx1) {
  429. _st(aCollection)._do_((function(each){
  430. return smalltalk.withContext(function($ctx2) {
  431. return self._exportProtocol_on_(each,aStream);
  432. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  433. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},globals.ChunkExporter)})},
  434. args: ["aCollection", "aStream"],
  435. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  436. messageSends: ["do:", "exportProtocol:on:"],
  437. referencedClasses: []
  438. }),
  439. globals.ChunkExporter);
  440. smalltalk.addMethod(
  441. smalltalk.method({
  442. selector: "extensionCategoriesOfPackage:",
  443. protocol: 'accessing',
  444. fn: function (aPackage){
  445. var self=this;
  446. var name,map,result;
  447. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  448. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  449. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  450. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  451. function $MethodCategory(){return globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  452. return smalltalk.withContext(function($ctx1) {
  453. var $1,$2;
  454. name=_st(aPackage)._name();
  455. result=_st($OrderedCollection())._new();
  456. $ctx1.sendIdx["new"]=1;
  457. _st(_st($Package())._sortedClasses_(_st($Smalltalk())._classes()))._do_((function(each){
  458. return smalltalk.withContext(function($ctx2) {
  459. return _st([each,_st(each)._class()])._do_((function(aClass){
  460. return smalltalk.withContext(function($ctx3) {
  461. map=_st($Dictionary())._new();
  462. map;
  463. _st(aClass)._protocolsDo_((function(category,methods){
  464. return smalltalk.withContext(function($ctx4) {
  465. $1=_st(category).__eq("*".__comma(name));
  466. if(smalltalk.assert($1)){
  467. return _st(map)._at_put_(category,methods);
  468. };
  469. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)})}));
  470. return _st(result)._addAll_(_st(_st(_st(map)._keys())._sorted_((function(a,b){
  471. return smalltalk.withContext(function($ctx4) {
  472. return _st(a).__lt_eq(b);
  473. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)})})))._collect_((function(category){
  474. return smalltalk.withContext(function($ctx4) {
  475. return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
  476. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)})})));
  477. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)})}));
  478. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  479. $ctx1.sendIdx["do:"]=1;
  480. $2=result;
  481. return $2;
  482. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},globals.ChunkExporter)})},
  483. args: ["aPackage"],
  484. 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 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",
  485. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"],
  486. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"]
  487. }),
  488. globals.ChunkExporter);
  489. smalltalk.addMethod(
  490. smalltalk.method({
  491. selector: "ownCategoriesOfClass:",
  492. protocol: 'accessing',
  493. fn: function (aClass){
  494. var self=this;
  495. var map;
  496. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  497. function $MethodCategory(){return globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  498. return smalltalk.withContext(function($ctx1) {
  499. var $1,$2;
  500. map=_st($Dictionary())._new();
  501. _st(aClass)._protocolsDo_((function(each,methods){
  502. return smalltalk.withContext(function($ctx2) {
  503. $1=_st(each)._match_("^\x5c*");
  504. if(! smalltalk.assert($1)){
  505. return _st(map)._at_put_(each,methods);
  506. };
  507. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)})}));
  508. $2=_st(_st(_st(map)._keys())._sorted_((function(a,b){
  509. return smalltalk.withContext(function($ctx2) {
  510. return _st(a).__lt_eq(b);
  511. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})})))._collect_((function(each){
  512. return smalltalk.withContext(function($ctx2) {
  513. return _st($MethodCategory())._name_theClass_methods_(each,aClass,_st(map)._at_(each));
  514. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  515. return $2;
  516. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},globals.ChunkExporter)})},
  517. args: ["aClass"],
  518. source: "ownCategoriesOfClass: aClass\x0a\x09\x22Answer the protocols of aClass that 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: [ :each :methods |\x0a\x09\x09(each match: '^\x5c*') ifFalse: [ map at: each put: methods ] ].\x0a\x09^ (map keys sorted: [ :a :b | a <= b ]) collect: [ :each |\x0a\x09\x09MethodCategory name: each theClass: aClass methods: (map at: each) ]",
  519. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"],
  520. referencedClasses: ["Dictionary", "MethodCategory"]
  521. }),
  522. globals.ChunkExporter);
  523. smalltalk.addMethod(
  524. smalltalk.method({
  525. selector: "ownCategoriesOfMetaClass:",
  526. protocol: 'accessing',
  527. fn: function (aClass){
  528. var self=this;
  529. return smalltalk.withContext(function($ctx1) {
  530. var $1;
  531. $1=self._ownCategoriesOfClass_(_st(aClass)._class());
  532. return $1;
  533. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},globals.ChunkExporter)})},
  534. args: ["aClass"],
  535. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
  536. messageSends: ["ownCategoriesOfClass:", "class"],
  537. referencedClasses: []
  538. }),
  539. globals.ChunkExporter);
  540. smalltalk.addMethod(
  541. smalltalk.method({
  542. selector: "ownMethodProtocolsOfClass:",
  543. protocol: 'accessing',
  544. fn: function (aClass){
  545. var self=this;
  546. function $ExportMethodProtocol(){return globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  547. return smalltalk.withContext(function($ctx1) {
  548. var $1;
  549. $1=_st(_st(aClass)._ownProtocols())._collect_((function(each){
  550. return smalltalk.withContext(function($ctx2) {
  551. return _st($ExportMethodProtocol())._name_theClass_(each,aClass);
  552. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  553. return $1;
  554. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},globals.ChunkExporter)})},
  555. args: ["aClass"],
  556. source: "ownMethodProtocolsOfClass: aClass\x0a\x09\x22Answer a collection of ExportMethodProtocol object of aClass that are not package extensions\x22\x0a\x09\x0a\x09^ aClass ownProtocols collect: [ :each |\x0a\x09\x09ExportMethodProtocol name: each theClass: aClass ]",
  557. messageSends: ["collect:", "ownProtocols", "name:theClass:"],
  558. referencedClasses: ["ExportMethodProtocol"]
  559. }),
  560. globals.ChunkExporter);
  561. smalltalk.addClass('Exporter', globals.AbstractExporter, [], 'Kernel-ImportExport');
  562. globals.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.).";
  563. smalltalk.addMethod(
  564. smalltalk.method({
  565. selector: "classNameFor:",
  566. protocol: 'convenience',
  567. fn: function (aClass){
  568. var self=this;
  569. return smalltalk.withContext(function($ctx1) {
  570. var $2,$3,$4,$1;
  571. $2=_st(aClass)._isMetaclass();
  572. if(smalltalk.assert($2)){
  573. $3=_st(_st(aClass)._instanceClass())._name();
  574. $ctx1.sendIdx["name"]=1;
  575. $1=_st($3).__comma(".klass");
  576. } else {
  577. $4=_st(aClass)._isNil();
  578. if(smalltalk.assert($4)){
  579. $1="nil";
  580. } else {
  581. $1=_st(aClass)._name();
  582. };
  583. };
  584. return $1;
  585. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},globals.Exporter)})},
  586. args: ["aClass"],
  587. 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 ] ]",
  588. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"],
  589. referencedClasses: []
  590. }),
  591. globals.Exporter);
  592. smalltalk.addMethod(
  593. smalltalk.method({
  594. selector: "exportDefinitionOf:on:",
  595. protocol: 'output',
  596. fn: function (aClass,aStream){
  597. var self=this;
  598. return smalltalk.withContext(function($ctx1) {
  599. var $3,$2,$1,$5,$4,$6,$8,$7,$9,$11,$10,$12;
  600. _st(aStream)._lf();
  601. $ctx1.sendIdx["lf"]=1;
  602. _st(aStream)._nextPutAll_("smalltalk.addClass(");
  603. $ctx1.sendIdx["nextPutAll:"]=1;
  604. $3=self._classNameFor_(aClass);
  605. $ctx1.sendIdx["classNameFor:"]=1;
  606. $2="'".__comma($3);
  607. $ctx1.sendIdx[","]=2;
  608. $1=_st($2).__comma("', ");
  609. $ctx1.sendIdx[","]=1;
  610. _st(aStream)._nextPutAll_($1);
  611. $ctx1.sendIdx["nextPutAll:"]=2;
  612. $5=self._classNameFor_(_st(aClass)._superclass());
  613. $ctx1.sendIdx["classNameFor:"]=2;
  614. $4="globals.".__comma($5);
  615. $ctx1.sendIdx[","]=3;
  616. _st(aStream)._nextPutAll_($4);
  617. $ctx1.sendIdx["nextPutAll:"]=3;
  618. $6=_st(aStream)._nextPutAll_(", [");
  619. $ctx1.sendIdx["nextPutAll:"]=4;
  620. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  621. return smalltalk.withContext(function($ctx2) {
  622. $8="'".__comma(each);
  623. $ctx2.sendIdx[","]=5;
  624. $7=_st($8).__comma("'");
  625. $ctx2.sendIdx[","]=4;
  626. return _st(aStream)._nextPutAll_($7);
  627. $ctx2.sendIdx["nextPutAll:"]=5;
  628. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  629. return smalltalk.withContext(function($ctx2) {
  630. return _st(aStream)._nextPutAll_(", ");
  631. $ctx2.sendIdx["nextPutAll:"]=6;
  632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  633. _st(aStream)._nextPutAll_("], '");
  634. $ctx1.sendIdx["nextPutAll:"]=7;
  635. _st(aStream)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  636. $ctx1.sendIdx["nextPutAll:"]=8;
  637. $9=_st(aStream)._nextPutAll_(");");
  638. $ctx1.sendIdx["nextPutAll:"]=9;
  639. $11=_st(aClass)._comment();
  640. $ctx1.sendIdx["comment"]=1;
  641. $10=_st($11)._notEmpty();
  642. if(smalltalk.assert($10)){
  643. _st(aStream)._lf();
  644. $ctx1.sendIdx["lf"]=2;
  645. _st(aStream)._nextPutAll_("globals.");
  646. $ctx1.sendIdx["nextPutAll:"]=10;
  647. _st(aStream)._nextPutAll_(self._classNameFor_(aClass));
  648. $ctx1.sendIdx["nextPutAll:"]=11;
  649. _st(aStream)._nextPutAll_(".comment=");
  650. $ctx1.sendIdx["nextPutAll:"]=12;
  651. _st(aStream)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
  652. $ctx1.sendIdx["nextPutAll:"]=13;
  653. $12=_st(aStream)._nextPutAll_(";");
  654. $12;
  655. };
  656. _st(aStream)._lf();
  657. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.Exporter)})},
  658. args: ["aClass", "aStream"],
  659. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'smalltalk.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: 'globals.', (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: 'globals.';\x0a\x09\x09nextPutAll: (self classNameFor: aClass);\x0a\x09\x09nextPutAll: '.comment=';\x0a\x09\x09nextPutAll: aClass comment asJavascript;\x0a\x09\x09nextPutAll: ';' ].\x0a\x09aStream lf",
  660. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript"],
  661. referencedClasses: []
  662. }),
  663. globals.Exporter);
  664. smalltalk.addMethod(
  665. smalltalk.method({
  666. selector: "exportMetaDefinitionOf:on:",
  667. protocol: 'output',
  668. fn: function (aClass,aStream){
  669. var self=this;
  670. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  671. return smalltalk.withContext(function($ctx1) {
  672. var $3,$2,$1,$6,$5,$4,$7,$9,$8;
  673. _st(aStream)._lf();
  674. $ctx1.sendIdx["lf"]=1;
  675. $3=_st(aClass)._class();
  676. $ctx1.sendIdx["class"]=1;
  677. $2=_st($3)._instanceVariableNames();
  678. $ctx1.sendIdx["instanceVariableNames"]=1;
  679. $1=_st($2)._isEmpty();
  680. if(! smalltalk.assert($1)){
  681. $6=_st(aClass)._class();
  682. $ctx1.sendIdx["class"]=2;
  683. $5=self._classNameFor_($6);
  684. $4="globals.".__comma($5);
  685. $ctx1.sendIdx[","]=1;
  686. _st(aStream)._nextPutAll_($4);
  687. $ctx1.sendIdx["nextPutAll:"]=1;
  688. $7=_st(aStream)._nextPutAll_(".iVarNames = [");
  689. $ctx1.sendIdx["nextPutAll:"]=2;
  690. $7;
  691. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  692. return smalltalk.withContext(function($ctx2) {
  693. $9="'".__comma(each);
  694. $ctx2.sendIdx[","]=3;
  695. $8=_st($9).__comma("'");
  696. $ctx2.sendIdx[","]=2;
  697. return _st(aStream)._nextPutAll_($8);
  698. $ctx2.sendIdx["nextPutAll:"]=3;
  699. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  700. return smalltalk.withContext(function($ctx2) {
  701. return _st(aStream)._nextPutAll_(",");
  702. $ctx2.sendIdx["nextPutAll:"]=4;
  703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  704. _st(aStream)._nextPutAll_("];".__comma(_st($String())._lf()));
  705. };
  706. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.Exporter)})},
  707. args: ["aClass", "aStream"],
  708. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: 'globals.', (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 ]",
  709. messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", ",", "classNameFor:", "do:separatedBy:"],
  710. referencedClasses: ["String"]
  711. }),
  712. globals.Exporter);
  713. smalltalk.addMethod(
  714. smalltalk.method({
  715. selector: "exportMethod:on:",
  716. protocol: 'output',
  717. fn: function (aMethod,aStream){
  718. var self=this;
  719. return smalltalk.withContext(function($ctx1) {
  720. var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14,$18,$17,$19;
  721. _st(aStream)._nextPutAll_("smalltalk.addMethod(");
  722. $ctx1.sendIdx["nextPutAll:"]=1;
  723. _st(aStream)._lf();
  724. $ctx1.sendIdx["lf"]=1;
  725. _st(aStream)._nextPutAll_("smalltalk.method({");
  726. $ctx1.sendIdx["nextPutAll:"]=2;
  727. _st(aStream)._lf();
  728. $ctx1.sendIdx["lf"]=2;
  729. $3=_st(_st(aMethod)._selector())._asJavascript();
  730. $ctx1.sendIdx["asJavascript"]=1;
  731. $2="selector: ".__comma($3);
  732. $ctx1.sendIdx[","]=2;
  733. $1=_st($2).__comma(",");
  734. $ctx1.sendIdx[","]=1;
  735. _st(aStream)._nextPutAll_($1);
  736. $ctx1.sendIdx["nextPutAll:"]=3;
  737. _st(aStream)._lf();
  738. $ctx1.sendIdx["lf"]=3;
  739. $5="protocol: '".__comma(_st(aMethod)._protocol());
  740. $ctx1.sendIdx[","]=4;
  741. $4=_st($5).__comma("',");
  742. $ctx1.sendIdx[","]=3;
  743. _st(aStream)._nextPutAll_($4);
  744. $ctx1.sendIdx["nextPutAll:"]=4;
  745. _st(aStream)._lf();
  746. $ctx1.sendIdx["lf"]=4;
  747. $7="fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource());
  748. $ctx1.sendIdx[","]=6;
  749. $6=_st($7).__comma(",");
  750. $ctx1.sendIdx[","]=5;
  751. _st(aStream)._nextPutAll_($6);
  752. $ctx1.sendIdx["nextPutAll:"]=5;
  753. _st(aStream)._lf();
  754. $ctx1.sendIdx["lf"]=5;
  755. $10=_st(_st(aMethod)._arguments())._asJavascript();
  756. $ctx1.sendIdx["asJavascript"]=2;
  757. $9="args: ".__comma($10);
  758. $ctx1.sendIdx[","]=8;
  759. $8=_st($9).__comma(",");
  760. $ctx1.sendIdx[","]=7;
  761. _st(aStream)._nextPutAll_($8);
  762. $ctx1.sendIdx["nextPutAll:"]=6;
  763. _st(aStream)._lf();
  764. $ctx1.sendIdx["lf"]=6;
  765. $13=_st(_st(aMethod)._source())._asJavascript();
  766. $ctx1.sendIdx["asJavascript"]=3;
  767. $12="source: ".__comma($13);
  768. $ctx1.sendIdx[","]=10;
  769. $11=_st($12).__comma(",");
  770. $ctx1.sendIdx[","]=9;
  771. _st(aStream)._nextPutAll_($11);
  772. $ctx1.sendIdx["nextPutAll:"]=7;
  773. _st(aStream)._lf();
  774. $ctx1.sendIdx["lf"]=7;
  775. $16=_st(_st(aMethod)._messageSends())._asJavascript();
  776. $ctx1.sendIdx["asJavascript"]=4;
  777. $15="messageSends: ".__comma($16);
  778. $ctx1.sendIdx[","]=12;
  779. $14=_st($15).__comma(",");
  780. $ctx1.sendIdx[","]=11;
  781. _st(aStream)._nextPutAll_($14);
  782. $ctx1.sendIdx["nextPutAll:"]=8;
  783. _st(aStream)._lf();
  784. $ctx1.sendIdx["lf"]=8;
  785. $18="referencedClasses: ".__comma(_st(_st(aMethod)._referencedClasses())._asJavascript());
  786. $ctx1.sendIdx[","]=13;
  787. $17=_st(aStream)._nextPutAll_($18);
  788. $ctx1.sendIdx["nextPutAll:"]=9;
  789. _st(aStream)._lf();
  790. $ctx1.sendIdx["lf"]=9;
  791. _st(aStream)._nextPutAll_("}),");
  792. $ctx1.sendIdx["nextPutAll:"]=10;
  793. _st(aStream)._lf();
  794. $ctx1.sendIdx["lf"]=10;
  795. _st(aStream)._nextPutAll_("globals.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
  796. $ctx1.sendIdx["nextPutAll:"]=11;
  797. _st(aStream)._nextPutAll_(");");
  798. _st(aStream)._lf();
  799. $ctx1.sendIdx["lf"]=11;
  800. $19=_st(aStream)._lf();
  801. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},globals.Exporter)})},
  802. args: ["aMethod", "aStream"],
  803. 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: 'protocol: ''', aMethod protocol, ''',';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: 'globals.', (self classNameFor: aMethod methodClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
  804. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:", "methodClass"],
  805. referencedClasses: []
  806. }),
  807. globals.Exporter);
  808. smalltalk.addMethod(
  809. smalltalk.method({
  810. selector: "exportPackage:on:",
  811. protocol: 'output',
  812. fn: function (aPackage,aStream){
  813. var self=this;
  814. return smalltalk.withContext(function($ctx1) {
  815. var $1,$2;
  816. self._exportPackagePrologueOf_on_(aPackage,aStream);
  817. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  818. $1=self._exportPackageTransportOf_on_(aPackage,aStream);
  819. _st(_st(aPackage)._sortedClasses())._do_((function(each){
  820. return smalltalk.withContext(function($ctx2) {
  821. self._exportDefinitionOf_on_(each,aStream);
  822. $2=_st(each)._ownMethods();
  823. $ctx2.sendIdx["ownMethods"]=1;
  824. _st($2)._do_((function(method){
  825. return smalltalk.withContext(function($ctx3) {
  826. return self._exportMethod_on_(method,aStream);
  827. $ctx3.sendIdx["exportMethod:on:"]=1;
  828. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)})}));
  829. $ctx2.sendIdx["do:"]=2;
  830. self._exportMetaDefinitionOf_on_(each,aStream);
  831. return _st(_st(_st(each)._class())._ownMethods())._do_((function(method){
  832. return smalltalk.withContext(function($ctx3) {
  833. return self._exportMethod_on_(method,aStream);
  834. $ctx3.sendIdx["exportMethod:on:"]=2;
  835. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)})}));
  836. $ctx2.sendIdx["do:"]=3;
  837. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  838. $ctx1.sendIdx["do:"]=1;
  839. _st(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  840. return smalltalk.withContext(function($ctx2) {
  841. return self._exportMethod_on_(each,aStream);
  842. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  843. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  844. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)})},
  845. args: ["aPackage", "aStream"],
  846. source: "exportPackage: aPackage on: aStream\x0a\x09\x0a\x09self \x0a\x09\x09exportPackagePrologueOf: aPackage on: aStream;\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageTransportOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09each ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ].\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09each class ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ] ].\x0a\x09\x09\x09\x0a\x09(self extensionMethodsOfPackage: aPackage) do: [ :each |\x0a\x09\x09self exportMethod: each on: aStream ].\x0a\x09\x09\x0a\x09self exportPackageEpilogueOf: aPackage on: aStream",
  847. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"],
  848. referencedClasses: []
  849. }),
  850. globals.Exporter);
  851. smalltalk.addMethod(
  852. smalltalk.method({
  853. selector: "exportPackageDefinitionOf:on:",
  854. protocol: 'output',
  855. fn: function (aPackage,aStream){
  856. var self=this;
  857. return smalltalk.withContext(function($ctx1) {
  858. var $1,$2;
  859. _st(aStream)._nextPutAll_("smalltalk.addPackage(");
  860. $ctx1.sendIdx["nextPutAll:"]=1;
  861. $1=_st("'".__comma(_st(aPackage)._name())).__comma("');");
  862. $ctx1.sendIdx[","]=1;
  863. _st(aStream)._nextPutAll_($1);
  864. $2=_st(aStream)._lf();
  865. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)})},
  866. args: ["aPackage", "aStream"],
  867. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  868. messageSends: ["nextPutAll:", ",", "name", "lf"],
  869. referencedClasses: []
  870. }),
  871. globals.Exporter);
  872. smalltalk.addMethod(
  873. smalltalk.method({
  874. selector: "exportPackageEpilogueOf:on:",
  875. protocol: 'output',
  876. fn: function (aPackage,aStream){
  877. var self=this;
  878. return smalltalk.withContext(function($ctx1) {
  879. var $1;
  880. _st(aStream)._nextPutAll_("})(global_smalltalk,global_nil,global__st);");
  881. $1=_st(aStream)._lf();
  882. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)})},
  883. args: ["aPackage", "aStream"],
  884. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '})(global_smalltalk,global_nil,global__st);';\x0a\x09\x09lf",
  885. messageSends: ["nextPutAll:", "lf"],
  886. referencedClasses: []
  887. }),
  888. globals.Exporter);
  889. smalltalk.addMethod(
  890. smalltalk.method({
  891. selector: "exportPackagePrologueOf:on:",
  892. protocol: 'output',
  893. fn: function (aPackage,aStream){
  894. var self=this;
  895. return smalltalk.withContext(function($ctx1) {
  896. var $1;
  897. _st(aStream)._nextPutAll_("(function(smalltalk,nil,_st){");
  898. $1=_st(aStream)._lf();
  899. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)})},
  900. args: ["aPackage", "aStream"],
  901. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '(function(smalltalk,nil,_st){';\x0a\x09\x09lf",
  902. messageSends: ["nextPutAll:", "lf"],
  903. referencedClasses: []
  904. }),
  905. globals.Exporter);
  906. smalltalk.addMethod(
  907. smalltalk.method({
  908. selector: "exportPackageTransportOf:on:",
  909. protocol: 'output',
  910. fn: function (aPackage,aStream){
  911. var self=this;
  912. return smalltalk.withContext(function($ctx1) {
  913. var $1;
  914. _st(aStream)._nextPutAll_("smalltalk.packages[");
  915. $ctx1.sendIdx["nextPutAll:"]=1;
  916. _st(aStream)._nextPutAll_(_st(_st(aPackage)._name())._asJavascript());
  917. $ctx1.sendIdx["nextPutAll:"]=2;
  918. _st(aStream)._nextPutAll_("].transport = ");
  919. $ctx1.sendIdx["nextPutAll:"]=3;
  920. _st(aStream)._nextPutAll_(_st(_st(aPackage)._transport())._asJSONString());
  921. $ctx1.sendIdx["nextPutAll:"]=4;
  922. _st(aStream)._nextPutAll_(";");
  923. $1=_st(aStream)._lf();
  924. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)})},
  925. args: ["aPackage", "aStream"],
  926. 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 transport asJSONString;\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf",
  927. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"],
  928. referencedClasses: []
  929. }),
  930. globals.Exporter);
  931. smalltalk.addMethod(
  932. smalltalk.method({
  933. selector: "ownMethodsOfClass:",
  934. protocol: 'accessing',
  935. fn: function (aClass){
  936. var self=this;
  937. return smalltalk.withContext(function($ctx1) {
  938. var $2,$1;
  939. $1=_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  940. return smalltalk.withContext(function($ctx2) {
  941. $2=_st(a)._selector();
  942. $ctx2.sendIdx["selector"]=1;
  943. return _st($2).__lt_eq(_st(b)._selector());
  944. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})})))._reject_((function(each){
  945. return smalltalk.withContext(function($ctx2) {
  946. return _st(_st(each)._protocol())._match_("^\x5c*");
  947. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  948. return $1;
  949. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},globals.Exporter)})},
  950. args: ["aClass"],
  951. 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 protocol match: '^\x5c*') ]",
  952. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"],
  953. referencedClasses: []
  954. }),
  955. globals.Exporter);
  956. smalltalk.addMethod(
  957. smalltalk.method({
  958. selector: "ownMethodsOfMetaClass:",
  959. protocol: 'accessing',
  960. fn: function (aClass){
  961. var self=this;
  962. return smalltalk.withContext(function($ctx1) {
  963. var $1;
  964. $1=self._ownMethodsOfClass_(_st(aClass)._class());
  965. return $1;
  966. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},globals.Exporter)})},
  967. args: ["aClass"],
  968. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
  969. messageSends: ["ownMethodsOfClass:", "class"],
  970. referencedClasses: []
  971. }),
  972. globals.Exporter);
  973. smalltalk.addClass('AmdExporter', globals.Exporter, ['namespace'], 'Kernel-ImportExport');
  974. globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  975. smalltalk.addMethod(
  976. smalltalk.method({
  977. selector: "amdNamesOfPackages:",
  978. protocol: 'private',
  979. fn: function (anArray){
  980. var self=this;
  981. return smalltalk.withContext(function($ctx1) {
  982. var $2,$1;
  983. $1=_st(_st(anArray)._select_((function(each){
  984. return smalltalk.withContext(function($ctx2) {
  985. $2=self._amdNamespaceOfPackage_(each);
  986. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  987. return _st($2)._notNil();
  988. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._collect_((function(each){
  989. return smalltalk.withContext(function($ctx2) {
  990. return _st(_st(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma(_st(each)._name());
  991. $ctx2.sendIdx[","]=1;
  992. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  993. return $1;
  994. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},globals.AmdExporter)})},
  995. args: ["anArray"],
  996. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  997. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"],
  998. referencedClasses: []
  999. }),
  1000. globals.AmdExporter);
  1001. smalltalk.addMethod(
  1002. smalltalk.method({
  1003. selector: "amdNamespaceOfPackage:",
  1004. protocol: 'private',
  1005. fn: function (aPackage){
  1006. var self=this;
  1007. return smalltalk.withContext(function($ctx1) {
  1008. var $4,$3,$2,$1;
  1009. $4=_st(aPackage)._transport();
  1010. $ctx1.sendIdx["transport"]=1;
  1011. $3=_st($4)._type();
  1012. $2=_st($3).__eq("amd");
  1013. if(smalltalk.assert($2)){
  1014. $1=_st(_st(aPackage)._transport())._namespace();
  1015. } else {
  1016. $1=nil;
  1017. };
  1018. return $1;
  1019. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},globals.AmdExporter)})},
  1020. args: ["aPackage"],
  1021. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  1022. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"],
  1023. referencedClasses: []
  1024. }),
  1025. globals.AmdExporter);
  1026. smalltalk.addMethod(
  1027. smalltalk.method({
  1028. selector: "exportPackageEpilogueOf:on:",
  1029. protocol: 'output',
  1030. fn: function (aPackage,aStream){
  1031. var self=this;
  1032. return smalltalk.withContext(function($ctx1) {
  1033. var $1;
  1034. _st(aStream)._nextPutAll_("});");
  1035. $1=_st(aStream)._lf();
  1036. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},globals.AmdExporter)})},
  1037. args: ["aPackage", "aStream"],
  1038. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  1039. messageSends: ["nextPutAll:", "lf"],
  1040. referencedClasses: []
  1041. }),
  1042. globals.AmdExporter);
  1043. smalltalk.addMethod(
  1044. smalltalk.method({
  1045. selector: "exportPackagePrologueOf:on:",
  1046. protocol: 'output',
  1047. fn: function (aPackage,aStream){
  1048. var self=this;
  1049. return smalltalk.withContext(function($ctx1) {
  1050. var $1;
  1051. _st(aStream)._nextPutAll_("define(\x22");
  1052. $ctx1.sendIdx["nextPutAll:"]=1;
  1053. _st(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
  1054. $ctx1.sendIdx["nextPutAll:"]=2;
  1055. _st(aStream)._nextPutAll_("/");
  1056. $ctx1.sendIdx["nextPutAll:"]=3;
  1057. _st(aStream)._nextPutAll_(_st(aPackage)._name());
  1058. $ctx1.sendIdx["nextPutAll:"]=4;
  1059. _st(aStream)._nextPutAll_("\x22, ");
  1060. $ctx1.sendIdx["nextPutAll:"]=5;
  1061. _st(aStream)._nextPutAll_(_st(["amber/boot"].__comma(self._amdNamesOfPackages_(_st(aPackage)._loadDependencies())))._asJavascript());
  1062. $ctx1.sendIdx["nextPutAll:"]=6;
  1063. _st(aStream)._nextPutAll_(", function($boot){");
  1064. $ctx1.sendIdx["nextPutAll:"]=7;
  1065. _st(aStream)._lf();
  1066. $ctx1.sendIdx["lf"]=1;
  1067. _st(aStream)._nextPutAll_("var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;");
  1068. $1=_st(aStream)._lf();
  1069. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},globals.AmdExporter)})},
  1070. args: ["aPackage", "aStream"],
  1071. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'define(\x22';\x0a\x09\x09nextPutAll: (self amdNamespaceOfPackage: aPackage);\x0a\x09\x09nextPutAll: '/';\x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, ';\x0a\x09\x09nextPutAll: (#('amber/boot'), (self amdNamesOfPackages: aPackage loadDependencies)) asJavascript;\x0a\x09\x09nextPutAll: ', function($boot){';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;';\x0a\x09\x09lf",
  1072. messageSends: ["nextPutAll:", "amdNamespaceOfPackage:", "name", "asJavascript", ",", "amdNamesOfPackages:", "loadDependencies", "lf"],
  1073. referencedClasses: []
  1074. }),
  1075. globals.AmdExporter);
  1076. smalltalk.addClass('ChunkParser', globals.Object, ['stream', 'last'], 'Kernel-ImportExport');
  1077. globals.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";
  1078. smalltalk.addMethod(
  1079. smalltalk.method({
  1080. selector: "last",
  1081. protocol: 'accessing',
  1082. fn: function (){
  1083. var self=this;
  1084. var $1;
  1085. $1=self["@last"];
  1086. return $1;
  1087. },
  1088. args: [],
  1089. source: "last\x0a\x09^ last",
  1090. messageSends: [],
  1091. referencedClasses: []
  1092. }),
  1093. globals.ChunkParser);
  1094. smalltalk.addMethod(
  1095. smalltalk.method({
  1096. selector: "nextChunk",
  1097. protocol: 'reading',
  1098. fn: function (){
  1099. var self=this;
  1100. var char,result,chunk;
  1101. return smalltalk.withContext(function($ctx1) {
  1102. var $1,$2,$3,$4;
  1103. var $early={};
  1104. try {
  1105. result=""._writeStream();
  1106. _st((function(){
  1107. return smalltalk.withContext(function($ctx2) {
  1108. char=_st(self["@stream"])._next();
  1109. $ctx2.sendIdx["next"]=1;
  1110. char;
  1111. return _st(char)._notNil();
  1112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  1113. return smalltalk.withContext(function($ctx2) {
  1114. $1=_st(char).__eq("!");
  1115. $ctx2.sendIdx["="]=1;
  1116. if(smalltalk.assert($1)){
  1117. $2=_st(_st(self["@stream"])._peek()).__eq("!");
  1118. if(smalltalk.assert($2)){
  1119. _st(self["@stream"])._next();
  1120. } else {
  1121. self["@last"]=_st(_st(result)._contents())._trimBoth();
  1122. $3=self["@last"];
  1123. throw $early=[$3];
  1124. };
  1125. };
  1126. return _st(result)._nextPut_(char);
  1127. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1128. self["@last"]=nil;
  1129. $4=self["@last"];
  1130. return $4;
  1131. }
  1132. catch(e) {if(e===$early)return e[0]; throw e}
  1133. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},globals.ChunkParser)})},
  1134. args: [],
  1135. 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 method 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: [ ^ last := result contents trimBoth \x22chunk end marker found\x22 ]].\x0a\x09\x09\x09\x09result nextPut: char ].\x0a\x09^ last := nil \x22a chunk needs to end with !\x22",
  1136. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"],
  1137. referencedClasses: []
  1138. }),
  1139. globals.ChunkParser);
  1140. smalltalk.addMethod(
  1141. smalltalk.method({
  1142. selector: "stream:",
  1143. protocol: 'accessing',
  1144. fn: function (aStream){
  1145. var self=this;
  1146. self["@stream"]=aStream;
  1147. return self},
  1148. args: ["aStream"],
  1149. source: "stream: aStream\x0a\x09stream := aStream",
  1150. messageSends: [],
  1151. referencedClasses: []
  1152. }),
  1153. globals.ChunkParser);
  1154. smalltalk.addMethod(
  1155. smalltalk.method({
  1156. selector: "on:",
  1157. protocol: 'instance creation',
  1158. fn: function (aStream){
  1159. var self=this;
  1160. return smalltalk.withContext(function($ctx1) {
  1161. var $1;
  1162. $1=_st(self._new())._stream_(aStream);
  1163. return $1;
  1164. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},globals.ChunkParser.klass)})},
  1165. args: ["aStream"],
  1166. source: "on: aStream\x0a\x09^ self new stream: aStream",
  1167. messageSends: ["stream:", "new"],
  1168. referencedClasses: []
  1169. }),
  1170. globals.ChunkParser.klass);
  1171. smalltalk.addClass('ExportMethodProtocol', globals.Object, ['name', 'theClass'], 'Kernel-ImportExport');
  1172. globals.ExportMethodProtocol.comment="I am an abstraction for a method protocol in a class / metaclass.\x0a\x0aI know of my class, name and methods.\x0aI am used when exporting a package.";
  1173. smalltalk.addMethod(
  1174. smalltalk.method({
  1175. selector: "methods",
  1176. protocol: 'accessing',
  1177. fn: function (){
  1178. var self=this;
  1179. return smalltalk.withContext(function($ctx1) {
  1180. var $2,$1;
  1181. $1=_st(_st(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  1182. return smalltalk.withContext(function($ctx2) {
  1183. $2=_st(a)._selector();
  1184. $ctx2.sendIdx["selector"]=1;
  1185. return _st($2).__lt_eq(_st(b)._selector());
  1186. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})}));
  1187. return $1;
  1188. }, function($ctx1) {$ctx1.fill(self,"methods",{},globals.ExportMethodProtocol)})},
  1189. args: [],
  1190. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  1191. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"],
  1192. referencedClasses: []
  1193. }),
  1194. globals.ExportMethodProtocol);
  1195. smalltalk.addMethod(
  1196. smalltalk.method({
  1197. selector: "name",
  1198. protocol: 'accessing',
  1199. fn: function (){
  1200. var self=this;
  1201. var $1;
  1202. $1=self["@name"];
  1203. return $1;
  1204. },
  1205. args: [],
  1206. source: "name\x0a\x09^ name",
  1207. messageSends: [],
  1208. referencedClasses: []
  1209. }),
  1210. globals.ExportMethodProtocol);
  1211. smalltalk.addMethod(
  1212. smalltalk.method({
  1213. selector: "name:",
  1214. protocol: 'accessing',
  1215. fn: function (aString){
  1216. var self=this;
  1217. self["@name"]=aString;
  1218. return self},
  1219. args: ["aString"],
  1220. source: "name: aString\x0a\x09name := aString",
  1221. messageSends: [],
  1222. referencedClasses: []
  1223. }),
  1224. globals.ExportMethodProtocol);
  1225. smalltalk.addMethod(
  1226. smalltalk.method({
  1227. selector: "theClass",
  1228. protocol: 'accessing',
  1229. fn: function (){
  1230. var self=this;
  1231. var $1;
  1232. $1=self["@theClass"];
  1233. return $1;
  1234. },
  1235. args: [],
  1236. source: "theClass\x0a\x09^ theClass",
  1237. messageSends: [],
  1238. referencedClasses: []
  1239. }),
  1240. globals.ExportMethodProtocol);
  1241. smalltalk.addMethod(
  1242. smalltalk.method({
  1243. selector: "theClass:",
  1244. protocol: 'accessing',
  1245. fn: function (aClass){
  1246. var self=this;
  1247. self["@theClass"]=aClass;
  1248. return self},
  1249. args: ["aClass"],
  1250. source: "theClass: aClass\x0a\x09theClass := aClass",
  1251. messageSends: [],
  1252. referencedClasses: []
  1253. }),
  1254. globals.ExportMethodProtocol);
  1255. smalltalk.addMethod(
  1256. smalltalk.method({
  1257. selector: "name:theClass:",
  1258. protocol: 'instance creation',
  1259. fn: function (aString,aClass){
  1260. var self=this;
  1261. return smalltalk.withContext(function($ctx1) {
  1262. var $2,$3,$1;
  1263. $2=self._new();
  1264. _st($2)._name_(aString);
  1265. _st($2)._theClass_(aClass);
  1266. $3=_st($2)._yourself();
  1267. $1=$3;
  1268. return $1;
  1269. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},globals.ExportMethodProtocol.klass)})},
  1270. args: ["aString", "aClass"],
  1271. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  1272. messageSends: ["name:", "new", "theClass:", "yourself"],
  1273. referencedClasses: []
  1274. }),
  1275. globals.ExportMethodProtocol.klass);
  1276. smalltalk.addClass('Importer', globals.Object, ['lastSection', 'lastChunk'], 'Kernel-ImportExport');
  1277. globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  1278. smalltalk.addMethod(
  1279. smalltalk.method({
  1280. selector: "import:",
  1281. protocol: 'fileIn',
  1282. fn: function (aStream){
  1283. var self=this;
  1284. var chunk,result,parser,lastEmpty;
  1285. function $ChunkParser(){return globals.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  1286. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  1287. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1288. return smalltalk.withContext(function($ctx1) {
  1289. var $1,$2;
  1290. parser=_st($ChunkParser())._on_(aStream);
  1291. lastEmpty=false;
  1292. self["@lastSection"]="n/a, not started";
  1293. self["@lastChunk"]=nil;
  1294. _st((function(){
  1295. return smalltalk.withContext(function($ctx2) {
  1296. _st((function(){
  1297. return smalltalk.withContext(function($ctx3) {
  1298. chunk=_st(parser)._nextChunk();
  1299. chunk;
  1300. return _st(chunk)._isNil();
  1301. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._whileFalse_((function(){
  1302. return smalltalk.withContext(function($ctx3) {
  1303. $1=_st(chunk)._isEmpty();
  1304. if(smalltalk.assert($1)){
  1305. lastEmpty=true;
  1306. return lastEmpty;
  1307. } else {
  1308. self["@lastSection"]=chunk;
  1309. self["@lastSection"];
  1310. result=_st(_st($Compiler())._new())._evaluateExpression_(chunk);
  1311. result;
  1312. $2=lastEmpty;
  1313. if(smalltalk.assert($2)){
  1314. lastEmpty=false;
  1315. lastEmpty;
  1316. return _st(result)._scanFrom_(parser);
  1317. };
  1318. };
  1319. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  1320. self["@lastSection"]="n/a, finished";
  1321. return self["@lastSection"];
  1322. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(e){
  1323. return smalltalk.withContext(function($ctx2) {
  1324. self["@lastChunk"]=_st(parser)._last();
  1325. self["@lastChunk"];
  1326. return _st(e)._signal();
  1327. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)})}));
  1328. return self}, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},globals.Importer)})},
  1329. args: ["aStream"],
  1330. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\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\x09lastSection := chunk.\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 ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e signal ].",
  1331. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "signal"],
  1332. referencedClasses: ["ChunkParser", "Compiler", "Error"]
  1333. }),
  1334. globals.Importer);
  1335. smalltalk.addMethod(
  1336. smalltalk.method({
  1337. selector: "lastChunk",
  1338. protocol: 'accessing',
  1339. fn: function (){
  1340. var self=this;
  1341. var $1;
  1342. $1=self["@lastChunk"];
  1343. return $1;
  1344. },
  1345. args: [],
  1346. source: "lastChunk\x0a\x09^ lastChunk",
  1347. messageSends: [],
  1348. referencedClasses: []
  1349. }),
  1350. globals.Importer);
  1351. smalltalk.addMethod(
  1352. smalltalk.method({
  1353. selector: "lastSection",
  1354. protocol: 'accessing',
  1355. fn: function (){
  1356. var self=this;
  1357. var $1;
  1358. $1=self["@lastSection"];
  1359. return $1;
  1360. },
  1361. args: [],
  1362. source: "lastSection\x0a\x09^ lastSection",
  1363. messageSends: [],
  1364. referencedClasses: []
  1365. }),
  1366. globals.Importer);
  1367. smalltalk.addClass('PackageHandler', globals.InterfacingObject, [], 'Kernel-ImportExport');
  1368. globals.PackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  1369. smalltalk.addMethod(
  1370. smalltalk.method({
  1371. selector: "ajaxPutAt:data:onSuccess:onError:",
  1372. protocol: 'private',
  1373. fn: function (aURL,aString,aBlock,anotherBlock){
  1374. var self=this;
  1375. return smalltalk.withContext(function($ctx1) {
  1376. self._ajax_(globals.HashedCollection._newFromPairs_(["url",aURL,"type","PUT","data",aString,"contentType","text/plain;charset=UTF-8","success",aBlock,"error",anotherBlock]));
  1377. return self}, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)})},
  1378. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  1379. source: "ajaxPutAt: aURL data: aString onSuccess: aBlock onError: anotherBlock\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'success' -> aBlock.\x0a\x09\x09\x09'error' -> anotherBlock\x0a\x09\x09}",
  1380. messageSends: ["ajax:"],
  1381. referencedClasses: []
  1382. }),
  1383. globals.PackageHandler);
  1384. smalltalk.addMethod(
  1385. smalltalk.method({
  1386. selector: "chunkContentsFor:",
  1387. protocol: 'accessing',
  1388. fn: function (aPackage){
  1389. var self=this;
  1390. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  1391. return smalltalk.withContext(function($ctx1) {
  1392. var $1;
  1393. $1=_st($String())._streamContents_((function(str){
  1394. return smalltalk.withContext(function($ctx2) {
  1395. return _st(self._chunkExporter())._exportPackage_on_(aPackage,str);
  1396. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  1397. return $1;
  1398. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},globals.PackageHandler)})},
  1399. args: ["aPackage"],
  1400. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  1401. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"],
  1402. referencedClasses: ["String"]
  1403. }),
  1404. globals.PackageHandler);
  1405. smalltalk.addMethod(
  1406. smalltalk.method({
  1407. selector: "chunkExporter",
  1408. protocol: 'factory',
  1409. fn: function (){
  1410. var self=this;
  1411. return smalltalk.withContext(function($ctx1) {
  1412. var $1;
  1413. $1=_st(self._chunkExporterClass())._new();
  1414. return $1;
  1415. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},globals.PackageHandler)})},
  1416. args: [],
  1417. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  1418. messageSends: ["new", "chunkExporterClass"],
  1419. referencedClasses: []
  1420. }),
  1421. globals.PackageHandler);
  1422. smalltalk.addMethod(
  1423. smalltalk.method({
  1424. selector: "chunkExporterClass",
  1425. protocol: 'accessing',
  1426. fn: function (){
  1427. var self=this;
  1428. function $ChunkExporter(){return globals.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  1429. return $ChunkExporter();
  1430. },
  1431. args: [],
  1432. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  1433. messageSends: [],
  1434. referencedClasses: ["ChunkExporter"]
  1435. }),
  1436. globals.PackageHandler);
  1437. smalltalk.addMethod(
  1438. smalltalk.method({
  1439. selector: "commit:",
  1440. protocol: 'committing',
  1441. fn: function (aPackage){
  1442. var self=this;
  1443. function $PackageCommitError(){return globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  1444. return smalltalk.withContext(function($ctx1) {
  1445. var $1,$2,$3,$4;
  1446. self._commit_onSuccess_onError_(aPackage,(function(){
  1447. }),(function(error){
  1448. return smalltalk.withContext(function($ctx2) {
  1449. $1=_st($PackageCommitError())._new();
  1450. $2=$1;
  1451. $3=_st("Commiting failed with reason: \x22".__comma(_st(error)._responseText())).__comma("\x22");
  1452. $ctx2.sendIdx[","]=1;
  1453. _st($2)._messageText_($3);
  1454. $4=_st($1)._signal();
  1455. return $4;
  1456. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  1457. return self}, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},globals.PackageHandler)})},
  1458. args: ["aPackage"],
  1459. source: "commit: aPackage\x0a\x09self \x0a\x09\x09commit: aPackage\x0a\x09\x09onSuccess: []\x0a\x09\x09onError: [ :error |\x0a\x09\x09\x09PackageCommitError new\x0a\x09\x09\x09\x09messageText: 'Commiting failed with reason: \x22' , (error responseText) , '\x22';\x0a\x09\x09\x09\x09signal ]",
  1460. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"],
  1461. referencedClasses: ["PackageCommitError"]
  1462. }),
  1463. globals.PackageHandler);
  1464. smalltalk.addMethod(
  1465. smalltalk.method({
  1466. selector: "commit:onSuccess:onError:",
  1467. protocol: 'committing',
  1468. fn: function (aPackage,aBlock,anotherBlock){
  1469. var self=this;
  1470. return smalltalk.withContext(function($ctx1) {
  1471. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  1472. return smalltalk.withContext(function($ctx2) {
  1473. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  1474. return smalltalk.withContext(function($ctx3) {
  1475. _st(aPackage)._beClean();
  1476. return _st(aBlock)._value();
  1477. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),anotherBlock);
  1478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),anotherBlock);
  1479. return self}, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)})},
  1480. args: ["aPackage", "aBlock", "anotherBlock"],
  1481. source: "commit: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09commitJsFileFor: aPackage \x0a\x09\x09onSuccess: [\x0a\x09\x09\x09self \x0a\x09\x09\x09\x09commitStFileFor: aPackage \x0a\x09\x09\x09\x09onSuccess: [ aPackage beClean. aBlock value ]\x0a\x09\x09\x09\x09onError: anotherBlock ] \x0a\x09\x09onError: anotherBlock",
  1482. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"],
  1483. referencedClasses: []
  1484. }),
  1485. globals.PackageHandler);
  1486. smalltalk.addMethod(
  1487. smalltalk.method({
  1488. selector: "commitJsFileFor:onSuccess:onError:",
  1489. protocol: 'committing',
  1490. fn: function (aPackage,aBlock,anotherBlock){
  1491. var self=this;
  1492. return smalltalk.withContext(function($ctx1) {
  1493. var $2,$1;
  1494. $2=_st(_st(self._commitPathJsFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
  1495. $ctx1.sendIdx[","]=2;
  1496. $1=_st($2).__comma(".js");
  1497. $ctx1.sendIdx[","]=1;
  1498. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  1499. return self}, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)})},
  1500. args: ["aPackage", "aBlock", "anotherBlock"],
  1501. source: "commitJsFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathJsFor: aPackage), '/', aPackage name, '.js'\x0a\x09\x09data: (self contentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  1502. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"],
  1503. referencedClasses: []
  1504. }),
  1505. globals.PackageHandler);
  1506. smalltalk.addMethod(
  1507. smalltalk.method({
  1508. selector: "commitPathJsFor:",
  1509. protocol: 'accessing',
  1510. fn: function (aPackage){
  1511. var self=this;
  1512. return smalltalk.withContext(function($ctx1) {
  1513. self._subclassResponsibility();
  1514. return self}, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},globals.PackageHandler)})},
  1515. args: ["aPackage"],
  1516. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  1517. messageSends: ["subclassResponsibility"],
  1518. referencedClasses: []
  1519. }),
  1520. globals.PackageHandler);
  1521. smalltalk.addMethod(
  1522. smalltalk.method({
  1523. selector: "commitPathStFor:",
  1524. protocol: 'accessing',
  1525. fn: function (aPackage){
  1526. var self=this;
  1527. return smalltalk.withContext(function($ctx1) {
  1528. self._subclassResponsibility();
  1529. return self}, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},globals.PackageHandler)})},
  1530. args: ["aPackage"],
  1531. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  1532. messageSends: ["subclassResponsibility"],
  1533. referencedClasses: []
  1534. }),
  1535. globals.PackageHandler);
  1536. smalltalk.addMethod(
  1537. smalltalk.method({
  1538. selector: "commitStFileFor:onSuccess:onError:",
  1539. protocol: 'committing',
  1540. fn: function (aPackage,aBlock,anotherBlock){
  1541. var self=this;
  1542. return smalltalk.withContext(function($ctx1) {
  1543. var $2,$1;
  1544. $2=_st(_st(self._commitPathStFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
  1545. $ctx1.sendIdx[","]=2;
  1546. $1=_st($2).__comma(".st");
  1547. $ctx1.sendIdx[","]=1;
  1548. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  1549. return self}, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)})},
  1550. args: ["aPackage", "aBlock", "anotherBlock"],
  1551. source: "commitStFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathStFor: aPackage), '/', aPackage name, '.st'\x0a\x09\x09data: (self chunkContentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  1552. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"],
  1553. referencedClasses: []
  1554. }),
  1555. globals.PackageHandler);
  1556. smalltalk.addMethod(
  1557. smalltalk.method({
  1558. selector: "contentsFor:",
  1559. protocol: 'accessing',
  1560. fn: function (aPackage){
  1561. var self=this;
  1562. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  1563. return smalltalk.withContext(function($ctx1) {
  1564. var $1;
  1565. $1=_st($String())._streamContents_((function(str){
  1566. return smalltalk.withContext(function($ctx2) {
  1567. return _st(self._exporter())._exportPackage_on_(aPackage,str);
  1568. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  1569. return $1;
  1570. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},globals.PackageHandler)})},
  1571. args: ["aPackage"],
  1572. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  1573. messageSends: ["streamContents:", "exportPackage:on:", "exporter"],
  1574. referencedClasses: ["String"]
  1575. }),
  1576. globals.PackageHandler);
  1577. smalltalk.addMethod(
  1578. smalltalk.method({
  1579. selector: "exporter",
  1580. protocol: 'factory',
  1581. fn: function (){
  1582. var self=this;
  1583. return smalltalk.withContext(function($ctx1) {
  1584. var $1;
  1585. $1=_st(self._exporterClass())._new();
  1586. return $1;
  1587. }, function($ctx1) {$ctx1.fill(self,"exporter",{},globals.PackageHandler)})},
  1588. args: [],
  1589. source: "exporter\x0a\x09^ self exporterClass new",
  1590. messageSends: ["new", "exporterClass"],
  1591. referencedClasses: []
  1592. }),
  1593. globals.PackageHandler);
  1594. smalltalk.addMethod(
  1595. smalltalk.method({
  1596. selector: "exporterClass",
  1597. protocol: 'accessing',
  1598. fn: function (){
  1599. var self=this;
  1600. function $Exporter(){return globals.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  1601. return $Exporter();
  1602. },
  1603. args: [],
  1604. source: "exporterClass\x0a\x09^ Exporter",
  1605. messageSends: [],
  1606. referencedClasses: ["Exporter"]
  1607. }),
  1608. globals.PackageHandler);
  1609. smalltalk.addMethod(
  1610. smalltalk.method({
  1611. selector: "load:",
  1612. protocol: 'loading',
  1613. fn: function (aPackage){
  1614. var self=this;
  1615. return smalltalk.withContext(function($ctx1) {
  1616. self._subclassResponsibility();
  1617. return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},globals.PackageHandler)})},
  1618. args: ["aPackage"],
  1619. source: "load: aPackage\x0a\x09self subclassResponsibility",
  1620. messageSends: ["subclassResponsibility"],
  1621. referencedClasses: []
  1622. }),
  1623. globals.PackageHandler);
  1624. smalltalk.addMethod(
  1625. smalltalk.method({
  1626. selector: "onCommitError:",
  1627. protocol: 'error handling',
  1628. fn: function (anError){
  1629. var self=this;
  1630. function $PackageCommitError(){return globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  1631. return smalltalk.withContext(function($ctx1) {
  1632. var $1,$2,$3,$4;
  1633. $1=_st($PackageCommitError())._new();
  1634. $2=$1;
  1635. $3=_st("Commiting failed with reason: \x22".__comma(_st(anError)._responseText())).__comma("\x22");
  1636. $ctx1.sendIdx[","]=1;
  1637. _st($2)._messageText_($3);
  1638. $4=_st($1)._signal();
  1639. return self}, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},globals.PackageHandler)})},
  1640. args: ["anError"],
  1641. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  1642. messageSends: ["messageText:", "new", ",", "responseText", "signal"],
  1643. referencedClasses: ["PackageCommitError"]
  1644. }),
  1645. globals.PackageHandler);
  1646. smalltalk.addClass('AmdPackageHandler', globals.PackageHandler, [], 'Kernel-ImportExport');
  1647. globals.AmdPackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  1648. smalltalk.addMethod(
  1649. smalltalk.method({
  1650. selector: "commitPathJsFor:",
  1651. protocol: 'accessing',
  1652. fn: function (aPackage){
  1653. var self=this;
  1654. return smalltalk.withContext(function($ctx1) {
  1655. var $1;
  1656. $1=self._toUrl_(self._namespaceFor_(aPackage));
  1657. return $1;
  1658. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},globals.AmdPackageHandler)})},
  1659. args: ["aPackage"],
  1660. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  1661. messageSends: ["toUrl:", "namespaceFor:"],
  1662. referencedClasses: []
  1663. }),
  1664. globals.AmdPackageHandler);
  1665. smalltalk.addMethod(
  1666. smalltalk.method({
  1667. selector: "commitPathStFor:",
  1668. protocol: 'accessing',
  1669. fn: function (aPackage){
  1670. var self=this;
  1671. var path,pathWithout;
  1672. return smalltalk.withContext(function($ctx1) {
  1673. var $1,$3,$2;
  1674. $1=_st(self._namespaceFor_(aPackage)).__comma("/_source");
  1675. $ctx1.sendIdx[","]=1;
  1676. path=self._toUrl_($1);
  1677. pathWithout=self._commitPathJsFor_(aPackage);
  1678. $3=_st(path).__eq(_st(pathWithout).__comma("/_source"));
  1679. if(smalltalk.assert($3)){
  1680. $2=pathWithout;
  1681. } else {
  1682. $2=path;
  1683. };
  1684. return $2;
  1685. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},globals.AmdPackageHandler)})},
  1686. args: ["aPackage"],
  1687. source: "commitPathStFor: aPackage\x0a\x09\x22If _source is not mapped, .st will be committed to .js path.\x0a\x09It is recommended not to use _source as it can be deprecated.\x22\x0a\x09\x0a\x09| path pathWithout |\x0a\x09path := self toUrl: (self namespaceFor: aPackage), '/_source'.\x0a\x09pathWithout := self commitPathJsFor: aPackage.\x0a\x09^ path = (pathWithout, '/_source') ifTrue: [ pathWithout ] ifFalse: [ path ]",
  1688. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="],
  1689. referencedClasses: []
  1690. }),
  1691. globals.AmdPackageHandler);
  1692. smalltalk.addMethod(
  1693. smalltalk.method({
  1694. selector: "exporterClass",
  1695. protocol: 'accessing',
  1696. fn: function (){
  1697. var self=this;
  1698. function $AmdExporter(){return globals.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  1699. return $AmdExporter();
  1700. },
  1701. args: [],
  1702. source: "exporterClass\x0a\x09^ AmdExporter",
  1703. messageSends: [],
  1704. referencedClasses: ["AmdExporter"]
  1705. }),
  1706. globals.AmdPackageHandler);
  1707. smalltalk.addMethod(
  1708. smalltalk.method({
  1709. selector: "load:",
  1710. protocol: 'loading',
  1711. fn: function (aPackage){
  1712. var self=this;
  1713. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1714. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  1715. return smalltalk.withContext(function($ctx1) {
  1716. var $1,$3,$2,$receiver;
  1717. $1=_st($Smalltalk())._amdRequire();
  1718. if(($receiver = $1) == null || $receiver.isNil){
  1719. self._error_("AMD loader not present");
  1720. } else {
  1721. var require;
  1722. require=$receiver;
  1723. $3=_st(_st(self._namespaceFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
  1724. $ctx1.sendIdx[","]=1;
  1725. $2=_st($Array())._new_($3);
  1726. _st(require)._value_($2);
  1727. };
  1728. return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},globals.AmdPackageHandler)})},
  1729. args: ["aPackage"],
  1730. source: "load: aPackage\x0a\x09Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array new: (self namespaceFor: aPackage), '/', aPackage name ) ]",
  1731. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "new:", ",", "namespaceFor:", "name"],
  1732. referencedClasses: ["Smalltalk", "Array"]
  1733. }),
  1734. globals.AmdPackageHandler);
  1735. smalltalk.addMethod(
  1736. smalltalk.method({
  1737. selector: "namespaceFor:",
  1738. protocol: 'committing',
  1739. fn: function (aPackage){
  1740. var self=this;
  1741. return smalltalk.withContext(function($ctx1) {
  1742. var $1;
  1743. $1=_st(_st(aPackage)._transport())._namespace();
  1744. return $1;
  1745. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},globals.AmdPackageHandler)})},
  1746. args: ["aPackage"],
  1747. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  1748. messageSends: ["namespace", "transport"],
  1749. referencedClasses: []
  1750. }),
  1751. globals.AmdPackageHandler);
  1752. smalltalk.addMethod(
  1753. smalltalk.method({
  1754. selector: "toUrl:",
  1755. protocol: 'private',
  1756. fn: function (aString){
  1757. var self=this;
  1758. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1759. return smalltalk.withContext(function($ctx1) {
  1760. var $2,$1,$receiver;
  1761. $2=_st($Smalltalk())._amdRequire();
  1762. if(($receiver = $2) == null || $receiver.isNil){
  1763. $1=self._error_("AMD loader not present");
  1764. } else {
  1765. var require;
  1766. require=$receiver;
  1767. $1=_st(_st(require)._basicAt_("toUrl"))._value_(aString);
  1768. };
  1769. return $1;
  1770. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},globals.AmdPackageHandler)})},
  1771. args: ["aString"],
  1772. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
  1773. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"],
  1774. referencedClasses: ["Smalltalk"]
  1775. }),
  1776. globals.AmdPackageHandler);
  1777. smalltalk.addMethod(
  1778. smalltalk.method({
  1779. selector: "defaultNamespace",
  1780. protocol: 'commit paths',
  1781. fn: function (){
  1782. var self=this;
  1783. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1784. return smalltalk.withContext(function($ctx1) {
  1785. var $1;
  1786. $1=_st($Smalltalk())._defaultAmdNamespace();
  1787. return $1;
  1788. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},globals.AmdPackageHandler.klass)})},
  1789. args: [],
  1790. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  1791. messageSends: ["defaultAmdNamespace"],
  1792. referencedClasses: ["Smalltalk"]
  1793. }),
  1794. globals.AmdPackageHandler.klass);
  1795. smalltalk.addMethod(
  1796. smalltalk.method({
  1797. selector: "defaultNamespace:",
  1798. protocol: 'commit paths',
  1799. fn: function (aString){
  1800. var self=this;
  1801. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1802. return smalltalk.withContext(function($ctx1) {
  1803. _st($Smalltalk())._defaultAmdNamespace_(aString);
  1804. return self}, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},globals.AmdPackageHandler.klass)})},
  1805. args: ["aString"],
  1806. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  1807. messageSends: ["defaultAmdNamespace:"],
  1808. referencedClasses: ["Smalltalk"]
  1809. }),
  1810. globals.AmdPackageHandler.klass);
  1811. smalltalk.addClass('PackageTransport', globals.Object, ['package'], 'Kernel-ImportExport');
  1812. globals.PackageTransport.comment="I represent the transport mechanism used to commit a package.\x0a\x0aMy concrete subclasses have a `#handler` to which committing is delegated.";
  1813. smalltalk.addMethod(
  1814. smalltalk.method({
  1815. selector: "asJSON",
  1816. protocol: 'converting',
  1817. fn: function (){
  1818. var self=this;
  1819. return smalltalk.withContext(function($ctx1) {
  1820. var $1;
  1821. $1=globals.HashedCollection._newFromPairs_(["type",self._type()]);
  1822. return $1;
  1823. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},globals.PackageTransport)})},
  1824. args: [],
  1825. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  1826. messageSends: ["type"],
  1827. referencedClasses: []
  1828. }),
  1829. globals.PackageTransport);
  1830. smalltalk.addMethod(
  1831. smalltalk.method({
  1832. selector: "commit",
  1833. protocol: 'committing',
  1834. fn: function (){
  1835. var self=this;
  1836. return smalltalk.withContext(function($ctx1) {
  1837. _st(self._commitHandler())._commit_(self._package());
  1838. return self}, function($ctx1) {$ctx1.fill(self,"commit",{},globals.PackageTransport)})},
  1839. args: [],
  1840. source: "commit\x0a\x09self commitHandler commit: self package",
  1841. messageSends: ["commit:", "commitHandler", "package"],
  1842. referencedClasses: []
  1843. }),
  1844. globals.PackageTransport);
  1845. smalltalk.addMethod(
  1846. smalltalk.method({
  1847. selector: "commitHandler",
  1848. protocol: 'factory',
  1849. fn: function (){
  1850. var self=this;
  1851. return smalltalk.withContext(function($ctx1) {
  1852. var $1;
  1853. $1=_st(self._commitHandlerClass())._new();
  1854. return $1;
  1855. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},globals.PackageTransport)})},
  1856. args: [],
  1857. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  1858. messageSends: ["new", "commitHandlerClass"],
  1859. referencedClasses: []
  1860. }),
  1861. globals.PackageTransport);
  1862. smalltalk.addMethod(
  1863. smalltalk.method({
  1864. selector: "commitHandlerClass",
  1865. protocol: 'accessing',
  1866. fn: function (){
  1867. var self=this;
  1868. return smalltalk.withContext(function($ctx1) {
  1869. self._subclassResponsibility();
  1870. return self}, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},globals.PackageTransport)})},
  1871. args: [],
  1872. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  1873. messageSends: ["subclassResponsibility"],
  1874. referencedClasses: []
  1875. }),
  1876. globals.PackageTransport);
  1877. smalltalk.addMethod(
  1878. smalltalk.method({
  1879. selector: "commitOnSuccess:onError:",
  1880. protocol: 'committing',
  1881. fn: function (aBlock,anotherBlock){
  1882. var self=this;
  1883. return smalltalk.withContext(function($ctx1) {
  1884. _st(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  1885. return self}, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageTransport)})},
  1886. args: ["aBlock", "anotherBlock"],
  1887. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  1888. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"],
  1889. referencedClasses: []
  1890. }),
  1891. globals.PackageTransport);
  1892. smalltalk.addMethod(
  1893. smalltalk.method({
  1894. selector: "definition",
  1895. protocol: 'accessing',
  1896. fn: function (){
  1897. var self=this;
  1898. return "";
  1899. },
  1900. args: [],
  1901. source: "definition\x0a\x09^ ''",
  1902. messageSends: [],
  1903. referencedClasses: []
  1904. }),
  1905. globals.PackageTransport);
  1906. smalltalk.addMethod(
  1907. smalltalk.method({
  1908. selector: "load",
  1909. protocol: 'loading',
  1910. fn: function (){
  1911. var self=this;
  1912. return smalltalk.withContext(function($ctx1) {
  1913. _st(self._commitHandler())._load_(self._package());
  1914. return self}, function($ctx1) {$ctx1.fill(self,"load",{},globals.PackageTransport)})},
  1915. args: [],
  1916. source: "load\x0a\x09self commitHandler load: self package",
  1917. messageSends: ["load:", "commitHandler", "package"],
  1918. referencedClasses: []
  1919. }),
  1920. globals.PackageTransport);
  1921. smalltalk.addMethod(
  1922. smalltalk.method({
  1923. selector: "package",
  1924. protocol: 'accessing',
  1925. fn: function (){
  1926. var self=this;
  1927. var $1;
  1928. $1=self["@package"];
  1929. return $1;
  1930. },
  1931. args: [],
  1932. source: "package\x0a\x09^ package",
  1933. messageSends: [],
  1934. referencedClasses: []
  1935. }),
  1936. globals.PackageTransport);
  1937. smalltalk.addMethod(
  1938. smalltalk.method({
  1939. selector: "package:",
  1940. protocol: 'accessing',
  1941. fn: function (aPackage){
  1942. var self=this;
  1943. self["@package"]=aPackage;
  1944. return self},
  1945. args: ["aPackage"],
  1946. source: "package: aPackage\x0a\x09package := aPackage",
  1947. messageSends: [],
  1948. referencedClasses: []
  1949. }),
  1950. globals.PackageTransport);
  1951. smalltalk.addMethod(
  1952. smalltalk.method({
  1953. selector: "setupFromJson:",
  1954. protocol: 'initialization',
  1955. fn: function (anObject){
  1956. var self=this;
  1957. return self},
  1958. args: ["anObject"],
  1959. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  1960. messageSends: [],
  1961. referencedClasses: []
  1962. }),
  1963. globals.PackageTransport);
  1964. smalltalk.addMethod(
  1965. smalltalk.method({
  1966. selector: "type",
  1967. protocol: 'accessing',
  1968. fn: function (){
  1969. var self=this;
  1970. return smalltalk.withContext(function($ctx1) {
  1971. var $1;
  1972. $1=_st(self._class())._type();
  1973. return $1;
  1974. }, function($ctx1) {$ctx1.fill(self,"type",{},globals.PackageTransport)})},
  1975. args: [],
  1976. source: "type\x0a\x09^ self class type",
  1977. messageSends: ["type", "class"],
  1978. referencedClasses: []
  1979. }),
  1980. globals.PackageTransport);
  1981. globals.PackageTransport.klass.iVarNames = ['registry'];
  1982. smalltalk.addMethod(
  1983. smalltalk.method({
  1984. selector: "classRegisteredFor:",
  1985. protocol: 'accessing',
  1986. fn: function (aString){
  1987. var self=this;
  1988. return smalltalk.withContext(function($ctx1) {
  1989. var $1;
  1990. $1=_st(self["@registry"])._at_(aString);
  1991. return $1;
  1992. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},globals.PackageTransport.klass)})},
  1993. args: ["aString"],
  1994. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  1995. messageSends: ["at:"],
  1996. referencedClasses: []
  1997. }),
  1998. globals.PackageTransport.klass);
  1999. smalltalk.addMethod(
  2000. smalltalk.method({
  2001. selector: "defaultType",
  2002. protocol: 'accessing',
  2003. fn: function (){
  2004. var self=this;
  2005. function $AmdPackageTransport(){return globals.AmdPackageTransport||(typeof AmdPackageTransport=="undefined"?nil:AmdPackageTransport)}
  2006. return smalltalk.withContext(function($ctx1) {
  2007. var $1;
  2008. $1=_st($AmdPackageTransport())._type();
  2009. return $1;
  2010. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},globals.PackageTransport.klass)})},
  2011. args: [],
  2012. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  2013. messageSends: ["type"],
  2014. referencedClasses: ["AmdPackageTransport"]
  2015. }),
  2016. globals.PackageTransport.klass);
  2017. smalltalk.addMethod(
  2018. smalltalk.method({
  2019. selector: "for:",
  2020. protocol: 'instance creation',
  2021. fn: function (aString){
  2022. var self=this;
  2023. return smalltalk.withContext(function($ctx1) {
  2024. var $1;
  2025. $1=_st(self._classRegisteredFor_(aString))._new();
  2026. return $1;
  2027. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},globals.PackageTransport.klass)})},
  2028. args: ["aString"],
  2029. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  2030. messageSends: ["new", "classRegisteredFor:"],
  2031. referencedClasses: []
  2032. }),
  2033. globals.PackageTransport.klass);
  2034. smalltalk.addMethod(
  2035. smalltalk.method({
  2036. selector: "fromJson:",
  2037. protocol: 'instance creation',
  2038. fn: function (anObject){
  2039. var self=this;
  2040. return smalltalk.withContext(function($ctx1) {
  2041. var $1,$3,$4,$2,$receiver;
  2042. if(($receiver = anObject) == null || $receiver.isNil){
  2043. $1=self._for_(self._defaultType());
  2044. $ctx1.sendIdx["for:"]=1;
  2045. return $1;
  2046. } else {
  2047. anObject;
  2048. };
  2049. $3=self._for_(_st(anObject)._type());
  2050. _st($3)._setupFromJson_(anObject);
  2051. $4=_st($3)._yourself();
  2052. $2=$4;
  2053. return $2;
  2054. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},globals.PackageTransport.klass)})},
  2055. args: ["anObject"],
  2056. source: "fromJson: anObject\x0a\x09anObject ifNil: [ ^ self for: self defaultType ].\x0a\x09\x0a\x09^ (self for: anObject type)\x0a\x09\x09setupFromJson: anObject;\x0a\x09\x09yourself",
  2057. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"],
  2058. referencedClasses: []
  2059. }),
  2060. globals.PackageTransport.klass);
  2061. smalltalk.addMethod(
  2062. smalltalk.method({
  2063. selector: "initialize",
  2064. protocol: 'initialization',
  2065. fn: function (){
  2066. var self=this;
  2067. return smalltalk.withContext(function($ctx1) {
  2068. ($ctx1.supercall = true, globals.PackageTransport.klass.superclass.fn.prototype._initialize.apply(_st(self), []));
  2069. $ctx1.supercall = false;
  2070. self["@registry"]=globals.HashedCollection._newFromPairs_([]);
  2071. self._register();
  2072. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.PackageTransport.klass)})},
  2073. args: [],
  2074. source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}.\x0a\x09self register",
  2075. messageSends: ["initialize", "register"],
  2076. referencedClasses: []
  2077. }),
  2078. globals.PackageTransport.klass);
  2079. smalltalk.addMethod(
  2080. smalltalk.method({
  2081. selector: "register",
  2082. protocol: 'registration',
  2083. fn: function (){
  2084. var self=this;
  2085. function $PackageTransport(){return globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  2086. return smalltalk.withContext(function($ctx1) {
  2087. _st($PackageTransport())._register_(self);
  2088. return self}, function($ctx1) {$ctx1.fill(self,"register",{},globals.PackageTransport.klass)})},
  2089. args: [],
  2090. source: "register\x0a\x09PackageTransport register: self",
  2091. messageSends: ["register:"],
  2092. referencedClasses: ["PackageTransport"]
  2093. }),
  2094. globals.PackageTransport.klass);
  2095. smalltalk.addMethod(
  2096. smalltalk.method({
  2097. selector: "register:",
  2098. protocol: 'registration',
  2099. fn: function (aClass){
  2100. var self=this;
  2101. return smalltalk.withContext(function($ctx1) {
  2102. var $1,$receiver;
  2103. $1=_st(aClass)._type();
  2104. $ctx1.sendIdx["type"]=1;
  2105. if(($receiver = $1) == null || $receiver.isNil){
  2106. $1;
  2107. } else {
  2108. _st(self["@registry"])._at_put_(_st(aClass)._type(),aClass);
  2109. };
  2110. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},globals.PackageTransport.klass)})},
  2111. args: ["aClass"],
  2112. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  2113. messageSends: ["ifNotNil:", "type", "at:put:"],
  2114. referencedClasses: []
  2115. }),
  2116. globals.PackageTransport.klass);
  2117. smalltalk.addMethod(
  2118. smalltalk.method({
  2119. selector: "type",
  2120. protocol: 'accessing',
  2121. fn: function (){
  2122. var self=this;
  2123. return nil;
  2124. },
  2125. args: [],
  2126. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  2127. messageSends: [],
  2128. referencedClasses: []
  2129. }),
  2130. globals.PackageTransport.klass);
  2131. smalltalk.addClass('AmdPackageTransport', globals.PackageTransport, ['namespace'], 'Kernel-ImportExport');
  2132. globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  2133. smalltalk.addMethod(
  2134. smalltalk.method({
  2135. selector: "asJSON",
  2136. protocol: 'converting',
  2137. fn: function (){
  2138. var self=this;
  2139. return smalltalk.withContext(function($ctx1) {
  2140. var $2,$3,$1;
  2141. $2=($ctx1.supercall = true, globals.AmdPackageTransport.superclass.fn.prototype._asJSON.apply(_st(self), []));
  2142. $ctx1.supercall = false;
  2143. _st($2)._at_put_("amdNamespace",self._namespace());
  2144. $3=_st($2)._yourself();
  2145. $1=$3;
  2146. return $1;
  2147. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},globals.AmdPackageTransport)})},
  2148. args: [],
  2149. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  2150. messageSends: ["at:put:", "asJSON", "namespace", "yourself"],
  2151. referencedClasses: []
  2152. }),
  2153. globals.AmdPackageTransport);
  2154. smalltalk.addMethod(
  2155. smalltalk.method({
  2156. selector: "commitHandlerClass",
  2157. protocol: 'accessing',
  2158. fn: function (){
  2159. var self=this;
  2160. function $AmdPackageHandler(){return globals.AmdPackageHandler||(typeof AmdPackageHandler=="undefined"?nil:AmdPackageHandler)}
  2161. return $AmdPackageHandler();
  2162. },
  2163. args: [],
  2164. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  2165. messageSends: [],
  2166. referencedClasses: ["AmdPackageHandler"]
  2167. }),
  2168. globals.AmdPackageTransport);
  2169. smalltalk.addMethod(
  2170. smalltalk.method({
  2171. selector: "defaultNamespace",
  2172. protocol: 'defaults',
  2173. fn: function (){
  2174. var self=this;
  2175. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2176. return smalltalk.withContext(function($ctx1) {
  2177. var $1;
  2178. $1=_st($Smalltalk())._defaultAmdNamespace();
  2179. return $1;
  2180. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},globals.AmdPackageTransport)})},
  2181. args: [],
  2182. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  2183. messageSends: ["defaultAmdNamespace"],
  2184. referencedClasses: ["Smalltalk"]
  2185. }),
  2186. globals.AmdPackageTransport);
  2187. smalltalk.addMethod(
  2188. smalltalk.method({
  2189. selector: "definition",
  2190. protocol: 'accessing',
  2191. fn: function (){
  2192. var self=this;
  2193. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  2194. return smalltalk.withContext(function($ctx1) {
  2195. var $3,$2,$1;
  2196. $1=_st($String())._streamContents_((function(stream){
  2197. return smalltalk.withContext(function($ctx2) {
  2198. _st(stream)._nextPutAll_(_st(self._class())._name());
  2199. $ctx2.sendIdx["nextPutAll:"]=1;
  2200. _st(stream)._nextPutAll_(" namespace: ");
  2201. $ctx2.sendIdx["nextPutAll:"]=2;
  2202. $3=_st("'".__comma(self._namespace())).__comma("'");
  2203. $ctx2.sendIdx[","]=1;
  2204. $2=_st(stream)._nextPutAll_($3);
  2205. return $2;
  2206. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  2207. return $1;
  2208. }, function($ctx1) {$ctx1.fill(self,"definition",{},globals.AmdPackageTransport)})},
  2209. args: [],
  2210. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: ' namespace: ';\x0a\x09\x09\x09nextPutAll: '''', self namespace, '''' ]",
  2211. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"],
  2212. referencedClasses: ["String"]
  2213. }),
  2214. globals.AmdPackageTransport);
  2215. smalltalk.addMethod(
  2216. smalltalk.method({
  2217. selector: "namespace",
  2218. protocol: 'accessing',
  2219. fn: function (){
  2220. var self=this;
  2221. return smalltalk.withContext(function($ctx1) {
  2222. var $2,$1,$receiver;
  2223. $2=self["@namespace"];
  2224. if(($receiver = $2) == null || $receiver.isNil){
  2225. $1=self._defaultNamespace();
  2226. } else {
  2227. $1=$2;
  2228. };
  2229. return $1;
  2230. }, function($ctx1) {$ctx1.fill(self,"namespace",{},globals.AmdPackageTransport)})},
  2231. args: [],
  2232. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  2233. messageSends: ["ifNil:", "defaultNamespace"],
  2234. referencedClasses: []
  2235. }),
  2236. globals.AmdPackageTransport);
  2237. smalltalk.addMethod(
  2238. smalltalk.method({
  2239. selector: "namespace:",
  2240. protocol: 'accessing',
  2241. fn: function (aString){
  2242. var self=this;
  2243. self["@namespace"]=aString;
  2244. return self},
  2245. args: ["aString"],
  2246. source: "namespace: aString\x0a\x09namespace := aString",
  2247. messageSends: [],
  2248. referencedClasses: []
  2249. }),
  2250. globals.AmdPackageTransport);
  2251. smalltalk.addMethod(
  2252. smalltalk.method({
  2253. selector: "printOn:",
  2254. protocol: 'printing',
  2255. fn: function (aStream){
  2256. var self=this;
  2257. return smalltalk.withContext(function($ctx1) {
  2258. var $1;
  2259. ($ctx1.supercall = true, globals.AmdPackageTransport.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  2260. $ctx1.supercall = false;
  2261. _st(aStream)._nextPutAll_(" (AMD Namespace: ");
  2262. $ctx1.sendIdx["nextPutAll:"]=1;
  2263. _st(aStream)._nextPutAll_(self._namespace());
  2264. $ctx1.sendIdx["nextPutAll:"]=2;
  2265. $1=_st(aStream)._nextPutAll_(")");
  2266. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.AmdPackageTransport)})},
  2267. args: ["aStream"],
  2268. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  2269. messageSends: ["printOn:", "nextPutAll:", "namespace"],
  2270. referencedClasses: []
  2271. }),
  2272. globals.AmdPackageTransport);
  2273. smalltalk.addMethod(
  2274. smalltalk.method({
  2275. selector: "setPath:",
  2276. protocol: 'actions',
  2277. fn: function (aString){
  2278. var self=this;
  2279. return smalltalk.withContext(function($ctx1) {
  2280. _st(_st(require)._basicAt_("config"))._value_(globals.HashedCollection._newFromPairs_(["paths",globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  2281. return self}, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},globals.AmdPackageTransport)})},
  2282. args: ["aString"],
  2283. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09(require basicAt: 'config') value: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  2284. messageSends: ["value:", "basicAt:", "namespace"],
  2285. referencedClasses: []
  2286. }),
  2287. globals.AmdPackageTransport);
  2288. smalltalk.addMethod(
  2289. smalltalk.method({
  2290. selector: "setupFromJson:",
  2291. protocol: 'initialization',
  2292. fn: function (anObject){
  2293. var self=this;
  2294. return smalltalk.withContext(function($ctx1) {
  2295. self._namespace_(_st(anObject)._at_("amdNamespace"));
  2296. return self}, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},globals.AmdPackageTransport)})},
  2297. args: ["anObject"],
  2298. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  2299. messageSends: ["namespace:", "at:"],
  2300. referencedClasses: []
  2301. }),
  2302. globals.AmdPackageTransport);
  2303. smalltalk.addMethod(
  2304. smalltalk.method({
  2305. selector: "namespace:",
  2306. protocol: 'instance creation',
  2307. fn: function (aString){
  2308. var self=this;
  2309. return smalltalk.withContext(function($ctx1) {
  2310. var $2,$3,$1;
  2311. $2=self._new();
  2312. _st($2)._namespace_(aString);
  2313. $3=_st($2)._yourself();
  2314. $1=$3;
  2315. return $1;
  2316. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},globals.AmdPackageTransport.klass)})},
  2317. args: ["aString"],
  2318. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  2319. messageSends: ["namespace:", "new", "yourself"],
  2320. referencedClasses: []
  2321. }),
  2322. globals.AmdPackageTransport.klass);
  2323. smalltalk.addMethod(
  2324. smalltalk.method({
  2325. selector: "type",
  2326. protocol: 'accessing',
  2327. fn: function (){
  2328. var self=this;
  2329. return "amd";
  2330. },
  2331. args: [],
  2332. source: "type\x0a\x09^ 'amd'",
  2333. messageSends: [],
  2334. referencedClasses: []
  2335. }),
  2336. globals.AmdPackageTransport.klass);
  2337. smalltalk.addMethod(
  2338. smalltalk.method({
  2339. selector: "commit",
  2340. protocol: '*Kernel-ImportExport',
  2341. fn: function (){
  2342. var self=this;
  2343. return smalltalk.withContext(function($ctx1) {
  2344. var $1;
  2345. $1=_st(self._transport())._commit();
  2346. return $1;
  2347. }, function($ctx1) {$ctx1.fill(self,"commit",{},globals.Package)})},
  2348. args: [],
  2349. source: "commit\x0a\x09^ self transport commit",
  2350. messageSends: ["commit", "transport"],
  2351. referencedClasses: []
  2352. }),
  2353. globals.Package);
  2354. smalltalk.addMethod(
  2355. smalltalk.method({
  2356. selector: "load",
  2357. protocol: '*Kernel-ImportExport',
  2358. fn: function (){
  2359. var self=this;
  2360. return smalltalk.withContext(function($ctx1) {
  2361. var $1;
  2362. $1=_st(self._transport())._load();
  2363. return $1;
  2364. }, function($ctx1) {$ctx1.fill(self,"load",{},globals.Package)})},
  2365. args: [],
  2366. source: "load\x0a\x09^ self transport load",
  2367. messageSends: ["load", "transport"],
  2368. referencedClasses: []
  2369. }),
  2370. globals.Package);
  2371. smalltalk.addMethod(
  2372. smalltalk.method({
  2373. selector: "loadFromNamespace:",
  2374. protocol: '*Kernel-ImportExport',
  2375. fn: function (aString){
  2376. var self=this;
  2377. return smalltalk.withContext(function($ctx1) {
  2378. var $2,$3,$1;
  2379. $2=self._transport();
  2380. _st($2)._namespace_(aString);
  2381. $3=_st($2)._load();
  2382. $1=$3;
  2383. return $1;
  2384. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},globals.Package)})},
  2385. args: ["aString"],
  2386. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  2387. messageSends: ["namespace:", "transport", "load"],
  2388. referencedClasses: []
  2389. }),
  2390. globals.Package);
  2391. smalltalk.addMethod(
  2392. smalltalk.method({
  2393. selector: "load:",
  2394. protocol: '*Kernel-ImportExport',
  2395. fn: function (aPackageName){
  2396. var self=this;
  2397. return smalltalk.withContext(function($ctx1) {
  2398. _st(self._named_(aPackageName))._load();
  2399. return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},globals.Package.klass)})},
  2400. args: ["aPackageName"],
  2401. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  2402. messageSends: ["load", "named:"],
  2403. referencedClasses: []
  2404. }),
  2405. globals.Package.klass);
  2406. smalltalk.addMethod(
  2407. smalltalk.method({
  2408. selector: "load:fromNamespace:",
  2409. protocol: '*Kernel-ImportExport',
  2410. fn: function (aPackageName,aString){
  2411. var self=this;
  2412. return smalltalk.withContext(function($ctx1) {
  2413. _st(self._named_(aPackageName))._loadFromNamespace_(aString);
  2414. return self}, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},globals.Package.klass)})},
  2415. args: ["aPackageName", "aString"],
  2416. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  2417. messageSends: ["loadFromNamespace:", "named:"],
  2418. referencedClasses: []
  2419. }),
  2420. globals.Package.klass);
  2421. });