2
0

Kernel-ImportExport.js 99 KB

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