Compiler.js 194 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762
  1. smalltalk.addPackage('Compiler', {});
  2. smalltalk.addClass('ChunkParser', smalltalk.Object, ['stream'], 'Compiler');
  3. smalltalk.addMethod(
  4. "_nextChunk",
  5. smalltalk.method({
  6. selector: "nextChunk",
  7. category: 'reading',
  8. fn: function (){
  9. var self=this;
  10. var $early={};
  11. try{var char_=nil;
  12. var result=nil;
  13. var chunk=nil;
  14. (result=smalltalk.send("", "_writeStream", []));
  15. (function(){while((function(){(char_=smalltalk.send(self['@stream'], "_next", []));return smalltalk.send(char_, "_notNil", []);})()) {(function(){((($receiver = smalltalk.send(char_, "__eq", ["!"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(smalltalk.send(self['@stream'], "_peek", []), "__eq", ["!"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_next", []);})() : (function(){return (function(){throw $early=[smalltalk.send(smalltalk.send(result, "_contents", []), "_trimBoth", [])]})();})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_next", []);}), (function(){return (function(){throw $early=[smalltalk.send(smalltalk.send(result, "_contents", []), "_trimBoth", [])]})();})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(smalltalk.send(self['@stream'], "_peek", []), "__eq", ["!"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_next", []);})() : (function(){return (function(){throw $early=[smalltalk.send(smalltalk.send(result, "_contents", []), "_trimBoth", [])]})();})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_next", []);}), (function(){return (function(){throw $early=[smalltalk.send(smalltalk.send(result, "_contents", []), "_trimBoth", [])]})();})]));})]));return smalltalk.send(result, "_nextPut_", [char_]);})()}})();
  16. return nil;
  17. return self;
  18. } catch(e) {if(e===$early)return e[0]; throw e}},
  19. args: [],
  20. source: "nextChunk\x0a\x09\x22The chunk format (Smalltalk Interchange Format or Fileout format)\x0a\x09is a trivial format but can be a bit tricky to understand:\x0a\x09\x09- Uses the exclamation mark as delimiter of chunks.\x0a\x09\x09- Inside a chunk a normal exclamation mark must be doubled.\x0a\x09\x09- A non empty chunk must be a valid Smalltalk expression.\x0a\x09\x09- A chunk on top level with a preceding empty chunk is an instruction chunk:\x0a\x09\x09\x09- The object created by the expression then takes over reading chunks.\x0a\x0a\x09This metod returns next chunk as a String (trimmed), empty String (all whitespace) or nil.\x22\x0a\x0a\x09| char result chunk |\x0a\x09result := '' writeStream.\x0a [char := stream next.\x0a char notNil] whileTrue: [\x0a char = '!' ifTrue: [\x0a stream peek = '!'\x0a ifTrue: [stream next \x22skipping the escape double\x22]\x0a ifFalse: [^result contents trimBoth \x22chunk end marker found\x22]].\x0a result nextPut: char].\x0a\x09^nil \x22a chunk needs to end with !\x22",
  21. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"],
  22. referencedClasses: []
  23. }),
  24. smalltalk.ChunkParser);
  25. smalltalk.addMethod(
  26. "_stream_",
  27. smalltalk.method({
  28. selector: "stream:",
  29. category: 'accessing',
  30. fn: function (aStream){
  31. var self=this;
  32. (self['@stream']=aStream);
  33. return self;},
  34. args: ["aStream"],
  35. source: "stream: aStream\x0a\x09stream := aStream",
  36. messageSends: [],
  37. referencedClasses: []
  38. }),
  39. smalltalk.ChunkParser);
  40. smalltalk.addMethod(
  41. "_on_",
  42. smalltalk.method({
  43. selector: "on:",
  44. category: 'not yet classified',
  45. fn: function (aStream){
  46. var self=this;
  47. return smalltalk.send(smalltalk.send(self, "_new", []), "_stream_", [aStream]);
  48. return self;},
  49. args: ["aStream"],
  50. source: "on: aStream\x0a\x09^self new stream: aStream",
  51. messageSends: ["stream:", "new"],
  52. referencedClasses: []
  53. }),
  54. smalltalk.ChunkParser.klass);
  55. smalltalk.addClass('Compiler', smalltalk.Object, ['currentClass', 'source', 'unknownVariables'], 'Compiler');
  56. smalltalk.addMethod(
  57. "_codeGeneratorClass",
  58. smalltalk.method({
  59. selector: "codeGeneratorClass",
  60. category: 'accessing',
  61. fn: function (){
  62. var self=this;
  63. return (smalltalk.FunCodeGenerator || FunCodeGenerator);
  64. return self;},
  65. args: [],
  66. source: "codeGeneratorClass\x0a\x09^FunCodeGenerator",
  67. messageSends: [],
  68. referencedClasses: ["FunCodeGenerator"]
  69. }),
  70. smalltalk.Compiler);
  71. smalltalk.addMethod(
  72. "_compile_",
  73. smalltalk.method({
  74. selector: "compile:",
  75. category: 'compiling',
  76. fn: function (aString){
  77. var self=this;
  78. return smalltalk.send(self, "_compileNode_", [smalltalk.send(self, "_parse_", [aString])]);
  79. return self;},
  80. args: ["aString"],
  81. source: "compile: aString\x0a\x09^self compileNode: (self parse: aString)",
  82. messageSends: ["compileNode:", "parse:"],
  83. referencedClasses: []
  84. }),
  85. smalltalk.Compiler);
  86. smalltalk.addMethod(
  87. "_compile_forClass_",
  88. smalltalk.method({
  89. selector: "compile:forClass:",
  90. category: 'compiling',
  91. fn: function (aString, aClass){
  92. var self=this;
  93. smalltalk.send(self, "_currentClass_", [aClass]);
  94. smalltalk.send(self, "_source_", [aString]);
  95. return smalltalk.send(self, "_compile_", [aString]);
  96. return self;},
  97. args: ["aString", "aClass"],
  98. source: "compile: aString forClass: aClass\x0a\x09self currentClass: aClass.\x0a\x09self source: aString.\x0a\x09^self compile: aString",
  99. messageSends: ["currentClass:", "source:", "compile:"],
  100. referencedClasses: []
  101. }),
  102. smalltalk.Compiler);
  103. smalltalk.addMethod(
  104. "_compileExpression_",
  105. smalltalk.method({
  106. selector: "compileExpression:",
  107. category: 'compiling',
  108. fn: function (aString){
  109. var self=this;
  110. smalltalk.send(self, "_currentClass_", [(smalltalk.DoIt || DoIt)]);
  111. smalltalk.send(self, "_source_", [smalltalk.send(smalltalk.send("doIt ^[", "__comma", [aString]), "__comma", ["] value"])]);
  112. return smalltalk.send(self, "_compileNode_", [smalltalk.send(self, "_parse_", [smalltalk.send(self, "_source", [])])]);
  113. return self;},
  114. args: ["aString"],
  115. source: "compileExpression: aString\x0a\x09self currentClass: DoIt.\x0a\x09self source: 'doIt ^[', aString, '] value'.\x0a\x09^self compileNode: (self parse: self source)",
  116. messageSends: ["currentClass:", "source:", ",", "compileNode:", "parse:", "source"],
  117. referencedClasses: ["DoIt"]
  118. }),
  119. smalltalk.Compiler);
  120. smalltalk.addMethod(
  121. "_compileNode_",
  122. smalltalk.method({
  123. selector: "compileNode:",
  124. category: 'compiling',
  125. fn: function (aNode){
  126. var self=this;
  127. var generator=nil;
  128. var result=nil;
  129. (generator=smalltalk.send(smalltalk.send(self, "_codeGeneratorClass", []), "_new", []));
  130. (function($rec){smalltalk.send($rec, "_source_", [smalltalk.send(self, "_source", [])]);return smalltalk.send($rec, "_currentClass_", [smalltalk.send(self, "_currentClass", [])]);})(generator);
  131. (result=smalltalk.send(generator, "_compileNode_", [aNode]));
  132. smalltalk.send(self, "_unknownVariables_", [smalltalk.send(generator, "_unknownVariables", [])]);
  133. return result;
  134. return self;},
  135. args: ["aNode"],
  136. source: "compileNode: aNode\x0a\x09| generator result |\x0a\x09generator := self codeGeneratorClass new.\x0a\x09generator\x0a\x09\x09source: self source;\x0a\x09\x09currentClass: self currentClass.\x0a\x09result := generator compileNode: aNode.\x0a\x09self unknownVariables: generator unknownVariables.\x0a\x09^result",
  137. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "compileNode:", "unknownVariables:", "unknownVariables"],
  138. referencedClasses: []
  139. }),
  140. smalltalk.Compiler);
  141. smalltalk.addMethod(
  142. "_currentClass",
  143. smalltalk.method({
  144. selector: "currentClass",
  145. category: 'accessing',
  146. fn: function (){
  147. var self=this;
  148. return self['@currentClass'];
  149. return self;},
  150. args: [],
  151. source: "currentClass\x0a\x09^currentClass",
  152. messageSends: [],
  153. referencedClasses: []
  154. }),
  155. smalltalk.Compiler);
  156. smalltalk.addMethod(
  157. "_currentClass_",
  158. smalltalk.method({
  159. selector: "currentClass:",
  160. category: 'accessing',
  161. fn: function (aClass){
  162. var self=this;
  163. (self['@currentClass']=aClass);
  164. return self;},
  165. args: ["aClass"],
  166. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  167. messageSends: [],
  168. referencedClasses: []
  169. }),
  170. smalltalk.Compiler);
  171. smalltalk.addMethod(
  172. "_eval_",
  173. smalltalk.method({
  174. selector: "eval:",
  175. category: 'compiling',
  176. fn: function (aString){
  177. var self=this;
  178. return eval(aString);
  179. return self;},
  180. args: ["aString"],
  181. source: "eval: aString\x0a\x09<return eval(aString)>",
  182. messageSends: [],
  183. referencedClasses: []
  184. }),
  185. smalltalk.Compiler);
  186. smalltalk.addMethod(
  187. "_evaluateExpression_",
  188. smalltalk.method({
  189. selector: "evaluateExpression:",
  190. category: 'compiling',
  191. fn: function (aString){
  192. var self=this;
  193. var result=nil;
  194. smalltalk.send((smalltalk.DoIt || DoIt), "_addCompiledMethod_", [smalltalk.send(self, "_eval_", [smalltalk.send(self, "_compileExpression_", [aString])])]);
  195. (result=smalltalk.send(smalltalk.send((smalltalk.DoIt || DoIt), "_new", []), "_doIt", []));
  196. smalltalk.send((smalltalk.DoIt || DoIt), "_removeCompiledMethod_", [smalltalk.send(smalltalk.send((smalltalk.DoIt || DoIt), "_methodDictionary", []), "_at_", ["doIt"])]);
  197. return result;
  198. return self;},
  199. args: ["aString"],
  200. source: "evaluateExpression: aString\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression and answer the returned object\x22\x0a\x09| result |\x0a\x09DoIt addCompiledMethod: (self eval: (self compileExpression: aString)).\x0a\x09result := DoIt new doIt.\x0a\x09DoIt removeCompiledMethod: (DoIt methodDictionary at: 'doIt').\x0a\x09^result",
  201. messageSends: ["addCompiledMethod:", "eval:", "compileExpression:", "doIt", "new", "removeCompiledMethod:", "at:", "methodDictionary"],
  202. referencedClasses: ["DoIt"]
  203. }),
  204. smalltalk.Compiler);
  205. smalltalk.addMethod(
  206. "_install_forClass_category_",
  207. smalltalk.method({
  208. selector: "install:forClass:category:",
  209. category: 'compiling',
  210. fn: function (aString, aBehavior, anotherString){
  211. var self=this;
  212. var compiled=nil;
  213. (compiled=smalltalk.send(self, "_eval_", [smalltalk.send(self, "_compile_forClass_", [aString, aBehavior])]));
  214. smalltalk.send(compiled, "_category_", [anotherString]);
  215. smalltalk.send(aBehavior, "_addCompiledMethod_", [compiled]);
  216. return compiled;
  217. return self;},
  218. args: ["aString", "aBehavior", "anotherString"],
  219. source: "install: aString forClass: aBehavior category: anotherString\x0a\x09| compiled |\x0a\x09compiled := self eval: (self compile: aString forClass: aBehavior).\x0a\x09compiled category: anotherString.\x0a\x09aBehavior addCompiledMethod: compiled.\x0a\x09^compiled",
  220. messageSends: ["eval:", "compile:forClass:", "category:", "addCompiledMethod:"],
  221. referencedClasses: []
  222. }),
  223. smalltalk.Compiler);
  224. smalltalk.addMethod(
  225. "_parse_",
  226. smalltalk.method({
  227. selector: "parse:",
  228. category: 'compiling',
  229. fn: function (aString){
  230. var self=this;
  231. return smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_parse_", [aString]);
  232. return self;},
  233. args: ["aString"],
  234. source: "parse: aString\x0a ^Smalltalk current parse: aString",
  235. messageSends: ["parse:", "current"],
  236. referencedClasses: ["Smalltalk"]
  237. }),
  238. smalltalk.Compiler);
  239. smalltalk.addMethod(
  240. "_parseExpression_",
  241. smalltalk.method({
  242. selector: "parseExpression:",
  243. category: 'compiling',
  244. fn: function (aString){
  245. var self=this;
  246. return smalltalk.send(self, "_parse_", [smalltalk.send(smalltalk.send("doIt ^[", "__comma", [aString]), "__comma", ["] value"])]);
  247. return self;},
  248. args: ["aString"],
  249. source: "parseExpression: aString\x0a ^self parse: 'doIt ^[', aString, '] value'",
  250. messageSends: ["parse:", ","],
  251. referencedClasses: []
  252. }),
  253. smalltalk.Compiler);
  254. smalltalk.addMethod(
  255. "_recompile_",
  256. smalltalk.method({
  257. selector: "recompile:",
  258. category: 'compiling',
  259. fn: function (aClass){
  260. var self=this;
  261. smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_do_", [(function(each){return smalltalk.send(self, "_install_forClass_category_", [smalltalk.send(each, "_source", []), aClass, smalltalk.send(each, "_category", [])]);})]);
  262. smalltalk.send(self, "_setupClass_", [aClass]);
  263. ((($receiver = smalltalk.send(aClass, "_isMetaclass", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self, "_recompile_", [smalltalk.send(aClass, "_class", [])]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self, "_recompile_", [smalltalk.send(aClass, "_class", [])]);})]));
  264. return self;},
  265. args: ["aClass"],
  266. source: "recompile: aClass\x0a\x09aClass methodDictionary do: [:each |\x0a\x09\x09self install: each source forClass: aClass category: each category].\x0a\x09self setupClass: aClass.\x0a\x09aClass isMetaclass ifFalse: [self recompile: aClass class]",
  267. messageSends: ["do:", "methodDictionary", "install:forClass:category:", "source", "category", "setupClass:", "ifFalse:", "isMetaclass", "recompile:", "class"],
  268. referencedClasses: []
  269. }),
  270. smalltalk.Compiler);
  271. smalltalk.addMethod(
  272. "_recompileAll",
  273. smalltalk.method({
  274. selector: "recompileAll",
  275. category: 'compiling',
  276. fn: function (){
  277. var self=this;
  278. smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_classes", []), "_do_", [(function(each){(function($rec){smalltalk.send($rec, "_show_", [each]);return smalltalk.send($rec, "_cr", []);})((smalltalk.Transcript || Transcript));return smalltalk.send((function(){return smalltalk.send(self, "_recompile_", [each]);}), "_valueWithTimeout_", [(100)]);})]);
  279. return self;},
  280. args: [],
  281. source: "recompileAll\x0a\x09Smalltalk current classes do: [:each |\x0a\x09\x09Transcript show: each; cr.\x0a\x09\x09[self recompile: each] valueWithTimeout: 100]",
  282. messageSends: ["do:", "classes", "current", "show:", "cr", "valueWithTimeout:", "recompile:"],
  283. referencedClasses: ["Smalltalk", "Transcript"]
  284. }),
  285. smalltalk.Compiler);
  286. smalltalk.addMethod(
  287. "_setupClass_",
  288. smalltalk.method({
  289. selector: "setupClass:",
  290. category: 'compiling',
  291. fn: function (aClass){
  292. var self=this;
  293. smalltalk.init(aClass);
  294. return self;},
  295. args: ["aClass"],
  296. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass)>",
  297. messageSends: [],
  298. referencedClasses: []
  299. }),
  300. smalltalk.Compiler);
  301. smalltalk.addMethod(
  302. "_source",
  303. smalltalk.method({
  304. selector: "source",
  305. category: 'accessing',
  306. fn: function (){
  307. var self=this;
  308. return (($receiver = self['@source']) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver;
  309. return self;},
  310. args: [],
  311. source: "source\x0a\x09^source ifNil: ['']",
  312. messageSends: ["ifNil:"],
  313. referencedClasses: []
  314. }),
  315. smalltalk.Compiler);
  316. smalltalk.addMethod(
  317. "_source_",
  318. smalltalk.method({
  319. selector: "source:",
  320. category: 'accessing',
  321. fn: function (aString){
  322. var self=this;
  323. (self['@source']=aString);
  324. return self;},
  325. args: ["aString"],
  326. source: "source: aString\x0a\x09source := aString",
  327. messageSends: [],
  328. referencedClasses: []
  329. }),
  330. smalltalk.Compiler);
  331. smalltalk.addMethod(
  332. "_unknownVariables",
  333. smalltalk.method({
  334. selector: "unknownVariables",
  335. category: 'accessing',
  336. fn: function (){
  337. var self=this;
  338. return self['@unknownVariables'];
  339. return self;},
  340. args: [],
  341. source: "unknownVariables\x0a\x09^unknownVariables",
  342. messageSends: [],
  343. referencedClasses: []
  344. }),
  345. smalltalk.Compiler);
  346. smalltalk.addMethod(
  347. "_unknownVariables_",
  348. smalltalk.method({
  349. selector: "unknownVariables:",
  350. category: 'accessing',
  351. fn: function (aCollection){
  352. var self=this;
  353. (self['@unknownVariables']=aCollection);
  354. return self;},
  355. args: ["aCollection"],
  356. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  357. messageSends: [],
  358. referencedClasses: []
  359. }),
  360. smalltalk.Compiler);
  361. smalltalk.addMethod(
  362. "_recompile_",
  363. smalltalk.method({
  364. selector: "recompile:",
  365. category: 'compiling',
  366. fn: function (aClass){
  367. var self=this;
  368. smalltalk.send(smalltalk.send(self, "_new", []), "_recompile_", [aClass]);
  369. return self;},
  370. args: ["aClass"],
  371. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  372. messageSends: ["recompile:", "new"],
  373. referencedClasses: []
  374. }),
  375. smalltalk.Compiler.klass);
  376. smalltalk.addMethod(
  377. "_recompileAll",
  378. smalltalk.method({
  379. selector: "recompileAll",
  380. category: 'compiling',
  381. fn: function (){
  382. var self=this;
  383. smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_classes", []), "_do_", [(function(each){return smalltalk.send(self, "_recompile_", [each]);})]);
  384. return self;},
  385. args: [],
  386. source: "recompileAll\x0a\x09Smalltalk current classes do: [:each |\x0a\x09\x09self recompile: each]",
  387. messageSends: ["do:", "classes", "current", "recompile:"],
  388. referencedClasses: ["Smalltalk"]
  389. }),
  390. smalltalk.Compiler.klass);
  391. smalltalk.addClass('DoIt', smalltalk.Object, [], 'Compiler');
  392. smalltalk.addClass('Exporter', smalltalk.Object, [], 'Compiler');
  393. smalltalk.addMethod(
  394. "_classNameFor_",
  395. smalltalk.method({
  396. selector: "classNameFor:",
  397. category: 'private',
  398. fn: function (aClass){
  399. var self=this;
  400. return ((($receiver = smalltalk.send(aClass, "_isMetaclass", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_instanceClass", []), "_name", []), "__comma", [".klass"]);})() : (function(){return ((($receiver = smalltalk.send(aClass, "_isNil", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "nil";})() : (function(){return smalltalk.send(aClass, "_name", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "nil";}), (function(){return smalltalk.send(aClass, "_name", []);})]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_instanceClass", []), "_name", []), "__comma", [".klass"]);}), (function(){return ((($receiver = smalltalk.send(aClass, "_isNil", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "nil";})() : (function(){return smalltalk.send(aClass, "_name", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "nil";}), (function(){return smalltalk.send(aClass, "_name", []);})]));})]));
  401. return self;},
  402. args: ["aClass"],
  403. source: "classNameFor: aClass\x0a\x09^aClass isMetaclass\x0a\x09 ifTrue: [aClass instanceClass name, '.klass']\x0a\x09 ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09 ifTrue: ['nil']\x0a\x09\x09 ifFalse: [aClass name]]",
  404. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"],
  405. referencedClasses: []
  406. }),
  407. smalltalk.Exporter);
  408. smalltalk.addMethod(
  409. "_exportAll",
  410. smalltalk.method({
  411. selector: "exportAll",
  412. category: 'fileOut',
  413. fn: function (){
  414. var self=this;
  415. return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(stream){return smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_packages", []), "_do_", [(function(pkg){return smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(self, "_exportPackage_", [smalltalk.send(pkg, "_name", [])])]);})]);})]);
  416. return self;},
  417. args: [],
  418. source: "exportAll\x0a \x22Export all packages in the system.\x22\x0a\x0a ^String streamContents: [:stream |\x0a \x09Smalltalk current packages do: [:pkg |\x0a\x09\x09stream nextPutAll: (self exportPackage: pkg name)]]",
  419. messageSends: ["streamContents:", "do:", "packages", "current", "nextPutAll:", "exportPackage:", "name"],
  420. referencedClasses: ["String", "Smalltalk"]
  421. }),
  422. smalltalk.Exporter);
  423. smalltalk.addMethod(
  424. "_exportClass_",
  425. smalltalk.method({
  426. selector: "exportClass:",
  427. category: 'fileOut',
  428. fn: function (aClass){
  429. var self=this;
  430. return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(stream){smalltalk.send(self, "_exportDefinitionOf_on_", [aClass, stream]);smalltalk.send(self, "_exportMethodsOf_on_", [aClass, stream]);smalltalk.send(self, "_exportMetaDefinitionOf_on_", [aClass, stream]);return smalltalk.send(self, "_exportMethodsOf_on_", [smalltalk.send(aClass, "_class", []), stream]);})]);
  431. return self;},
  432. args: ["aClass"],
  433. source: "exportClass: aClass\x0a\x09\x22Export a single class. Subclasses override these methods.\x22\x0a\x0a\x09^String streamContents: [:stream |\x0a\x09\x09self exportDefinitionOf: aClass on: stream.\x0a\x09\x09self exportMethodsOf: aClass on: stream.\x0a\x09\x09self exportMetaDefinitionOf: aClass on: stream.\x0a\x09\x09self exportMethodsOf: aClass class on: stream]",
  434. messageSends: ["streamContents:", "exportDefinitionOf:on:", "exportMethodsOf:on:", "exportMetaDefinitionOf:on:", "class"],
  435. referencedClasses: ["String"]
  436. }),
  437. smalltalk.Exporter);
  438. smalltalk.addMethod(
  439. "_exportDefinitionOf_on_",
  440. smalltalk.method({
  441. selector: "exportDefinitionOf:on:",
  442. category: 'private',
  443. fn: function (aClass, aStream){
  444. var self=this;
  445. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["smalltalk.addClass("]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("'", "__comma", [smalltalk.send(self, "_classNameFor_", [aClass])]), "__comma", ["', "])]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send("smalltalk.", "__comma", [smalltalk.send(self, "_classNameFor_", [smalltalk.send(aClass, "_superclass", [])])])]);return smalltalk.send($rec, "_nextPutAll_", [", ["]);})(aStream);
  446. smalltalk.send(smalltalk.send(aClass, "_instanceVariableNames", []), "_do_separatedBy_", [(function(each){return smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(smalltalk.send("'", "__comma", [each]), "__comma", ["'"])]);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [", "]);})]);
  447. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["], '"]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(aClass, "_category", []), "__comma", ["'"])]);return smalltalk.send($rec, "_nextPutAll_", [");"]);})(aStream);
  448. ((($receiver = smalltalk.send(smalltalk.send(aClass, "_comment", []), "_notEmpty", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function($rec){smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", ["smalltalk."]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_classNameFor_", [aClass])]);smalltalk.send($rec, "_nextPutAll_", [".comment="]);return smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(aClass, "_comment", []), "_asJavascript", [])]);})(aStream);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function($rec){smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", ["smalltalk."]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_classNameFor_", [aClass])]);smalltalk.send($rec, "_nextPutAll_", [".comment="]);return smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(aClass, "_comment", []), "_asJavascript", [])]);})(aStream);})]));
  449. smalltalk.send(aStream, "_lf", []);
  450. return self;},
  451. args: ["aClass", "aStream"],
  452. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream \x0a\x09 nextPutAll: 'smalltalk.addClass(';\x0a\x09 nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09 nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);\x0a\x09 nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames \x0a\x09 do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09 separatedBy: [aStream nextPutAll: ', '].\x0a\x09aStream\x09\x0a\x09 nextPutAll: '], ''';\x0a\x09 nextPutAll: aClass category, '''';\x0a\x09 nextPutAll: ');'.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09 aStream \x0a\x09 \x09lf;\x0a\x09\x09nextPutAll: 'smalltalk.';\x0a\x09\x09nextPutAll: (self classNameFor: aClass);\x0a\x09\x09nextPutAll: '.comment=';\x0a\x09\x09nextPutAll: aClass comment asJavascript].\x0a\x09aStream lf",
  453. messageSends: ["nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "lf", "asJavascript"],
  454. referencedClasses: []
  455. }),
  456. smalltalk.Exporter);
  457. smalltalk.addMethod(
  458. "_exportMetaDefinitionOf_on_",
  459. smalltalk.method({
  460. selector: "exportMetaDefinitionOf:on:",
  461. category: 'private',
  462. fn: function (aClass, aStream){
  463. var self=this;
  464. ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_instanceVariableNames", []), "_isEmpty", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){(function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send("smalltalk.", "__comma", [smalltalk.send(self, "_classNameFor_", [smalltalk.send(aClass, "_class", [])])])]);return smalltalk.send($rec, "_nextPutAll_", [".iVarNames = ["]);})(aStream);smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_instanceVariableNames", []), "_do_separatedBy_", [(function(each){return smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(smalltalk.send("'", "__comma", [each]), "__comma", ["'"])]);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [","]);})]);return smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send("];", "__comma", [smalltalk.send((smalltalk.String || String), "_lf", [])])]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){(function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send("smalltalk.", "__comma", [smalltalk.send(self, "_classNameFor_", [smalltalk.send(aClass, "_class", [])])])]);return smalltalk.send($rec, "_nextPutAll_", [".iVarNames = ["]);})(aStream);smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_instanceVariableNames", []), "_do_separatedBy_", [(function(each){return smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(smalltalk.send("'", "__comma", [each]), "__comma", ["'"])]);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [","]);})]);return smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send("];", "__comma", [smalltalk.send((smalltalk.String || String), "_lf", [])])]);})]));
  465. return self;},
  466. args: ["aClass", "aStream"],
  467. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09 aStream \x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass class);\x0a\x09\x09nextPutAll: '.iVarNames = ['.\x0a\x09 aClass class instanceVariableNames\x0a\x09\x09do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09\x09separatedBy: [aStream nextPutAll: ','].\x0a\x09 aStream nextPutAll: '];', String lf]",
  468. messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", ",", "classNameFor:", "do:separatedBy:", "lf"],
  469. referencedClasses: ["String"]
  470. }),
  471. smalltalk.Exporter);
  472. smalltalk.addMethod(
  473. "_exportMethod_of_on_",
  474. smalltalk.method({
  475. selector: "exportMethod:of:on:",
  476. category: 'private',
  477. fn: function (aMethod, aClass, aStream){
  478. var self=this;
  479. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["smalltalk.addMethod("]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod, "_selector", []), "_asSelector", []), "_asJavascript", []), "__comma", [","])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", ["smalltalk.method({"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("selector: ", "__comma", [smalltalk.send(smalltalk.send(aMethod, "_selector", []), "_asJavascript", [])]), "__comma", [","])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("category: '", "__comma", [smalltalk.send(aMethod, "_category", [])]), "__comma", ["',"])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("fn: ", "__comma", [smalltalk.send(smalltalk.send(aMethod, "_fn", []), "_compiledSource", [])]), "__comma", [","])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("args: ", "__comma", [smalltalk.send(smalltalk.send(aMethod, "_arguments", []), "_asJavascript", [])]), "__comma", [","])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("source: ", "__comma", [smalltalk.send(smalltalk.send(aMethod, "_source", []), "_asJavascript", [])]), "__comma", [","])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("messageSends: ", "__comma", [smalltalk.send(smalltalk.send(aMethod, "_messageSends", []), "_asJavascript", [])]), "__comma", [","])]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", [smalltalk.send("referencedClasses: ", "__comma", [smalltalk.send(smalltalk.send(aMethod, "_referencedClasses", []), "_asJavascript", [])])]);})(aStream);
  480. (function($rec){smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", ["}),"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send("smalltalk.", "__comma", [smalltalk.send(self, "_classNameFor_", [aClass])])]);smalltalk.send($rec, "_nextPutAll_", [");"]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_lf", []);})(aStream);
  481. return self;},
  482. args: ["aMethod", "aClass", "aStream"],
  483. source: "exportMethod: aMethod of: aClass on: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: 'smalltalk.addMethod(';lf;\x0a\x09\x09nextPutAll: aMethod selector asSelector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'smalltalk.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'category: ''', aMethod category, ''',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript.\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
  484. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "asSelector", "selector", "category", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:"],
  485. referencedClasses: []
  486. }),
  487. smalltalk.Exporter);
  488. smalltalk.addMethod(
  489. "_exportMethodsOf_on_",
  490. smalltalk.method({
  491. selector: "exportMethodsOf:on:",
  492. category: 'private',
  493. fn: function (aClass, aStream){
  494. var self=this;
  495. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_values", []), "_sorted_", [(function(a, b){return ((($receiver = smalltalk.send(a, "_selector", [])).klass === smalltalk.Number) ? $receiver <=smalltalk.send(b, "_selector", []) : smalltalk.send($receiver, "__lt_eq", [smalltalk.send(b, "_selector", [])]));})]), "_do_", [(function(each){return ((($receiver = smalltalk.send(smalltalk.send(each, "_category", []), "_match_", ["^\x5c*"])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self, "_exportMethod_of_on_", [each, aClass, aStream]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self, "_exportMethod_of_on_", [each, aClass, aStream]);})]));})]);
  496. smalltalk.send(aStream, "_lf", []);
  497. return self;},
  498. args: ["aClass", "aStream"],
  499. source: "exportMethodsOf: aClass on: aStream\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09((aClass methodDictionary values) sorted: [:a :b | a selector <= b selector]) do: [:each |\x0a\x09\x09(each category match: '^\x5c*') ifFalse: [\x0a\x09\x09\x09self exportMethod: each of: aClass on: aStream]].\x0a\x09aStream lf",
  500. messageSends: ["do:", "sorted:", "values", "methodDictionary", "<=", "selector", "ifFalse:", "match:", "category", "exportMethod:of:on:", "lf"],
  501. referencedClasses: []
  502. }),
  503. smalltalk.Exporter);
  504. smalltalk.addMethod(
  505. "_exportPackage_",
  506. smalltalk.method({
  507. selector: "exportPackage:",
  508. category: 'fileOut',
  509. fn: function (packageName){
  510. var self=this;
  511. var package=nil;
  512. return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(stream){(package=smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_packageAt_", [packageName]));smalltalk.send(self, "_exportPackageDefinitionOf_on_", [package, stream]);smalltalk.send(smalltalk.send(smalltalk.send(package, "_sortedClasses", []), "_asSet", []), "_do_", [(function(each){return smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(self, "_exportClass_", [each])]);})]);return smalltalk.send(self, "_exportPackageExtensionsOf_on_", [package, stream]);})]);
  513. return self;},
  514. args: ["packageName"],
  515. source: "exportPackage: packageName\x0a\x09\x22Export a given package by name.\x22\x0a\x0a\x09| package |\x0a\x09^String streamContents: [:stream |\x0a package := Smalltalk current packageAt: packageName.\x0a self exportPackageDefinitionOf: package on: stream.\x0a\x0a\x09\x09\x22Export classes in dependency order.\x0a\x09\x09Update (issue #171): Remove duplicates for export\x22\x0a\x09 \x09package sortedClasses asSet do: [:each |\x0a stream nextPutAll: (self exportClass: each)].\x0a\x09\x09self exportPackageExtensionsOf: package on: stream]",
  516. messageSends: ["streamContents:", "packageAt:", "current", "exportPackageDefinitionOf:on:", "do:", "asSet", "sortedClasses", "nextPutAll:", "exportClass:", "exportPackageExtensionsOf:on:"],
  517. referencedClasses: ["String", "Smalltalk"]
  518. }),
  519. smalltalk.Exporter);
  520. smalltalk.addMethod(
  521. "_exportPackageDefinitionOf_on_",
  522. smalltalk.method({
  523. selector: "exportPackageDefinitionOf:on:",
  524. category: 'private',
  525. fn: function (package, aStream){
  526. var self=this;
  527. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["smalltalk.addPackage("]);return smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("'", "__comma", [smalltalk.send(package, "_name", [])]), "__comma", ["', "]), "__comma", [smalltalk.send(package, "_propertiesAsJSON", [])]), "__comma", [");"])]);})(aStream);
  528. smalltalk.send(aStream, "_lf", []);
  529. return self;},
  530. args: ["package", "aStream"],
  531. source: "exportPackageDefinitionOf: package on: aStream\x0a\x09aStream \x0a\x09 nextPutAll: 'smalltalk.addPackage(';\x0a\x09 nextPutAll: '''', package name, ''', ', package propertiesAsJSON , ');'.\x0a\x09aStream lf",
  532. messageSends: ["nextPutAll:", ",", "name", "propertiesAsJSON", "lf"],
  533. referencedClasses: []
  534. }),
  535. smalltalk.Exporter);
  536. smalltalk.addMethod(
  537. "_exportPackageExtensionsOf_on_",
  538. smalltalk.method({
  539. selector: "exportPackageExtensionsOf:on:",
  540. category: 'private',
  541. fn: function (package, aStream){
  542. var self=this;
  543. var name=nil;
  544. (name=smalltalk.send(package, "_name", []));
  545. smalltalk.send(smalltalk.send((smalltalk.Package || Package), "_sortedClasses_", [smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_classes", [])]), "_do_", [(function(each){return smalltalk.send([each,smalltalk.send(each, "_class", [])], "_do_", [(function(aClass){return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_values", []), "_sorted_", [(function(a, b){return ((($receiver = smalltalk.send(a, "_selector", [])).klass === smalltalk.Number) ? $receiver <=smalltalk.send(b, "_selector", []) : smalltalk.send($receiver, "__lt_eq", [smalltalk.send(b, "_selector", [])]));})]), "_do_", [(function(method){return ((($receiver = smalltalk.send(smalltalk.send(method, "_category", []), "_match_", [smalltalk.send("^\x5c*", "__comma", [name])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_exportMethod_of_on_", [method, aClass, aStream]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self, "_exportMethod_of_on_", [method, aClass, aStream]);})]));})]);})]);})]);
  546. return self;},
  547. args: ["package", "aStream"],
  548. source: "exportPackageExtensionsOf: package on: aStream\x0a\x09\x22Issue #143: sort classes and methods alphabetically\x22\x0a\x0a\x09| name |\x0a\x09name := package name.\x0a\x09(Package sortedClasses: Smalltalk current classes) do: [:each |\x0a\x09\x09{each. each class} do: [:aClass | \x0a\x09\x09\x09((aClass methodDictionary values) sorted: [:a :b | a selector <= b selector]) do: [:method |\x0a\x09\x09\x09\x09(method category match: '^\x5c*', name) ifTrue: [\x0a\x09\x09\x09\x09\x09self exportMethod: method of: aClass on: aStream ]]]]",
  549. messageSends: ["name", "do:", "sortedClasses:", "classes", "current", "class", "sorted:", "values", "methodDictionary", "<=", "selector", "ifTrue:", "match:", "category", ",", "exportMethod:of:on:"],
  550. referencedClasses: ["Package", "Smalltalk"]
  551. }),
  552. smalltalk.Exporter);
  553. smalltalk.addClass('ChunkExporter', smalltalk.Exporter, [], 'Compiler');
  554. smalltalk.addMethod(
  555. "_chunkEscape_",
  556. smalltalk.method({
  557. selector: "chunkEscape:",
  558. category: 'not yet classified',
  559. fn: function (aString){
  560. var self=this;
  561. return smalltalk.send(smalltalk.send(aString, "_replace_with_", ["!", "!!"]), "_trimBoth", []);
  562. return self;},
  563. args: ["aString"],
  564. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^(aString replace: '!' with: '!!') trimBoth",
  565. messageSends: ["trimBoth", "replace:with:"],
  566. referencedClasses: []
  567. }),
  568. smalltalk.ChunkExporter);
  569. smalltalk.addMethod(
  570. "_classNameFor_",
  571. smalltalk.method({
  572. selector: "classNameFor:",
  573. category: 'not yet classified',
  574. fn: function (aClass){
  575. var self=this;
  576. return ((($receiver = smalltalk.send(aClass, "_isMetaclass", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_instanceClass", []), "_name", []), "__comma", [" class"]);})() : (function(){return ((($receiver = smalltalk.send(aClass, "_isNil", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "nil";})() : (function(){return smalltalk.send(aClass, "_name", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "nil";}), (function(){return smalltalk.send(aClass, "_name", []);})]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_instanceClass", []), "_name", []), "__comma", [" class"]);}), (function(){return ((($receiver = smalltalk.send(aClass, "_isNil", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "nil";})() : (function(){return smalltalk.send(aClass, "_name", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "nil";}), (function(){return smalltalk.send(aClass, "_name", []);})]));})]));
  577. return self;},
  578. args: ["aClass"],
  579. source: "classNameFor: aClass\x0a\x09^aClass isMetaclass\x0a\x09 ifTrue: [aClass instanceClass name, ' class']\x0a\x09 ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09 ifTrue: ['nil']\x0a\x09\x09 ifFalse: [aClass name]]",
  580. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"],
  581. referencedClasses: []
  582. }),
  583. smalltalk.ChunkExporter);
  584. smalltalk.addMethod(
  585. "_exportDefinitionOf_on_",
  586. smalltalk.method({
  587. selector: "exportDefinitionOf:on:",
  588. category: 'not yet classified',
  589. fn: function (aClass, aStream){
  590. var self=this;
  591. (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_classNameFor_", [smalltalk.send(aClass, "_superclass", [])])]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(" subclass: #", "__comma", [smalltalk.send(self, "_classNameFor_", [aClass])])]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["\x09instanceVariableNames: '"]);})(aStream);
  592. smalltalk.send(smalltalk.send(aClass, "_instanceVariableNames", []), "_do_separatedBy_", [(function(each){return smalltalk.send(aStream, "_nextPutAll_", [each]);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [" "]);})]);
  593. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["'"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("\x09package: '", "__comma", [smalltalk.send(aClass, "_category", [])]), "__comma", ["'!"])]);return smalltalk.send($rec, "_lf", []);})(aStream);
  594. ((($receiver = smalltalk.send(smalltalk.send(aClass, "_comment", []), "_notEmpty", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("!", "__comma", [smalltalk.send(self, "_classNameFor_", [aClass])]), "__comma", [" commentStamp!"])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(self, "_chunkEscape_", [smalltalk.send(aClass, "_comment", [])]), "__comma", ["!"])]);return smalltalk.send($rec, "_lf", []);})(aStream);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("!", "__comma", [smalltalk.send(self, "_classNameFor_", [aClass])]), "__comma", [" commentStamp!"])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(self, "_chunkEscape_", [smalltalk.send(aClass, "_comment", [])]), "__comma", ["!"])]);return smalltalk.send($rec, "_lf", []);})(aStream);})]));
  595. smalltalk.send(aStream, "_lf", []);
  596. return self;},
  597. args: ["aClass", "aStream"],
  598. source: "exportDefinitionOf: aClass on: aStream\x0a \x22Chunk format.\x22\x0a\x0a aStream \x0a nextPutAll: (self classNameFor: aClass superclass);\x0a nextPutAll: ' subclass: #', (self classNameFor: aClass); lf;\x0a nextPutAll: '\x09instanceVariableNames: '''.\x0a aClass instanceVariableNames \x0a do: [:each | aStream nextPutAll: each]\x0a separatedBy: [aStream nextPutAll: ' '].\x0a aStream \x0a nextPutAll: ''''; lf;\x0a nextPutAll: '\x09package: ''', aClass category, '''!'; lf.\x0a aClass comment notEmpty ifTrue: [\x0a aStream \x0a nextPutAll: '!', (self classNameFor: aClass), ' commentStamp!';lf;\x0a nextPutAll: (self chunkEscape: aClass comment), '!';lf].\x0a aStream lf",
  599. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"],
  600. referencedClasses: []
  601. }),
  602. smalltalk.ChunkExporter);
  603. smalltalk.addMethod(
  604. "_exportMetaDefinitionOf_on_",
  605. smalltalk.method({
  606. selector: "exportMetaDefinitionOf:on:",
  607. category: 'not yet classified',
  608. fn: function (aClass, aStream){
  609. var self=this;
  610. ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_instanceVariableNames", []), "_isEmpty", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){(function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_classNameFor_", [smalltalk.send(aClass, "_class", [])])]);return smalltalk.send($rec, "_nextPutAll_", [" instanceVariableNames: '"]);})(aStream);smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_instanceVariableNames", []), "_do_separatedBy_", [(function(each){return smalltalk.send(aStream, "_nextPutAll_", [each]);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [" "]);})]);return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["'!"]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_lf", []);})(aStream);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){(function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_classNameFor_", [smalltalk.send(aClass, "_class", [])])]);return smalltalk.send($rec, "_nextPutAll_", [" instanceVariableNames: '"]);})(aStream);smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_instanceVariableNames", []), "_do_separatedBy_", [(function(each){return smalltalk.send(aStream, "_nextPutAll_", [each]);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [" "]);})]);return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["'!"]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_lf", []);})(aStream);})]));
  611. return self;},
  612. args: ["aClass", "aStream"],
  613. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream \x0a\x09\x09 nextPutAll: (self classNameFor: aClass class);\x0a\x09\x09 nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09aClass class instanceVariableNames \x0a\x09\x09 do: [:each | aStream nextPutAll: each]\x0a\x09\x09 separatedBy: [aStream nextPutAll: ' '].\x0a\x09\x09aStream\x09\x0a\x09\x09 nextPutAll: '''!'; lf; lf]",
  614. messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"],
  615. referencedClasses: []
  616. }),
  617. smalltalk.ChunkExporter);
  618. smalltalk.addMethod(
  619. "_exportMethod_of_on_",
  620. smalltalk.method({
  621. selector: "exportMethod:of:on:",
  622. category: 'not yet classified',
  623. fn: function (aMethod, aClass, aStream){
  624. var self=this;
  625. (function($rec){smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_chunkEscape_", [smalltalk.send(aMethod, "_source", [])])]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["!"]);})(aStream);
  626. return self;},
  627. args: ["aMethod", "aClass", "aStream"],
  628. source: "exportMethod: aMethod of: aClass on: aStream\x0a\x09aStream \x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  629. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"],
  630. referencedClasses: []
  631. }),
  632. smalltalk.ChunkExporter);
  633. smalltalk.addMethod(
  634. "_exportMethods_category_of_on_",
  635. smalltalk.method({
  636. selector: "exportMethods:category:of:on:",
  637. category: 'not yet classified',
  638. fn: function (methods, category, aClass, aStream){
  639. var self=this;
  640. (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send("!", "__comma", [smalltalk.send(self, "_classNameFor_", [aClass])])]);return smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(" methodsFor: '", "__comma", [category]), "__comma", ["'!"])]);})(aStream);
  641. smalltalk.send(smalltalk.send(methods, "_sorted_", [(function(a, b){return ((($receiver = smalltalk.send(a, "_selector", [])).klass === smalltalk.Number) ? $receiver <=smalltalk.send(b, "_selector", []) : smalltalk.send($receiver, "__lt_eq", [smalltalk.send(b, "_selector", [])]));})]), "_do_", [(function(each){return smalltalk.send(self, "_exportMethod_of_on_", [each, aClass, aStream]);})]);
  642. (function($rec){smalltalk.send($rec, "_nextPutAll_", [" !"]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_lf", []);})(aStream);
  643. return self;},
  644. args: ["methods", "category", "aClass", "aStream"],
  645. source: "exportMethods: methods category: category of: aClass on: aStream\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', category, '''!'.\x0a\x09\x09(methods sorted: [:a :b | a selector <= b selector]) do: [:each |\x0a\x09\x09\x09\x09self exportMethod: each of: aClass on: aStream].\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  646. messageSends: ["nextPutAll:", ",", "classNameFor:", "do:", "sorted:", "<=", "selector", "exportMethod:of:on:", "lf"],
  647. referencedClasses: []
  648. }),
  649. smalltalk.ChunkExporter);
  650. smalltalk.addMethod(
  651. "_exportMethodsOf_on_",
  652. smalltalk.method({
  653. selector: "exportMethodsOf:on:",
  654. category: 'not yet classified',
  655. fn: function (aClass, aStream){
  656. var self=this;
  657. var map=nil;
  658. (map=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  659. smalltalk.send(aClass, "_protocolsDo_", [(function(category, methods){return ((($receiver = smalltalk.send(category, "_match_", ["^\x5c*"])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(map, "_at_put_", [category, methods]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(map, "_at_put_", [category, methods]);})]));})]);
  660. smalltalk.send(smalltalk.send(smalltalk.send(map, "_keys", []), "_sorted_", [(function(a, b){return ((($receiver = a).klass === smalltalk.Number) ? $receiver <=b : smalltalk.send($receiver, "__lt_eq", [b]));})]), "_do_", [(function(category){var methods=nil;
  661. (methods=smalltalk.send(map, "_at_", [category]));return smalltalk.send(self, "_exportMethods_category_of_on_", [methods, category, aClass, aStream]);})]);
  662. return self;},
  663. args: ["aClass", "aStream"],
  664. source: "exportMethodsOf: aClass on: aStream\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| map |\x0a\x09map := Dictionary new.\x0a\x09aClass protocolsDo: [:category :methods | \x0a\x09\x09(category match: '^\x5c*') ifFalse: [ map at: category put: methods ]].\x0a\x09(map keys sorted: [:a :b | a <= b ]) do: [:category | | methods |\x0a\x09\x09methods := map at: category.\x0a\x09\x09self\x0a\x09\x09\x09exportMethods: methods\x0a\x09\x09\x09category: category\x0a\x09\x09\x09of: aClass\x0a\x09\x09\x09on: aStream ]",
  665. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "do:", "sorted:", "keys", "<=", "at:", "exportMethods:category:of:on:"],
  666. referencedClasses: ["Dictionary"]
  667. }),
  668. smalltalk.ChunkExporter);
  669. smalltalk.addMethod(
  670. "_exportPackageDefinitionOf_on_",
  671. smalltalk.method({
  672. selector: "exportPackageDefinitionOf:on:",
  673. category: 'not yet classified',
  674. fn: function (package, aStream){
  675. var self=this;
  676. (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("Smalltalk current createPackage: '", "__comma", [smalltalk.send(package, "_name", [])]), "__comma", ["' properties: "]), "__comma", [smalltalk.send(smalltalk.send(package, "_properties", []), "_storeString", [])]), "__comma", ["!"])]);return smalltalk.send($rec, "_lf", []);})(aStream);
  677. return self;},
  678. args: ["package", "aStream"],
  679. source: "exportPackageDefinitionOf: package on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream \x0a\x09 nextPutAll: 'Smalltalk current createPackage: ''', package name,\x0a\x09\x09''' properties: ', package properties storeString, '!'; lf.",
  680. messageSends: ["nextPutAll:", ",", "name", "storeString", "properties", "lf"],
  681. referencedClasses: []
  682. }),
  683. smalltalk.ChunkExporter);
  684. smalltalk.addMethod(
  685. "_exportPackageExtensionsOf_on_",
  686. smalltalk.method({
  687. selector: "exportPackageExtensionsOf:on:",
  688. category: 'not yet classified',
  689. fn: function (package, aStream){
  690. var self=this;
  691. var name=nil;
  692. var map=nil;
  693. (name=smalltalk.send(package, "_name", []));
  694. smalltalk.send(smalltalk.send((smalltalk.Package || Package), "_sortedClasses_", [smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_classes", [])]), "_do_", [(function(each){return smalltalk.send([each,smalltalk.send(each, "_class", [])], "_do_", [(function(aClass){(map=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));smalltalk.send(aClass, "_protocolsDo_", [(function(category, methods){return ((($receiver = smalltalk.send(category, "_match_", [smalltalk.send("^\x5c*", "__comma", [name])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(map, "_at_put_", [category, methods]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(map, "_at_put_", [category, methods]);})]));})]);return smalltalk.send(smalltalk.send(smalltalk.send(map, "_keys", []), "_sorted_", [(function(a, b){return ((($receiver = a).klass === smalltalk.Number) ? $receiver <=b : smalltalk.send($receiver, "__lt_eq", [b]));})]), "_do_", [(function(category){var methods=nil;
  695. (methods=smalltalk.send(map, "_at_", [category]));return smalltalk.send(self, "_exportMethods_category_of_on_", [methods, category, aClass, aStream]);})]);})]);})]);
  696. return self;},
  697. args: ["package", "aStream"],
  698. source: "exportPackageExtensionsOf: package on: aStream\x0a\x09\x22We need to override this one too since we need to group\x0a\x09all methods in a given protocol under a leading methodsFor: chunk\x0a\x09for that class.\x22\x0a\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map |\x0a\x09name := package name.\x0a\x09(Package sortedClasses: Smalltalk current classes) do: [:each |\x0a\x09\x09{each. each class} do: [:aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [:category :methods | \x0a\x09\x09\x09\x09(category match: '^\x5c*', name) ifTrue: [ map at: category put: methods ]].\x0a\x09\x09\x09(map keys sorted: [:a :b | a <= b ]) do: [:category | | methods |\x0a\x09\x09\x09\x09methods := map at: category.\x09\x0a\x09\x09\x09\x09self exportMethods: methods category: category of: aClass on: aStream ]]]",
  699. messageSends: ["name", "do:", "sortedClasses:", "classes", "current", "class", "new", "protocolsDo:", "ifTrue:", "match:", ",", "at:put:", "sorted:", "keys", "<=", "at:", "exportMethods:category:of:on:"],
  700. referencedClasses: ["Package", "Smalltalk", "Dictionary"]
  701. }),
  702. smalltalk.ChunkExporter);
  703. smalltalk.addClass('StrippedExporter', smalltalk.Exporter, [], 'Compiler');
  704. smalltalk.addMethod(
  705. "_exportDefinitionOf_on_",
  706. smalltalk.method({
  707. selector: "exportDefinitionOf:on:",
  708. category: 'private',
  709. fn: function (aClass, aStream){
  710. var self=this;
  711. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["smalltalk.addClass("]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("'", "__comma", [smalltalk.send(self, "_classNameFor_", [aClass])]), "__comma", ["', "])]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send("smalltalk.", "__comma", [smalltalk.send(self, "_classNameFor_", [smalltalk.send(aClass, "_superclass", [])])])]);return smalltalk.send($rec, "_nextPutAll_", [", ["]);})(aStream);
  712. smalltalk.send(smalltalk.send(aClass, "_instanceVariableNames", []), "_do_separatedBy_", [(function(each){return smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(smalltalk.send("'", "__comma", [each]), "__comma", ["'"])]);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [", "]);})]);
  713. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["], '"]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(aClass, "_category", []), "__comma", ["'"])]);return smalltalk.send($rec, "_nextPutAll_", [");"]);})(aStream);
  714. smalltalk.send(aStream, "_lf", []);
  715. return self;},
  716. args: ["aClass", "aStream"],
  717. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream \x0a\x09 nextPutAll: 'smalltalk.addClass(';\x0a\x09 nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09 nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);\x0a\x09 nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames \x0a\x09 do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09 separatedBy: [aStream nextPutAll: ', '].\x0a\x09aStream\x09\x0a\x09 nextPutAll: '], ''';\x0a\x09 nextPutAll: aClass category, '''';\x0a\x09 nextPutAll: ');'.\x0a\x09aStream lf",
  718. messageSends: ["nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "lf"],
  719. referencedClasses: []
  720. }),
  721. smalltalk.StrippedExporter);
  722. smalltalk.addMethod(
  723. "_exportMethod_of_on_",
  724. smalltalk.method({
  725. selector: "exportMethod:of:on:",
  726. category: 'private',
  727. fn: function (aMethod, aClass, aStream){
  728. var self=this;
  729. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["smalltalk.addMethod("]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod, "_selector", []), "_asSelector", []), "_asJavascript", []), "__comma", [","])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", ["smalltalk.method({"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("selector: ", "__comma", [smalltalk.send(smalltalk.send(aMethod, "_selector", []), "_asJavascript", [])]), "__comma", [","])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send("fn: ", "__comma", [smalltalk.send(smalltalk.send(aMethod, "_fn", []), "_compiledSource", [])])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", ["}),"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send("smalltalk.", "__comma", [smalltalk.send(self, "_classNameFor_", [aClass])])]);smalltalk.send($rec, "_nextPutAll_", [");"]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_lf", []);})(aStream);
  730. return self;},
  731. args: ["aMethod", "aClass", "aStream"],
  732. source: "exportMethod: aMethod of: aClass on: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: 'smalltalk.addMethod(';lf;\x0a\x09\x09nextPutAll: aMethod selector asSelector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'smalltalk.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource;lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
  733. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "asSelector", "selector", "compiledSource", "fn", "classNameFor:"],
  734. referencedClasses: []
  735. }),
  736. smalltalk.StrippedExporter);
  737. smalltalk.addClass('Importer', smalltalk.Object, [], 'Compiler');
  738. smalltalk.addMethod(
  739. "_import_",
  740. smalltalk.method({
  741. selector: "import:",
  742. category: 'fileIn',
  743. fn: function (aStream){
  744. var self=this;
  745. var chunk=nil;
  746. var result=nil;
  747. var parser=nil;
  748. var lastEmpty=nil;
  749. (parser=smalltalk.send((smalltalk.ChunkParser || ChunkParser), "_on_", [aStream]));
  750. (lastEmpty=false);
  751. (function(){while(!(function(){(chunk=smalltalk.send(parser, "_nextChunk", []));return smalltalk.send(chunk, "_isNil", []);})()) {(function(){return ((($receiver = smalltalk.send(chunk, "_isEmpty", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (lastEmpty=true);})() : (function(){(result=smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_evaluateExpression_", [chunk]));return ((($receiver = lastEmpty).klass === smalltalk.Boolean) ? ($receiver ? (function(){(lastEmpty=false);return smalltalk.send(result, "_scanFrom_", [parser]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){(lastEmpty=false);return smalltalk.send(result, "_scanFrom_", [parser]);})]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return (lastEmpty=true);}), (function(){(result=smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_evaluateExpression_", [chunk]));return ((($receiver = lastEmpty).klass === smalltalk.Boolean) ? ($receiver ? (function(){(lastEmpty=false);return smalltalk.send(result, "_scanFrom_", [parser]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){(lastEmpty=false);return smalltalk.send(result, "_scanFrom_", [parser]);})]));})]));})()}})();
  752. return self;},
  753. args: ["aStream"],
  754. source: "import: aStream\x0a | chunk result parser lastEmpty |\x0a parser := ChunkParser on: aStream.\x0a lastEmpty := false.\x0a [chunk := parser nextChunk.\x0a chunk isNil] whileFalse: [\x0a chunk isEmpty\x0a \x09\x09ifTrue: [lastEmpty := true]\x0a \x09\x09ifFalse: [\x0a \x09\x09result := Compiler new evaluateExpression: chunk.\x0a \x09\x09lastEmpty \x0a \x09\x09\x09ifTrue: [\x0a \x09lastEmpty := false.\x0a \x09result scanFrom: parser]]]",
  755. messageSends: ["on:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:"],
  756. referencedClasses: ["ChunkParser", "Compiler"]
  757. }),
  758. smalltalk.Importer);
  759. smalltalk.addClass('Node', smalltalk.Object, ['nodes'], 'Compiler');
  760. smalltalk.addMethod(
  761. "_accept_",
  762. smalltalk.method({
  763. selector: "accept:",
  764. category: 'visiting',
  765. fn: function (aVisitor){
  766. var self=this;
  767. smalltalk.send(aVisitor, "_visitNode_", [self]);
  768. return self;},
  769. args: ["aVisitor"],
  770. source: "accept: aVisitor\x0a\x09aVisitor visitNode: self",
  771. messageSends: ["visitNode:"],
  772. referencedClasses: []
  773. }),
  774. smalltalk.Node);
  775. smalltalk.addMethod(
  776. "_addNode_",
  777. smalltalk.method({
  778. selector: "addNode:",
  779. category: 'accessing',
  780. fn: function (aNode){
  781. var self=this;
  782. smalltalk.send(smalltalk.send(self, "_nodes", []), "_add_", [aNode]);
  783. return self;},
  784. args: ["aNode"],
  785. source: "addNode: aNode\x0a\x09self nodes add: aNode",
  786. messageSends: ["add:", "nodes"],
  787. referencedClasses: []
  788. }),
  789. smalltalk.Node);
  790. smalltalk.addMethod(
  791. "_isBlockNode",
  792. smalltalk.method({
  793. selector: "isBlockNode",
  794. category: 'testing',
  795. fn: function (){
  796. var self=this;
  797. return false;
  798. return self;},
  799. args: [],
  800. source: "isBlockNode\x0a\x09^false",
  801. messageSends: [],
  802. referencedClasses: []
  803. }),
  804. smalltalk.Node);
  805. smalltalk.addMethod(
  806. "_isBlockSequenceNode",
  807. smalltalk.method({
  808. selector: "isBlockSequenceNode",
  809. category: 'testing',
  810. fn: function (){
  811. var self=this;
  812. return false;
  813. return self;},
  814. args: [],
  815. source: "isBlockSequenceNode\x0a\x09^false",
  816. messageSends: [],
  817. referencedClasses: []
  818. }),
  819. smalltalk.Node);
  820. smalltalk.addMethod(
  821. "_isValueNode",
  822. smalltalk.method({
  823. selector: "isValueNode",
  824. category: 'testing',
  825. fn: function (){
  826. var self=this;
  827. return false;
  828. return self;},
  829. args: [],
  830. source: "isValueNode\x0a\x09^false",
  831. messageSends: [],
  832. referencedClasses: []
  833. }),
  834. smalltalk.Node);
  835. smalltalk.addMethod(
  836. "_nodes",
  837. smalltalk.method({
  838. selector: "nodes",
  839. category: 'accessing',
  840. fn: function (){
  841. var self=this;
  842. return (($receiver = self['@nodes']) == nil || $receiver == undefined) ? (function(){return (self['@nodes']=smalltalk.send((smalltalk.Array || Array), "_new", []));})() : $receiver;
  843. return self;},
  844. args: [],
  845. source: "nodes\x0a\x09^nodes ifNil: [nodes := Array new]",
  846. messageSends: ["ifNil:", "new"],
  847. referencedClasses: ["Array"]
  848. }),
  849. smalltalk.Node);
  850. smalltalk.addMethod(
  851. "_nodes_",
  852. smalltalk.method({
  853. selector: "nodes:",
  854. category: 'building',
  855. fn: function (aCollection){
  856. var self=this;
  857. (self['@nodes']=aCollection);
  858. return self;},
  859. args: ["aCollection"],
  860. source: "nodes: aCollection\x0a\x09nodes := aCollection",
  861. messageSends: [],
  862. referencedClasses: []
  863. }),
  864. smalltalk.Node);
  865. smalltalk.addClass('AssignmentNode', smalltalk.Node, ['left', 'right'], 'Compiler');
  866. smalltalk.addMethod(
  867. "_accept_",
  868. smalltalk.method({
  869. selector: "accept:",
  870. category: 'visiting',
  871. fn: function (aVisitor){
  872. var self=this;
  873. smalltalk.send(aVisitor, "_visitAssignmentNode_", [self]);
  874. return self;},
  875. args: ["aVisitor"],
  876. source: "accept: aVisitor\x0a\x09aVisitor visitAssignmentNode: self",
  877. messageSends: ["visitAssignmentNode:"],
  878. referencedClasses: []
  879. }),
  880. smalltalk.AssignmentNode);
  881. smalltalk.addMethod(
  882. "_left",
  883. smalltalk.method({
  884. selector: "left",
  885. category: 'accessing',
  886. fn: function (){
  887. var self=this;
  888. return self['@left'];
  889. return self;},
  890. args: [],
  891. source: "left\x0a\x09^left",
  892. messageSends: [],
  893. referencedClasses: []
  894. }),
  895. smalltalk.AssignmentNode);
  896. smalltalk.addMethod(
  897. "_left_",
  898. smalltalk.method({
  899. selector: "left:",
  900. category: 'accessing',
  901. fn: function (aNode){
  902. var self=this;
  903. (self['@left']=aNode);
  904. smalltalk.send(self['@left'], "_assigned_", [true]);
  905. return self;},
  906. args: ["aNode"],
  907. source: "left: aNode\x0a\x09left := aNode.\x0a\x09left assigned: true",
  908. messageSends: ["assigned:"],
  909. referencedClasses: []
  910. }),
  911. smalltalk.AssignmentNode);
  912. smalltalk.addMethod(
  913. "_right",
  914. smalltalk.method({
  915. selector: "right",
  916. category: 'accessing',
  917. fn: function (){
  918. var self=this;
  919. return self['@right'];
  920. return self;},
  921. args: [],
  922. source: "right\x0a\x09^right",
  923. messageSends: [],
  924. referencedClasses: []
  925. }),
  926. smalltalk.AssignmentNode);
  927. smalltalk.addMethod(
  928. "_right_",
  929. smalltalk.method({
  930. selector: "right:",
  931. category: 'accessing',
  932. fn: function (aNode){
  933. var self=this;
  934. (self['@right']=aNode);
  935. return self;},
  936. args: ["aNode"],
  937. source: "right: aNode\x0a\x09right := aNode",
  938. messageSends: [],
  939. referencedClasses: []
  940. }),
  941. smalltalk.AssignmentNode);
  942. smalltalk.addClass('BlockNode', smalltalk.Node, ['parameters', 'inlined'], 'Compiler');
  943. smalltalk.addMethod(
  944. "_accept_",
  945. smalltalk.method({
  946. selector: "accept:",
  947. category: 'visiting',
  948. fn: function (aVisitor){
  949. var self=this;
  950. smalltalk.send(aVisitor, "_visitBlockNode_", [self]);
  951. return self;},
  952. args: ["aVisitor"],
  953. source: "accept: aVisitor\x0a\x09aVisitor visitBlockNode: self",
  954. messageSends: ["visitBlockNode:"],
  955. referencedClasses: []
  956. }),
  957. smalltalk.BlockNode);
  958. smalltalk.addMethod(
  959. "_inlined",
  960. smalltalk.method({
  961. selector: "inlined",
  962. category: 'accessing',
  963. fn: function (){
  964. var self=this;
  965. return (($receiver = self['@inlined']) == nil || $receiver == undefined) ? (function(){return false;})() : $receiver;
  966. return self;},
  967. args: [],
  968. source: "inlined\x0a\x09^inlined ifNil: [false]",
  969. messageSends: ["ifNil:"],
  970. referencedClasses: []
  971. }),
  972. smalltalk.BlockNode);
  973. smalltalk.addMethod(
  974. "_inlined_",
  975. smalltalk.method({
  976. selector: "inlined:",
  977. category: 'accessing',
  978. fn: function (aBoolean){
  979. var self=this;
  980. (self['@inlined']=aBoolean);
  981. return self;},
  982. args: ["aBoolean"],
  983. source: "inlined: aBoolean\x0a\x09inlined := aBoolean",
  984. messageSends: [],
  985. referencedClasses: []
  986. }),
  987. smalltalk.BlockNode);
  988. smalltalk.addMethod(
  989. "_isBlockNode",
  990. smalltalk.method({
  991. selector: "isBlockNode",
  992. category: 'testing',
  993. fn: function (){
  994. var self=this;
  995. return true;
  996. return self;},
  997. args: [],
  998. source: "isBlockNode\x0a\x09^true",
  999. messageSends: [],
  1000. referencedClasses: []
  1001. }),
  1002. smalltalk.BlockNode);
  1003. smalltalk.addMethod(
  1004. "_parameters",
  1005. smalltalk.method({
  1006. selector: "parameters",
  1007. category: 'accessing',
  1008. fn: function (){
  1009. var self=this;
  1010. return (($receiver = self['@parameters']) == nil || $receiver == undefined) ? (function(){return (self['@parameters']=smalltalk.send((smalltalk.Array || Array), "_new", []));})() : $receiver;
  1011. return self;},
  1012. args: [],
  1013. source: "parameters\x0a\x09^parameters ifNil: [parameters := Array new]",
  1014. messageSends: ["ifNil:", "new"],
  1015. referencedClasses: ["Array"]
  1016. }),
  1017. smalltalk.BlockNode);
  1018. smalltalk.addMethod(
  1019. "_parameters_",
  1020. smalltalk.method({
  1021. selector: "parameters:",
  1022. category: 'accessing',
  1023. fn: function (aCollection){
  1024. var self=this;
  1025. (self['@parameters']=aCollection);
  1026. return self;},
  1027. args: ["aCollection"],
  1028. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  1029. messageSends: [],
  1030. referencedClasses: []
  1031. }),
  1032. smalltalk.BlockNode);
  1033. smalltalk.addClass('CascadeNode', smalltalk.Node, ['receiver'], 'Compiler');
  1034. smalltalk.addMethod(
  1035. "_accept_",
  1036. smalltalk.method({
  1037. selector: "accept:",
  1038. category: 'visiting',
  1039. fn: function (aVisitor){
  1040. var self=this;
  1041. smalltalk.send(aVisitor, "_visitCascadeNode_", [self]);
  1042. return self;},
  1043. args: ["aVisitor"],
  1044. source: "accept: aVisitor\x0a\x09aVisitor visitCascadeNode: self",
  1045. messageSends: ["visitCascadeNode:"],
  1046. referencedClasses: []
  1047. }),
  1048. smalltalk.CascadeNode);
  1049. smalltalk.addMethod(
  1050. "_receiver",
  1051. smalltalk.method({
  1052. selector: "receiver",
  1053. category: 'accessing',
  1054. fn: function (){
  1055. var self=this;
  1056. return self['@receiver'];
  1057. return self;},
  1058. args: [],
  1059. source: "receiver\x0a\x09^receiver",
  1060. messageSends: [],
  1061. referencedClasses: []
  1062. }),
  1063. smalltalk.CascadeNode);
  1064. smalltalk.addMethod(
  1065. "_receiver_",
  1066. smalltalk.method({
  1067. selector: "receiver:",
  1068. category: 'accessing',
  1069. fn: function (aNode){
  1070. var self=this;
  1071. (self['@receiver']=aNode);
  1072. return self;},
  1073. args: ["aNode"],
  1074. source: "receiver: aNode\x0a\x09receiver := aNode",
  1075. messageSends: [],
  1076. referencedClasses: []
  1077. }),
  1078. smalltalk.CascadeNode);
  1079. smalltalk.addClass('DynamicArrayNode', smalltalk.Node, [], 'Compiler');
  1080. smalltalk.addMethod(
  1081. "_accept_",
  1082. smalltalk.method({
  1083. selector: "accept:",
  1084. category: 'visiting',
  1085. fn: function (aVisitor){
  1086. var self=this;
  1087. smalltalk.send(aVisitor, "_visitDynamicArrayNode_", [self]);
  1088. return self;},
  1089. args: ["aVisitor"],
  1090. source: "accept: aVisitor\x0a\x09aVisitor visitDynamicArrayNode: self",
  1091. messageSends: ["visitDynamicArrayNode:"],
  1092. referencedClasses: []
  1093. }),
  1094. smalltalk.DynamicArrayNode);
  1095. smalltalk.addClass('DynamicDictionaryNode', smalltalk.Node, [], 'Compiler');
  1096. smalltalk.addMethod(
  1097. "_accept_",
  1098. smalltalk.method({
  1099. selector: "accept:",
  1100. category: 'visiting',
  1101. fn: function (aVisitor){
  1102. var self=this;
  1103. smalltalk.send(aVisitor, "_visitDynamicDictionaryNode_", [self]);
  1104. return self;},
  1105. args: ["aVisitor"],
  1106. source: "accept: aVisitor\x0a\x09aVisitor visitDynamicDictionaryNode: self",
  1107. messageSends: ["visitDynamicDictionaryNode:"],
  1108. referencedClasses: []
  1109. }),
  1110. smalltalk.DynamicDictionaryNode);
  1111. smalltalk.addClass('JSStatementNode', smalltalk.Node, ['source'], 'Compiler');
  1112. smalltalk.addMethod(
  1113. "_accept_",
  1114. smalltalk.method({
  1115. selector: "accept:",
  1116. category: 'visiting',
  1117. fn: function (aVisitor){
  1118. var self=this;
  1119. smalltalk.send(aVisitor, "_visitJSStatementNode_", [self]);
  1120. return self;},
  1121. args: ["aVisitor"],
  1122. source: "accept: aVisitor\x0a\x09aVisitor visitJSStatementNode: self",
  1123. messageSends: ["visitJSStatementNode:"],
  1124. referencedClasses: []
  1125. }),
  1126. smalltalk.JSStatementNode);
  1127. smalltalk.addMethod(
  1128. "_source",
  1129. smalltalk.method({
  1130. selector: "source",
  1131. category: 'accessing',
  1132. fn: function (){
  1133. var self=this;
  1134. return (($receiver = self['@source']) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver;
  1135. return self;},
  1136. args: [],
  1137. source: "source\x0a\x09^source ifNil: ['']",
  1138. messageSends: ["ifNil:"],
  1139. referencedClasses: []
  1140. }),
  1141. smalltalk.JSStatementNode);
  1142. smalltalk.addMethod(
  1143. "_source_",
  1144. smalltalk.method({
  1145. selector: "source:",
  1146. category: 'accessing',
  1147. fn: function (aString){
  1148. var self=this;
  1149. (self['@source']=aString);
  1150. return self;},
  1151. args: ["aString"],
  1152. source: "source: aString\x0a\x09source := aString",
  1153. messageSends: [],
  1154. referencedClasses: []
  1155. }),
  1156. smalltalk.JSStatementNode);
  1157. smalltalk.addClass('MethodNode', smalltalk.Node, ['selector', 'arguments', 'source'], 'Compiler');
  1158. smalltalk.addMethod(
  1159. "_accept_",
  1160. smalltalk.method({
  1161. selector: "accept:",
  1162. category: 'visiting',
  1163. fn: function (aVisitor){
  1164. var self=this;
  1165. smalltalk.send(aVisitor, "_visitMethodNode_", [self]);
  1166. return self;},
  1167. args: ["aVisitor"],
  1168. source: "accept: aVisitor\x0a\x09aVisitor visitMethodNode: self",
  1169. messageSends: ["visitMethodNode:"],
  1170. referencedClasses: []
  1171. }),
  1172. smalltalk.MethodNode);
  1173. smalltalk.addMethod(
  1174. "_arguments",
  1175. smalltalk.method({
  1176. selector: "arguments",
  1177. category: 'accessing',
  1178. fn: function (){
  1179. var self=this;
  1180. return (($receiver = self['@arguments']) == nil || $receiver == undefined) ? (function(){return [];})() : $receiver;
  1181. return self;},
  1182. args: [],
  1183. source: "arguments\x0a\x09^arguments ifNil: [#()]",
  1184. messageSends: ["ifNil:"],
  1185. referencedClasses: []
  1186. }),
  1187. smalltalk.MethodNode);
  1188. smalltalk.addMethod(
  1189. "_arguments_",
  1190. smalltalk.method({
  1191. selector: "arguments:",
  1192. category: 'accessing',
  1193. fn: function (aCollection){
  1194. var self=this;
  1195. (self['@arguments']=aCollection);
  1196. return self;},
  1197. args: ["aCollection"],
  1198. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  1199. messageSends: [],
  1200. referencedClasses: []
  1201. }),
  1202. smalltalk.MethodNode);
  1203. smalltalk.addMethod(
  1204. "_selector",
  1205. smalltalk.method({
  1206. selector: "selector",
  1207. category: 'accessing',
  1208. fn: function (){
  1209. var self=this;
  1210. return self['@selector'];
  1211. return self;},
  1212. args: [],
  1213. source: "selector\x0a\x09^selector",
  1214. messageSends: [],
  1215. referencedClasses: []
  1216. }),
  1217. smalltalk.MethodNode);
  1218. smalltalk.addMethod(
  1219. "_selector_",
  1220. smalltalk.method({
  1221. selector: "selector:",
  1222. category: 'accessing',
  1223. fn: function (aString){
  1224. var self=this;
  1225. (self['@selector']=aString);
  1226. return self;},
  1227. args: ["aString"],
  1228. source: "selector: aString\x0a\x09selector := aString",
  1229. messageSends: [],
  1230. referencedClasses: []
  1231. }),
  1232. smalltalk.MethodNode);
  1233. smalltalk.addMethod(
  1234. "_source",
  1235. smalltalk.method({
  1236. selector: "source",
  1237. category: 'accessing',
  1238. fn: function (){
  1239. var self=this;
  1240. return self['@source'];
  1241. return self;},
  1242. args: [],
  1243. source: "source\x0a\x09^source",
  1244. messageSends: [],
  1245. referencedClasses: []
  1246. }),
  1247. smalltalk.MethodNode);
  1248. smalltalk.addMethod(
  1249. "_source_",
  1250. smalltalk.method({
  1251. selector: "source:",
  1252. category: 'accessing',
  1253. fn: function (aString){
  1254. var self=this;
  1255. (self['@source']=aString);
  1256. return self;},
  1257. args: ["aString"],
  1258. source: "source: aString\x0a\x09source := aString",
  1259. messageSends: [],
  1260. referencedClasses: []
  1261. }),
  1262. smalltalk.MethodNode);
  1263. smalltalk.addClass('ReturnNode', smalltalk.Node, [], 'Compiler');
  1264. smalltalk.addMethod(
  1265. "_accept_",
  1266. smalltalk.method({
  1267. selector: "accept:",
  1268. category: 'visiting',
  1269. fn: function (aVisitor){
  1270. var self=this;
  1271. smalltalk.send(aVisitor, "_visitReturnNode_", [self]);
  1272. return self;},
  1273. args: ["aVisitor"],
  1274. source: "accept: aVisitor\x0a\x09aVisitor visitReturnNode: self",
  1275. messageSends: ["visitReturnNode:"],
  1276. referencedClasses: []
  1277. }),
  1278. smalltalk.ReturnNode);
  1279. smalltalk.addClass('SendNode', smalltalk.Node, ['selector', 'arguments', 'receiver'], 'Compiler');
  1280. smalltalk.addMethod(
  1281. "_accept_",
  1282. smalltalk.method({
  1283. selector: "accept:",
  1284. category: 'visiting',
  1285. fn: function (aVisitor){
  1286. var self=this;
  1287. smalltalk.send(aVisitor, "_visitSendNode_", [self]);
  1288. return self;},
  1289. args: ["aVisitor"],
  1290. source: "accept: aVisitor\x0a\x09aVisitor visitSendNode: self",
  1291. messageSends: ["visitSendNode:"],
  1292. referencedClasses: []
  1293. }),
  1294. smalltalk.SendNode);
  1295. smalltalk.addMethod(
  1296. "_arguments",
  1297. smalltalk.method({
  1298. selector: "arguments",
  1299. category: 'accessing',
  1300. fn: function (){
  1301. var self=this;
  1302. return (($receiver = self['@arguments']) == nil || $receiver == undefined) ? (function(){return (self['@arguments']=[]);})() : $receiver;
  1303. return self;},
  1304. args: [],
  1305. source: "arguments\x0a\x09^arguments ifNil: [arguments := #()]",
  1306. messageSends: ["ifNil:"],
  1307. referencedClasses: []
  1308. }),
  1309. smalltalk.SendNode);
  1310. smalltalk.addMethod(
  1311. "_arguments_",
  1312. smalltalk.method({
  1313. selector: "arguments:",
  1314. category: 'accessing',
  1315. fn: function (aCollection){
  1316. var self=this;
  1317. (self['@arguments']=aCollection);
  1318. return self;},
  1319. args: ["aCollection"],
  1320. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  1321. messageSends: [],
  1322. referencedClasses: []
  1323. }),
  1324. smalltalk.SendNode);
  1325. smalltalk.addMethod(
  1326. "_cascadeNodeWithMessages_",
  1327. smalltalk.method({
  1328. selector: "cascadeNodeWithMessages:",
  1329. category: 'accessing',
  1330. fn: function (aCollection){
  1331. var self=this;
  1332. var first=nil;
  1333. (first=(function($rec){smalltalk.send($rec, "_selector_", [smalltalk.send(self, "_selector", [])]);smalltalk.send($rec, "_arguments_", [smalltalk.send(self, "_arguments", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.SendNode || SendNode), "_new", [])));
  1334. return (function($rec){smalltalk.send($rec, "_receiver_", [smalltalk.send(self, "_receiver", [])]);smalltalk.send($rec, "_nodes_", [smalltalk.send(smalltalk.send((smalltalk.Array || Array), "_with_", [first]), "__comma", [aCollection])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.CascadeNode || CascadeNode), "_new", []));
  1335. return self;},
  1336. args: ["aCollection"],
  1337. source: "cascadeNodeWithMessages: aCollection\x0a\x09| first |\x0a\x09first := SendNode new\x0a\x09 selector: self selector;\x0a\x09 arguments: self arguments;\x0a\x09 yourself.\x0a\x09^CascadeNode new\x0a\x09 receiver: self receiver;\x0a\x09 nodes: (Array with: first), aCollection;\x0a\x09 yourself",
  1338. messageSends: ["selector:", "selector", "arguments:", "arguments", "yourself", "new", "receiver:", "receiver", "nodes:", ",", "with:"],
  1339. referencedClasses: ["SendNode", "Array", "CascadeNode"]
  1340. }),
  1341. smalltalk.SendNode);
  1342. smalltalk.addMethod(
  1343. "_receiver",
  1344. smalltalk.method({
  1345. selector: "receiver",
  1346. category: 'accessing',
  1347. fn: function (){
  1348. var self=this;
  1349. return self['@receiver'];
  1350. return self;},
  1351. args: [],
  1352. source: "receiver\x0a\x09^receiver",
  1353. messageSends: [],
  1354. referencedClasses: []
  1355. }),
  1356. smalltalk.SendNode);
  1357. smalltalk.addMethod(
  1358. "_receiver_",
  1359. smalltalk.method({
  1360. selector: "receiver:",
  1361. category: 'accessing',
  1362. fn: function (aNode){
  1363. var self=this;
  1364. (self['@receiver']=aNode);
  1365. return self;},
  1366. args: ["aNode"],
  1367. source: "receiver: aNode\x0a\x09receiver := aNode",
  1368. messageSends: [],
  1369. referencedClasses: []
  1370. }),
  1371. smalltalk.SendNode);
  1372. smalltalk.addMethod(
  1373. "_selector",
  1374. smalltalk.method({
  1375. selector: "selector",
  1376. category: 'accessing',
  1377. fn: function (){
  1378. var self=this;
  1379. return self['@selector'];
  1380. return self;},
  1381. args: [],
  1382. source: "selector\x0a\x09^selector",
  1383. messageSends: [],
  1384. referencedClasses: []
  1385. }),
  1386. smalltalk.SendNode);
  1387. smalltalk.addMethod(
  1388. "_selector_",
  1389. smalltalk.method({
  1390. selector: "selector:",
  1391. category: 'accessing',
  1392. fn: function (aString){
  1393. var self=this;
  1394. (self['@selector']=aString);
  1395. return self;},
  1396. args: ["aString"],
  1397. source: "selector: aString\x0a\x09selector := aString",
  1398. messageSends: [],
  1399. referencedClasses: []
  1400. }),
  1401. smalltalk.SendNode);
  1402. smalltalk.addMethod(
  1403. "_valueForReceiver_",
  1404. smalltalk.method({
  1405. selector: "valueForReceiver:",
  1406. category: 'accessing',
  1407. fn: function (anObject){
  1408. var self=this;
  1409. return (function($rec){smalltalk.send($rec, "_receiver_", [(($receiver = smalltalk.send(self, "_receiver", [])) == nil || $receiver == undefined) ? (function(){return anObject;})() : (function(){return smalltalk.send(smalltalk.send(self, "_receiver", []), "_valueForReceiver_", [anObject]);})()]);smalltalk.send($rec, "_selector_", [smalltalk.send(self, "_selector", [])]);smalltalk.send($rec, "_arguments_", [smalltalk.send(self, "_arguments", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.SendNode || SendNode), "_new", []));
  1410. return self;},
  1411. args: ["anObject"],
  1412. source: "valueForReceiver: anObject\x0a\x09^SendNode new\x0a\x09 receiver: (self receiver \x0a\x09\x09ifNil: [anObject]\x0a\x09\x09ifNotNil: [self receiver valueForReceiver: anObject]);\x0a\x09 selector: self selector;\x0a\x09 arguments: self arguments;\x0a\x09 yourself",
  1413. messageSends: ["receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself", "new"],
  1414. referencedClasses: ["SendNode"]
  1415. }),
  1416. smalltalk.SendNode);
  1417. smalltalk.addClass('SequenceNode', smalltalk.Node, ['temps'], 'Compiler');
  1418. smalltalk.addMethod(
  1419. "_accept_",
  1420. smalltalk.method({
  1421. selector: "accept:",
  1422. category: 'visiting',
  1423. fn: function (aVisitor){
  1424. var self=this;
  1425. smalltalk.send(aVisitor, "_visitSequenceNode_", [self]);
  1426. return self;},
  1427. args: ["aVisitor"],
  1428. source: "accept: aVisitor\x0a\x09aVisitor visitSequenceNode: self",
  1429. messageSends: ["visitSequenceNode:"],
  1430. referencedClasses: []
  1431. }),
  1432. smalltalk.SequenceNode);
  1433. smalltalk.addMethod(
  1434. "_asBlockSequenceNode",
  1435. smalltalk.method({
  1436. selector: "asBlockSequenceNode",
  1437. category: 'testing',
  1438. fn: function (){
  1439. var self=this;
  1440. return (function($rec){smalltalk.send($rec, "_nodes_", [smalltalk.send(self, "_nodes", [])]);smalltalk.send($rec, "_temps_", [smalltalk.send(self, "_temps", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.BlockSequenceNode || BlockSequenceNode), "_new", []));
  1441. return self;},
  1442. args: [],
  1443. source: "asBlockSequenceNode\x0a\x09^BlockSequenceNode new\x0a\x09 nodes: self nodes;\x0a\x09 temps: self temps;\x0a\x09 yourself",
  1444. messageSends: ["nodes:", "nodes", "temps:", "temps", "yourself", "new"],
  1445. referencedClasses: ["BlockSequenceNode"]
  1446. }),
  1447. smalltalk.SequenceNode);
  1448. smalltalk.addMethod(
  1449. "_temps",
  1450. smalltalk.method({
  1451. selector: "temps",
  1452. category: 'accessing',
  1453. fn: function (){
  1454. var self=this;
  1455. return (($receiver = self['@temps']) == nil || $receiver == undefined) ? (function(){return [];})() : $receiver;
  1456. return self;},
  1457. args: [],
  1458. source: "temps\x0a\x09^temps ifNil: [#()]",
  1459. messageSends: ["ifNil:"],
  1460. referencedClasses: []
  1461. }),
  1462. smalltalk.SequenceNode);
  1463. smalltalk.addMethod(
  1464. "_temps_",
  1465. smalltalk.method({
  1466. selector: "temps:",
  1467. category: 'accessing',
  1468. fn: function (aCollection){
  1469. var self=this;
  1470. (self['@temps']=aCollection);
  1471. return self;},
  1472. args: ["aCollection"],
  1473. source: "temps: aCollection\x0a\x09temps := aCollection",
  1474. messageSends: [],
  1475. referencedClasses: []
  1476. }),
  1477. smalltalk.SequenceNode);
  1478. smalltalk.addClass('BlockSequenceNode', smalltalk.SequenceNode, [], 'Compiler');
  1479. smalltalk.addMethod(
  1480. "_accept_",
  1481. smalltalk.method({
  1482. selector: "accept:",
  1483. category: 'visiting',
  1484. fn: function (aVisitor){
  1485. var self=this;
  1486. smalltalk.send(aVisitor, "_visitBlockSequenceNode_", [self]);
  1487. return self;},
  1488. args: ["aVisitor"],
  1489. source: "accept: aVisitor\x0a\x09aVisitor visitBlockSequenceNode: self",
  1490. messageSends: ["visitBlockSequenceNode:"],
  1491. referencedClasses: []
  1492. }),
  1493. smalltalk.BlockSequenceNode);
  1494. smalltalk.addMethod(
  1495. "_isBlockSequenceNode",
  1496. smalltalk.method({
  1497. selector: "isBlockSequenceNode",
  1498. category: 'testing',
  1499. fn: function (){
  1500. var self=this;
  1501. return true;
  1502. return self;},
  1503. args: [],
  1504. source: "isBlockSequenceNode\x0a\x09^true",
  1505. messageSends: [],
  1506. referencedClasses: []
  1507. }),
  1508. smalltalk.BlockSequenceNode);
  1509. smalltalk.addClass('ValueNode', smalltalk.Node, ['value'], 'Compiler');
  1510. smalltalk.addMethod(
  1511. "_accept_",
  1512. smalltalk.method({
  1513. selector: "accept:",
  1514. category: 'visiting',
  1515. fn: function (aVisitor){
  1516. var self=this;
  1517. smalltalk.send(aVisitor, "_visitValueNode_", [self]);
  1518. return self;},
  1519. args: ["aVisitor"],
  1520. source: "accept: aVisitor\x0a\x09aVisitor visitValueNode: self",
  1521. messageSends: ["visitValueNode:"],
  1522. referencedClasses: []
  1523. }),
  1524. smalltalk.ValueNode);
  1525. smalltalk.addMethod(
  1526. "_isValueNode",
  1527. smalltalk.method({
  1528. selector: "isValueNode",
  1529. category: 'testing',
  1530. fn: function (){
  1531. var self=this;
  1532. return true;
  1533. return self;},
  1534. args: [],
  1535. source: "isValueNode\x0a\x09^true",
  1536. messageSends: [],
  1537. referencedClasses: []
  1538. }),
  1539. smalltalk.ValueNode);
  1540. smalltalk.addMethod(
  1541. "_value",
  1542. smalltalk.method({
  1543. selector: "value",
  1544. category: 'accessing',
  1545. fn: function (){
  1546. var self=this;
  1547. return self['@value'];
  1548. return self;},
  1549. args: [],
  1550. source: "value\x0a\x09^value",
  1551. messageSends: [],
  1552. referencedClasses: []
  1553. }),
  1554. smalltalk.ValueNode);
  1555. smalltalk.addMethod(
  1556. "_value_",
  1557. smalltalk.method({
  1558. selector: "value:",
  1559. category: 'accessing',
  1560. fn: function (anObject){
  1561. var self=this;
  1562. (self['@value']=anObject);
  1563. return self;},
  1564. args: ["anObject"],
  1565. source: "value: anObject\x0a\x09value := anObject",
  1566. messageSends: [],
  1567. referencedClasses: []
  1568. }),
  1569. smalltalk.ValueNode);
  1570. smalltalk.addClass('VariableNode', smalltalk.ValueNode, ['assigned'], 'Compiler');
  1571. smalltalk.addMethod(
  1572. "_accept_",
  1573. smalltalk.method({
  1574. selector: "accept:",
  1575. category: 'visiting',
  1576. fn: function (aVisitor){
  1577. var self=this;
  1578. smalltalk.send(aVisitor, "_visitVariableNode_", [self]);
  1579. return self;},
  1580. args: ["aVisitor"],
  1581. source: "accept: aVisitor\x0a\x09aVisitor visitVariableNode: self",
  1582. messageSends: ["visitVariableNode:"],
  1583. referencedClasses: []
  1584. }),
  1585. smalltalk.VariableNode);
  1586. smalltalk.addMethod(
  1587. "_assigned",
  1588. smalltalk.method({
  1589. selector: "assigned",
  1590. category: 'accessing',
  1591. fn: function (){
  1592. var self=this;
  1593. return (($receiver = self['@assigned']) == nil || $receiver == undefined) ? (function(){return false;})() : $receiver;
  1594. return self;},
  1595. args: [],
  1596. source: "assigned\x0a\x09^assigned ifNil: [false]",
  1597. messageSends: ["ifNil:"],
  1598. referencedClasses: []
  1599. }),
  1600. smalltalk.VariableNode);
  1601. smalltalk.addMethod(
  1602. "_assigned_",
  1603. smalltalk.method({
  1604. selector: "assigned:",
  1605. category: 'accessing',
  1606. fn: function (aBoolean){
  1607. var self=this;
  1608. (self['@assigned']=aBoolean);
  1609. return self;},
  1610. args: ["aBoolean"],
  1611. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  1612. messageSends: [],
  1613. referencedClasses: []
  1614. }),
  1615. smalltalk.VariableNode);
  1616. smalltalk.addClass('ClassReferenceNode', smalltalk.VariableNode, [], 'Compiler');
  1617. smalltalk.addMethod(
  1618. "_accept_",
  1619. smalltalk.method({
  1620. selector: "accept:",
  1621. category: 'visiting',
  1622. fn: function (aVisitor){
  1623. var self=this;
  1624. smalltalk.send(aVisitor, "_visitClassReferenceNode_", [self]);
  1625. return self;},
  1626. args: ["aVisitor"],
  1627. source: "accept: aVisitor\x0a\x09aVisitor visitClassReferenceNode: self",
  1628. messageSends: ["visitClassReferenceNode:"],
  1629. referencedClasses: []
  1630. }),
  1631. smalltalk.ClassReferenceNode);
  1632. smalltalk.addClass('NodeVisitor', smalltalk.Object, [], 'Compiler');
  1633. smalltalk.addMethod(
  1634. "_visit_",
  1635. smalltalk.method({
  1636. selector: "visit:",
  1637. category: 'visiting',
  1638. fn: function (aNode){
  1639. var self=this;
  1640. smalltalk.send(aNode, "_accept_", [self]);
  1641. return self;},
  1642. args: ["aNode"],
  1643. source: "visit: aNode\x0a\x09aNode accept: self",
  1644. messageSends: ["accept:"],
  1645. referencedClasses: []
  1646. }),
  1647. smalltalk.NodeVisitor);
  1648. smalltalk.addMethod(
  1649. "_visitAssignmentNode_",
  1650. smalltalk.method({
  1651. selector: "visitAssignmentNode:",
  1652. category: 'visiting',
  1653. fn: function (aNode){
  1654. var self=this;
  1655. smalltalk.send(self, "_visitNode_", [aNode]);
  1656. return self;},
  1657. args: ["aNode"],
  1658. source: "visitAssignmentNode: aNode\x0a\x09self visitNode: aNode",
  1659. messageSends: ["visitNode:"],
  1660. referencedClasses: []
  1661. }),
  1662. smalltalk.NodeVisitor);
  1663. smalltalk.addMethod(
  1664. "_visitBlockNode_",
  1665. smalltalk.method({
  1666. selector: "visitBlockNode:",
  1667. category: 'visiting',
  1668. fn: function (aNode){
  1669. var self=this;
  1670. smalltalk.send(self, "_visitNode_", [aNode]);
  1671. return self;},
  1672. args: ["aNode"],
  1673. source: "visitBlockNode: aNode\x0a\x09self visitNode: aNode",
  1674. messageSends: ["visitNode:"],
  1675. referencedClasses: []
  1676. }),
  1677. smalltalk.NodeVisitor);
  1678. smalltalk.addMethod(
  1679. "_visitBlockSequenceNode_",
  1680. smalltalk.method({
  1681. selector: "visitBlockSequenceNode:",
  1682. category: 'visiting',
  1683. fn: function (aNode){
  1684. var self=this;
  1685. smalltalk.send(self, "_visitNode_", [aNode]);
  1686. return self;},
  1687. args: ["aNode"],
  1688. source: "visitBlockSequenceNode: aNode\x0a\x09self visitNode: aNode",
  1689. messageSends: ["visitNode:"],
  1690. referencedClasses: []
  1691. }),
  1692. smalltalk.NodeVisitor);
  1693. smalltalk.addMethod(
  1694. "_visitCascadeNode_",
  1695. smalltalk.method({
  1696. selector: "visitCascadeNode:",
  1697. category: 'visiting',
  1698. fn: function (aNode){
  1699. var self=this;
  1700. smalltalk.send(self, "_visitNode_", [aNode]);
  1701. return self;},
  1702. args: ["aNode"],
  1703. source: "visitCascadeNode: aNode\x0a\x09self visitNode: aNode",
  1704. messageSends: ["visitNode:"],
  1705. referencedClasses: []
  1706. }),
  1707. smalltalk.NodeVisitor);
  1708. smalltalk.addMethod(
  1709. "_visitClassReferenceNode_",
  1710. smalltalk.method({
  1711. selector: "visitClassReferenceNode:",
  1712. category: 'visiting',
  1713. fn: function (aNode){
  1714. var self=this;
  1715. smalltalk.send(self, "_visitNode_", [aNode]);
  1716. return self;},
  1717. args: ["aNode"],
  1718. source: "visitClassReferenceNode: aNode\x0a\x09self visitNode: aNode",
  1719. messageSends: ["visitNode:"],
  1720. referencedClasses: []
  1721. }),
  1722. smalltalk.NodeVisitor);
  1723. smalltalk.addMethod(
  1724. "_visitDynamicArrayNode_",
  1725. smalltalk.method({
  1726. selector: "visitDynamicArrayNode:",
  1727. category: 'visiting',
  1728. fn: function (aNode){
  1729. var self=this;
  1730. smalltalk.send(self, "_visitNode_", [aNode]);
  1731. return self;},
  1732. args: ["aNode"],
  1733. source: "visitDynamicArrayNode: aNode\x0a\x09self visitNode: aNode",
  1734. messageSends: ["visitNode:"],
  1735. referencedClasses: []
  1736. }),
  1737. smalltalk.NodeVisitor);
  1738. smalltalk.addMethod(
  1739. "_visitDynamicDictionaryNode_",
  1740. smalltalk.method({
  1741. selector: "visitDynamicDictionaryNode:",
  1742. category: 'visiting',
  1743. fn: function (aNode){
  1744. var self=this;
  1745. smalltalk.send(self, "_visitNode_", [aNode]);
  1746. return self;},
  1747. args: ["aNode"],
  1748. source: "visitDynamicDictionaryNode: aNode\x0a\x09self visitNode: aNode",
  1749. messageSends: ["visitNode:"],
  1750. referencedClasses: []
  1751. }),
  1752. smalltalk.NodeVisitor);
  1753. smalltalk.addMethod(
  1754. "_visitJSStatementNode_",
  1755. smalltalk.method({
  1756. selector: "visitJSStatementNode:",
  1757. category: 'visiting',
  1758. fn: function (aNode){
  1759. var self=this;
  1760. smalltalk.send(self, "_visitNode_", [aNode]);
  1761. return self;},
  1762. args: ["aNode"],
  1763. source: "visitJSStatementNode: aNode\x0a\x09self visitNode: aNode",
  1764. messageSends: ["visitNode:"],
  1765. referencedClasses: []
  1766. }),
  1767. smalltalk.NodeVisitor);
  1768. smalltalk.addMethod(
  1769. "_visitMethodNode_",
  1770. smalltalk.method({
  1771. selector: "visitMethodNode:",
  1772. category: 'visiting',
  1773. fn: function (aNode){
  1774. var self=this;
  1775. smalltalk.send(self, "_visitNode_", [aNode]);
  1776. return self;},
  1777. args: ["aNode"],
  1778. source: "visitMethodNode: aNode\x0a\x09self visitNode: aNode",
  1779. messageSends: ["visitNode:"],
  1780. referencedClasses: []
  1781. }),
  1782. smalltalk.NodeVisitor);
  1783. smalltalk.addMethod(
  1784. "_visitNode_",
  1785. smalltalk.method({
  1786. selector: "visitNode:",
  1787. category: 'visiting',
  1788. fn: function (aNode){
  1789. var self=this;
  1790. return self;},
  1791. args: ["aNode"],
  1792. source: "visitNode: aNode",
  1793. messageSends: [],
  1794. referencedClasses: []
  1795. }),
  1796. smalltalk.NodeVisitor);
  1797. smalltalk.addMethod(
  1798. "_visitReturnNode_",
  1799. smalltalk.method({
  1800. selector: "visitReturnNode:",
  1801. category: 'visiting',
  1802. fn: function (aNode){
  1803. var self=this;
  1804. smalltalk.send(self, "_visitNode_", [aNode]);
  1805. return self;},
  1806. args: ["aNode"],
  1807. source: "visitReturnNode: aNode\x0a\x09self visitNode: aNode",
  1808. messageSends: ["visitNode:"],
  1809. referencedClasses: []
  1810. }),
  1811. smalltalk.NodeVisitor);
  1812. smalltalk.addMethod(
  1813. "_visitSendNode_",
  1814. smalltalk.method({
  1815. selector: "visitSendNode:",
  1816. category: 'visiting',
  1817. fn: function (aNode){
  1818. var self=this;
  1819. smalltalk.send(self, "_visitNode_", [aNode]);
  1820. return self;},
  1821. args: ["aNode"],
  1822. source: "visitSendNode: aNode\x0a\x09self visitNode: aNode",
  1823. messageSends: ["visitNode:"],
  1824. referencedClasses: []
  1825. }),
  1826. smalltalk.NodeVisitor);
  1827. smalltalk.addMethod(
  1828. "_visitSequenceNode_",
  1829. smalltalk.method({
  1830. selector: "visitSequenceNode:",
  1831. category: 'visiting',
  1832. fn: function (aNode){
  1833. var self=this;
  1834. smalltalk.send(self, "_visitNode_", [aNode]);
  1835. return self;},
  1836. args: ["aNode"],
  1837. source: "visitSequenceNode: aNode\x0a\x09self visitNode: aNode",
  1838. messageSends: ["visitNode:"],
  1839. referencedClasses: []
  1840. }),
  1841. smalltalk.NodeVisitor);
  1842. smalltalk.addMethod(
  1843. "_visitValueNode_",
  1844. smalltalk.method({
  1845. selector: "visitValueNode:",
  1846. category: 'visiting',
  1847. fn: function (aNode){
  1848. var self=this;
  1849. smalltalk.send(self, "_visitNode_", [aNode]);
  1850. return self;},
  1851. args: ["aNode"],
  1852. source: "visitValueNode: aNode\x0a\x09self visitNode: aNode",
  1853. messageSends: ["visitNode:"],
  1854. referencedClasses: []
  1855. }),
  1856. smalltalk.NodeVisitor);
  1857. smalltalk.addMethod(
  1858. "_visitVariableNode_",
  1859. smalltalk.method({
  1860. selector: "visitVariableNode:",
  1861. category: 'visiting',
  1862. fn: function (aNode){
  1863. var self=this;
  1864. smalltalk.send(self, "_visitNode_", [aNode]);
  1865. return self;},
  1866. args: ["aNode"],
  1867. source: "visitVariableNode: aNode\x0a\x09self visitNode: aNode",
  1868. messageSends: ["visitNode:"],
  1869. referencedClasses: []
  1870. }),
  1871. smalltalk.NodeVisitor);
  1872. smalltalk.addClass('AbstractCodeGenerator', smalltalk.NodeVisitor, ['currentClass', 'source'], 'Compiler');
  1873. smalltalk.addMethod(
  1874. "_classNameFor_",
  1875. smalltalk.method({
  1876. selector: "classNameFor:",
  1877. category: 'accessing',
  1878. fn: function (aClass){
  1879. var self=this;
  1880. return ((($receiver = smalltalk.send(aClass, "_isMetaclass", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_instanceClass", []), "_name", []), "__comma", [".klass"]);})() : (function(){return ((($receiver = smalltalk.send(aClass, "_isNil", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "nil";})() : (function(){return smalltalk.send(aClass, "_name", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "nil";}), (function(){return smalltalk.send(aClass, "_name", []);})]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_instanceClass", []), "_name", []), "__comma", [".klass"]);}), (function(){return ((($receiver = smalltalk.send(aClass, "_isNil", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "nil";})() : (function(){return smalltalk.send(aClass, "_name", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "nil";}), (function(){return smalltalk.send(aClass, "_name", []);})]));})]));
  1881. return self;},
  1882. args: ["aClass"],
  1883. source: "classNameFor: aClass\x0a\x09^aClass isMetaclass\x0a\x09 ifTrue: [aClass instanceClass name, '.klass']\x0a\x09 ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09 ifTrue: ['nil']\x0a\x09\x09 ifFalse: [aClass name]]",
  1884. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"],
  1885. referencedClasses: []
  1886. }),
  1887. smalltalk.AbstractCodeGenerator);
  1888. smalltalk.addMethod(
  1889. "_compileNode_",
  1890. smalltalk.method({
  1891. selector: "compileNode:",
  1892. category: 'compiling',
  1893. fn: function (aNode){
  1894. var self=this;
  1895. smalltalk.send(self, "_subclassResponsibility", []);
  1896. return self;},
  1897. args: ["aNode"],
  1898. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  1899. messageSends: ["subclassResponsibility"],
  1900. referencedClasses: []
  1901. }),
  1902. smalltalk.AbstractCodeGenerator);
  1903. smalltalk.addMethod(
  1904. "_currentClass",
  1905. smalltalk.method({
  1906. selector: "currentClass",
  1907. category: 'accessing',
  1908. fn: function (){
  1909. var self=this;
  1910. return self['@currentClass'];
  1911. return self;},
  1912. args: [],
  1913. source: "currentClass\x0a\x09^currentClass",
  1914. messageSends: [],
  1915. referencedClasses: []
  1916. }),
  1917. smalltalk.AbstractCodeGenerator);
  1918. smalltalk.addMethod(
  1919. "_currentClass_",
  1920. smalltalk.method({
  1921. selector: "currentClass:",
  1922. category: 'accessing',
  1923. fn: function (aClass){
  1924. var self=this;
  1925. (self['@currentClass']=aClass);
  1926. return self;},
  1927. args: ["aClass"],
  1928. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  1929. messageSends: [],
  1930. referencedClasses: []
  1931. }),
  1932. smalltalk.AbstractCodeGenerator);
  1933. smalltalk.addMethod(
  1934. "_pseudoVariables",
  1935. smalltalk.method({
  1936. selector: "pseudoVariables",
  1937. category: 'accessing',
  1938. fn: function (){
  1939. var self=this;
  1940. return ["self", "super", "true", "false", "nil", "thisContext"];
  1941. return self;},
  1942. args: [],
  1943. source: "pseudoVariables\x0a\x09^#('self' 'super' 'true' 'false' 'nil' 'thisContext')",
  1944. messageSends: [],
  1945. referencedClasses: []
  1946. }),
  1947. smalltalk.AbstractCodeGenerator);
  1948. smalltalk.addMethod(
  1949. "_safeVariableNameFor_",
  1950. smalltalk.method({
  1951. selector: "safeVariableNameFor:",
  1952. category: 'accessing',
  1953. fn: function (aString){
  1954. var self=this;
  1955. return ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_reservedWords", []), "_includes_", [aString])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(aString, "__comma", ["_"]);})() : (function(){return aString;})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(aString, "__comma", ["_"]);}), (function(){return aString;})]));
  1956. return self;},
  1957. args: ["aString"],
  1958. source: "safeVariableNameFor: aString\x0a\x09^(Smalltalk current reservedWords includes: aString)\x0a\x09\x09ifTrue: [aString, '_']\x0a\x09\x09ifFalse: [aString]",
  1959. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", "current", ","],
  1960. referencedClasses: ["Smalltalk"]
  1961. }),
  1962. smalltalk.AbstractCodeGenerator);
  1963. smalltalk.addMethod(
  1964. "_source",
  1965. smalltalk.method({
  1966. selector: "source",
  1967. category: 'accessing',
  1968. fn: function (){
  1969. var self=this;
  1970. return (($receiver = self['@source']) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver;
  1971. return self;},
  1972. args: [],
  1973. source: "source\x0a\x09^source ifNil: ['']",
  1974. messageSends: ["ifNil:"],
  1975. referencedClasses: []
  1976. }),
  1977. smalltalk.AbstractCodeGenerator);
  1978. smalltalk.addMethod(
  1979. "_source_",
  1980. smalltalk.method({
  1981. selector: "source:",
  1982. category: 'accessing',
  1983. fn: function (aString){
  1984. var self=this;
  1985. (self['@source']=aString);
  1986. return self;},
  1987. args: ["aString"],
  1988. source: "source: aString\x0a\x09source := aString",
  1989. messageSends: [],
  1990. referencedClasses: []
  1991. }),
  1992. smalltalk.AbstractCodeGenerator);
  1993. smalltalk.addClass('FunCodeGenerator', smalltalk.AbstractCodeGenerator, ['stream', 'nestedBlocks', 'earlyReturn', 'currentSelector', 'unknownVariables', 'tempVariables', 'messageSends', 'referencedClasses', 'classReferenced', 'argVariables'], 'Compiler');
  1994. smalltalk.addMethod(
  1995. "_argVariables",
  1996. smalltalk.method({
  1997. selector: "argVariables",
  1998. category: 'accessing',
  1999. fn: function (){
  2000. var self=this;
  2001. return smalltalk.send(self['@argVariables'], "_copy", []);
  2002. return self;},
  2003. args: [],
  2004. source: "argVariables\x0a\x09^argVariables copy",
  2005. messageSends: ["copy"],
  2006. referencedClasses: []
  2007. }),
  2008. smalltalk.FunCodeGenerator);
  2009. smalltalk.addMethod(
  2010. "_checkClass_for_",
  2011. smalltalk.method({
  2012. selector: "checkClass:for:",
  2013. category: 'optimizations',
  2014. fn: function (aClassName, receiver){
  2015. var self=this;
  2016. smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("((($receiver = ", "__comma", [receiver]), "__comma", [").klass === smalltalk."]), "__comma", [aClassName]), "__comma", [") ? "])]);
  2017. return self;},
  2018. args: ["aClassName", "receiver"],
  2019. source: "checkClass: aClassName for: receiver\x0a stream nextPutAll: '((($receiver = ', receiver, ').klass === smalltalk.', aClassName, ') ? '",
  2020. messageSends: ["nextPutAll:", ","],
  2021. referencedClasses: []
  2022. }),
  2023. smalltalk.FunCodeGenerator);
  2024. smalltalk.addMethod(
  2025. "_compileNode_",
  2026. smalltalk.method({
  2027. selector: "compileNode:",
  2028. category: 'compiling',
  2029. fn: function (aNode){
  2030. var self=this;
  2031. (self['@stream']=smalltalk.send("", "_writeStream", []));
  2032. smalltalk.send(self, "_visit_", [aNode]);
  2033. return smalltalk.send(self['@stream'], "_contents", []);
  2034. return self;},
  2035. args: ["aNode"],
  2036. source: "compileNode: aNode\x0a\x09stream := '' writeStream.\x0a\x09self visit: aNode.\x0a\x09^stream contents",
  2037. messageSends: ["writeStream", "visit:", "contents"],
  2038. referencedClasses: []
  2039. }),
  2040. smalltalk.FunCodeGenerator);
  2041. smalltalk.addMethod(
  2042. "_initialize",
  2043. smalltalk.method({
  2044. selector: "initialize",
  2045. category: 'initialization',
  2046. fn: function (){
  2047. var self=this;
  2048. smalltalk.send(self, "_initialize", [], smalltalk.FunCodeGenerator.superclass || nil);
  2049. (self['@stream']=smalltalk.send("", "_writeStream", []));
  2050. (self['@unknownVariables']=[]);
  2051. (self['@tempVariables']=[]);
  2052. (self['@argVariables']=[]);
  2053. (self['@messageSends']=[]);
  2054. (self['@classReferenced']=[]);
  2055. return self;},
  2056. args: [],
  2057. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream. \x0a\x09unknownVariables := #().\x0a\x09tempVariables := #().\x0a\x09argVariables := #().\x0a\x09messageSends := #().\x0a\x09classReferenced := #()",
  2058. messageSends: ["initialize", "writeStream"],
  2059. referencedClasses: []
  2060. }),
  2061. smalltalk.FunCodeGenerator);
  2062. smalltalk.addMethod(
  2063. "_inline_receiver_argumentNodes_",
  2064. smalltalk.method({
  2065. selector: "inline:receiver:argumentNodes:",
  2066. category: 'optimizations',
  2067. fn: function (aSelector, receiver, aCollection){
  2068. var self=this;
  2069. var inlined=nil;
  2070. (inlined=false);
  2071. ((($receiver = smalltalk.send(aSelector, "__eq", ["ifFalse:"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_checkClass_for_", ["Boolean", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["(! $receiver ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : nil)"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_checkClass_for_", ["Boolean", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["(! $receiver ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : nil)"]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_checkClass_for_", ["Boolean", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["(! $receiver ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : nil)"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_checkClass_for_", ["Boolean", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["(! $receiver ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : nil)"]);return (inlined=true);})]));})]));
  2072. ((($receiver = smalltalk.send(aSelector, "__eq", ["ifTrue:"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_checkClass_for_", ["Boolean", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["($receiver ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : nil)"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_checkClass_for_", ["Boolean", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["($receiver ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : nil)"]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_checkClass_for_", ["Boolean", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["($receiver ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : nil)"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_checkClass_for_", ["Boolean", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["($receiver ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : nil)"]);return (inlined=true);})]));})]));
  2073. ((($receiver = smalltalk.send(aSelector, "__eq", ["ifTrue:ifFalse:"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(aCollection, "_second", []), "_isBlockNode", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_checkClass_for_", ["Boolean", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["($receiver ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_second", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["())"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_checkClass_for_", ["Boolean", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["($receiver ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_second", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["())"]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(aCollection, "_second", []), "_isBlockNode", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_checkClass_for_", ["Boolean", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["($receiver ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_second", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["())"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_checkClass_for_", ["Boolean", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["($receiver ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_second", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["())"]);return (inlined=true);})]));})]));
  2074. ((($receiver = smalltalk.send(aSelector, "__eq", ["ifFalse:ifTrue:"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(aCollection, "_second", []), "_isBlockNode", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_checkClass_for_", ["Boolean", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["(! $receiver ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_second", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["())"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_checkClass_for_", ["Boolean", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["(! $receiver ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_second", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["())"]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(aCollection, "_second", []), "_isBlockNode", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_checkClass_for_", ["Boolean", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["(! $receiver ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_second", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["())"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_checkClass_for_", ["Boolean", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["(! $receiver ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_second", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["())"]);return (inlined=true);})]));})]));
  2075. ((($receiver = smalltalk.send(aSelector, "__eq", ["<"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_checkClass_for_", ["Number", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["$receiver <"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_checkClass_for_", ["Number", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["$receiver <"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));
  2076. ((($receiver = smalltalk.send(aSelector, "__eq", ["<="])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_checkClass_for_", ["Number", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["$receiver <="]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_checkClass_for_", ["Number", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["$receiver <="]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));
  2077. ((($receiver = smalltalk.send(aSelector, "__eq", [">"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_checkClass_for_", ["Number", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["$receiver >"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_checkClass_for_", ["Number", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["$receiver >"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));
  2078. ((($receiver = smalltalk.send(aSelector, "__eq", [">="])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_checkClass_for_", ["Number", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["$receiver >="]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_checkClass_for_", ["Number", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["$receiver >="]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));
  2079. ((($receiver = smalltalk.send(aSelector, "__eq", ["+"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_checkClass_for_", ["Number", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["$receiver +"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_checkClass_for_", ["Number", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["$receiver +"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));
  2080. ((($receiver = smalltalk.send(aSelector, "__eq", ["-"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_checkClass_for_", ["Number", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["$receiver -"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_checkClass_for_", ["Number", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["$receiver -"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));
  2081. ((($receiver = smalltalk.send(aSelector, "__eq", ["*"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_checkClass_for_", ["Number", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["$receiver *"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_checkClass_for_", ["Number", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["$receiver *"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));
  2082. ((($receiver = smalltalk.send(aSelector, "__eq", ["/"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_checkClass_for_", ["Number", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["$receiver /"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_checkClass_for_", ["Number", receiver]);smalltalk.send(self['@stream'], "_nextPutAll_", ["$receiver /"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));
  2083. return inlined;
  2084. return self;},
  2085. args: ["aSelector", "receiver", "aCollection"],
  2086. source: "inline: aSelector receiver: receiver argumentNodes: aCollection\x0a | inlined |\x0a inlined := false.\x0a\x0a\x09\x22-- Booleans --\x22\x0a\x0a\x09(aSelector = 'ifFalse:') ifTrue: [\x0a\x09\x09aCollection first isBlockNode ifTrue: [\x0a \x09self checkClass: 'Boolean' for: receiver.\x0a \x09stream nextPutAll: '(! $receiver ? '.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '() : nil)'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifTrue:') ifTrue: [\x0a\x09\x09aCollection first isBlockNode ifTrue: [\x0a \x09self checkClass: 'Boolean' for: receiver.\x0a \x09stream nextPutAll: '($receiver ? '.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '() : nil)'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifTrue:ifFalse:') ifTrue: [\x0a\x09\x09(aCollection first isBlockNode and: [aCollection second isBlockNode]) ifTrue: [\x0a \x09self checkClass: 'Boolean' for: receiver.\x0a \x09stream nextPutAll: '($receiver ? '.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '() : '.\x0a \x09\x09self visit: aCollection second.\x0a \x09\x09stream nextPutAll: '())'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifFalse:ifTrue:') ifTrue: [\x0a\x09\x09(aCollection first isBlockNode and: [aCollection second isBlockNode]) ifTrue: [\x0a \x09self checkClass: 'Boolean' for: receiver.\x0a \x09stream nextPutAll: '(! $receiver ? '.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '() : '.\x0a \x09\x09self visit: aCollection second.\x0a \x09\x09stream nextPutAll: '())'.\x0a \x09inlined := true]].\x0a\x0a\x09\x22-- Numbers --\x22\x0a\x0a\x09(aSelector = '<') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver <'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a\x09(aSelector = '<=') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver <='.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a\x09(aSelector = '>') ifTrue: [ \x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver >'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a\x09(aSelector = '>=') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver >='.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a (aSelector = '+') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver +'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a (aSelector = '-') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver -'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a (aSelector = '*') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver *'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a (aSelector = '/') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver /'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a ^inlined",
  2087. messageSends: ["ifTrue:", "=", "isBlockNode", "first", "checkClass:for:", "nextPutAll:", "visit:", "and:", "second"],
  2088. referencedClasses: []
  2089. }),
  2090. smalltalk.FunCodeGenerator);
  2091. smalltalk.addMethod(
  2092. "_inlineLiteral_receiverNode_argumentNodes_",
  2093. smalltalk.method({
  2094. selector: "inlineLiteral:receiverNode:argumentNodes:",
  2095. category: 'optimizations',
  2096. fn: function (aSelector, anObject, aCollection){
  2097. var self=this;
  2098. var inlined=nil;
  2099. (inlined=false);
  2100. ((($receiver = smalltalk.send(aSelector, "__eq", ["whileTrue:"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(smalltalk.send(anObject, "_isBlockNode", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){while("]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()) {"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()}})()"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){while("]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()) {"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()}})()"]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(smalltalk.send(anObject, "_isBlockNode", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){while("]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()) {"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()}})()"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){while("]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()) {"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()}})()"]);return (inlined=true);})]));})]));
  2101. ((($receiver = smalltalk.send(aSelector, "__eq", ["whileFalse:"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(smalltalk.send(anObject, "_isBlockNode", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){while(!"]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()) {"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()}})()"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){while(!"]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()) {"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()}})()"]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(smalltalk.send(anObject, "_isBlockNode", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){while(!"]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()) {"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()}})()"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){while(!"]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()) {"]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()}})()"]);return (inlined=true);})]));})]));
  2102. ((($receiver = smalltalk.send(aSelector, "__eq", ["whileTrue"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(anObject, "_isBlockNode", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){while("]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()) {}})()"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){while("]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()) {}})()"]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(anObject, "_isBlockNode", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){while("]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()) {}})()"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){while("]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()) {}})()"]);return (inlined=true);})]));})]));
  2103. ((($receiver = smalltalk.send(aSelector, "__eq", ["whileFalse"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(anObject, "_isBlockNode", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){while(!"]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()) {}})()"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){while(!"]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()) {}})()"]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(anObject, "_isBlockNode", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){while(!"]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()) {}})()"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){while(!"]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()) {}})()"]);return (inlined=true);})]));})]));
  2104. ((($receiver = smalltalk.send(aSelector, "__eq", ["+"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(self, "_isNode_ofClass_", [anObject, (smalltalk.Number || Number)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" + "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" + "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(self, "_isNode_ofClass_", [anObject, (smalltalk.Number || Number)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" + "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" + "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));})]));
  2105. ((($receiver = smalltalk.send(aSelector, "__eq", ["-"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(self, "_isNode_ofClass_", [anObject, (smalltalk.Number || Number)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" - "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" - "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(self, "_isNode_ofClass_", [anObject, (smalltalk.Number || Number)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" - "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" - "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));})]));
  2106. ((($receiver = smalltalk.send(aSelector, "__eq", ["*"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(self, "_isNode_ofClass_", [anObject, (smalltalk.Number || Number)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" * "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" * "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(self, "_isNode_ofClass_", [anObject, (smalltalk.Number || Number)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" * "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" * "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));})]));
  2107. ((($receiver = smalltalk.send(aSelector, "__eq", ["/"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(self, "_isNode_ofClass_", [anObject, (smalltalk.Number || Number)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" / "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" / "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(self, "_isNode_ofClass_", [anObject, (smalltalk.Number || Number)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" / "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" / "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));})]));
  2108. ((($receiver = smalltalk.send(aSelector, "__eq", ["<"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(self, "_isNode_ofClass_", [anObject, (smalltalk.Number || Number)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" < "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" < "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(self, "_isNode_ofClass_", [anObject, (smalltalk.Number || Number)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" < "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" < "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));})]));
  2109. ((($receiver = smalltalk.send(aSelector, "__eq", ["<="])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(self, "_isNode_ofClass_", [anObject, (smalltalk.Number || Number)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" <= "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" <= "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(self, "_isNode_ofClass_", [anObject, (smalltalk.Number || Number)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" <= "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" <= "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));})]));
  2110. ((($receiver = smalltalk.send(aSelector, "__eq", [">"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(self, "_isNode_ofClass_", [anObject, (smalltalk.Number || Number)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" > "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" > "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(self, "_isNode_ofClass_", [anObject, (smalltalk.Number || Number)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" > "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" > "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));})]));
  2111. ((($receiver = smalltalk.send(aSelector, "__eq", [">="])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(self, "_isNode_ofClass_", [anObject, (smalltalk.Number || Number)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" >= "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" >= "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(self, "_isNode_ofClass_", [anObject, (smalltalk.Number || Number)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" >= "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [" >= "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);return (inlined=true);})]));})]));
  2112. ((($receiver = smalltalk.send(aSelector, "__eq", ["ifNil:"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(($receiver = "]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [") == nil || $receiver == undefined) ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : $receiver"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(($receiver = "]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [") == nil || $receiver == undefined) ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : $receiver"]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(($receiver = "]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [") == nil || $receiver == undefined) ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : $receiver"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(($receiver = "]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [") == nil || $receiver == undefined) ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : $receiver"]);return (inlined=true);})]));})]));
  2113. ((($receiver = smalltalk.send(aSelector, "__eq", ["ifNotNil:"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(($receiver = "]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [") != nil && $receiver != undefined) ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : nil"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(($receiver = "]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [") != nil && $receiver != undefined) ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : nil"]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(($receiver = "]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [") != nil && $receiver != undefined) ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : nil"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(($receiver = "]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [") != nil && $receiver != undefined) ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : nil"]);return (inlined=true);})]));})]));
  2114. ((($receiver = smalltalk.send(aSelector, "__eq", ["ifNil:ifNotNil:"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(aCollection, "_second", []), "_isBlockNode", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(($receiver = "]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [") == nil || $receiver == undefined) ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_second", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(($receiver = "]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [") == nil || $receiver == undefined) ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_second", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()"]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(aCollection, "_second", []), "_isBlockNode", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(($receiver = "]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [") == nil || $receiver == undefined) ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_second", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(($receiver = "]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [") == nil || $receiver == undefined) ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_second", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()"]);return (inlined=true);})]));})]));
  2115. ((($receiver = smalltalk.send(aSelector, "__eq", ["ifNotNil:ifNil:"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(aCollection, "_second", []), "_isBlockNode", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(($receiver = "]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [") == nil || $receiver == undefined) ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_second", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(($receiver = "]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [") == nil || $receiver == undefined) ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_second", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()"]);return (inlined=true);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(aCollection, "_first", []), "_isBlockNode", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(aCollection, "_second", []), "_isBlockNode", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(($receiver = "]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [") == nil || $receiver == undefined) ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_second", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()"]);return (inlined=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(self['@stream'], "_nextPutAll_", ["(($receiver = "]);smalltalk.send(self, "_visit_", [anObject]);smalltalk.send(self['@stream'], "_nextPutAll_", [") == nil || $receiver == undefined) ? "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_second", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["() : "]);smalltalk.send(self, "_visit_", [smalltalk.send(aCollection, "_first", [])]);smalltalk.send(self['@stream'], "_nextPutAll_", ["()"]);return (inlined=true);})]));})]));
  2116. return inlined;
  2117. return self;},
  2118. args: ["aSelector", "anObject", "aCollection"],
  2119. source: "inlineLiteral: aSelector receiverNode: anObject argumentNodes: aCollection\x0a | inlined |\x0a inlined := false.\x0a \x0a\x09\x22-- BlockClosures --\x22\x0a\x0a\x09(aSelector = 'whileTrue:') ifTrue: [\x0a \x09(anObject isBlockNode and: [aCollection first isBlockNode]) ifTrue: [\x0a \x09stream nextPutAll: '(function(){while('.\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: '()) {'.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '()}})()'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'whileFalse:') ifTrue: [\x0a \x09(anObject isBlockNode and: [aCollection first isBlockNode]) ifTrue: [\x0a \x09stream nextPutAll: '(function(){while(!'.\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: '()) {'.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '()}})()'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'whileTrue') ifTrue: [\x0a \x09anObject isBlockNode ifTrue: [\x0a \x09stream nextPutAll: '(function(){while('.\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: '()) {}})()'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'whileFalse') ifTrue: [\x0a \x09anObject isBlockNode ifTrue: [\x0a \x09stream nextPutAll: '(function(){while(!'.\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: '()) {}})()'.\x0a \x09inlined := true]].\x0a\x0a\x09\x22-- Numbers --\x22\x0a\x0a\x09(aSelector = '+') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' + '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '-') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' - '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '*') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' * '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '/') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' / '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '<') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' < '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '<=') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' <= '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '>') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' > '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '>=') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' >= '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a \x09 \x0a\x09\x22-- UndefinedObject --\x22\x0a\x0a\x09(aSelector = 'ifNil:') ifTrue: [\x0a\x09\x09aCollection first isBlockNode ifTrue: [\x0a \x09\x09stream nextPutAll: '(($receiver = '.\x0a \x09\x09self visit: anObject.\x0a \x09\x09stream nextPutAll: ') == nil || $receiver == undefined) ? '.\x0a \x09self visit: aCollection first.\x0a \x09stream nextPutAll: '() : $receiver'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifNotNil:') ifTrue: [\x0a\x09\x09aCollection first isBlockNode ifTrue: [\x0a \x09\x09stream nextPutAll: '(($receiver = '.\x0a \x09\x09self visit: anObject.\x0a \x09\x09stream nextPutAll: ') != nil && $receiver != undefined) ? '.\x0a \x09self visit: aCollection first.\x0a \x09stream nextPutAll: '() : nil'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifNil:ifNotNil:') ifTrue: [\x0a\x09\x09(aCollection first isBlockNode and: [aCollection second isBlockNode]) ifTrue: [\x0a \x09\x09stream nextPutAll: '(($receiver = '.\x0a \x09\x09self visit: anObject.\x0a \x09\x09stream nextPutAll: ') == nil || $receiver == undefined) ? '.\x0a \x09self visit: aCollection first.\x0a \x09stream nextPutAll: '() : '.\x0a \x09self visit: aCollection second.\x0a \x09stream nextPutAll: '()'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifNotNil:ifNil:') ifTrue: [\x0a\x09\x09(aCollection first isBlockNode and: [aCollection second isBlockNode]) ifTrue: [\x0a \x09\x09stream nextPutAll: '(($receiver = '.\x0a \x09\x09self visit: anObject.\x0a \x09\x09stream nextPutAll: ') == nil || $receiver == undefined) ? '.\x0a \x09self visit: aCollection second.\x0a \x09stream nextPutAll: '() : '.\x0a \x09self visit: aCollection first.\x0a \x09stream nextPutAll: '()'.\x0a \x09inlined := true]].\x0a \x0a ^inlined",
  2120. messageSends: ["ifTrue:", "=", "and:", "isBlockNode", "first", "nextPutAll:", "visit:", "isNode:ofClass:", "second"],
  2121. referencedClasses: ["Number"]
  2122. }),
  2123. smalltalk.FunCodeGenerator);
  2124. smalltalk.addMethod(
  2125. "_isNode_ofClass_",
  2126. smalltalk.method({
  2127. selector: "isNode:ofClass:",
  2128. category: 'optimizations',
  2129. fn: function (aNode, aClass){
  2130. var self=this;
  2131. return smalltalk.send(smalltalk.send(aNode, "_isValueNode", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_value", []), "_class", []), "__eq", [aClass]), "_or_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_value", []), "__eq", ["self"]), "_and_", [(function(){return smalltalk.send(smalltalk.send(self, "_currentClass", []), "__eq", [aClass]);})]);})]);})]);
  2132. return self;},
  2133. args: ["aNode", "aClass"],
  2134. source: "isNode: aNode ofClass: aClass\x0a\x09^aNode isValueNode and: [\x0a \x09aNode value class = aClass or: [\x0a \x09\x09aNode value = 'self' and: [self currentClass = aClass]]]",
  2135. messageSends: ["and:", "isValueNode", "or:", "=", "class", "value", "currentClass"],
  2136. referencedClasses: []
  2137. }),
  2138. smalltalk.FunCodeGenerator);
  2139. smalltalk.addMethod(
  2140. "_knownVariables",
  2141. smalltalk.method({
  2142. selector: "knownVariables",
  2143. category: 'accessing',
  2144. fn: function (){
  2145. var self=this;
  2146. return (function($rec){smalltalk.send($rec, "_addAll_", [smalltalk.send(self, "_tempVariables", [])]);smalltalk.send($rec, "_addAll_", [smalltalk.send(self, "_argVariables", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_pseudoVariables", []));
  2147. return self;},
  2148. args: [],
  2149. source: "knownVariables\x0a\x09^self pseudoVariables \x0a\x09\x09addAll: self tempVariables;\x0a\x09\x09addAll: self argVariables;\x0a\x09\x09yourself",
  2150. messageSends: ["addAll:", "tempVariables", "argVariables", "yourself", "pseudoVariables"],
  2151. referencedClasses: []
  2152. }),
  2153. smalltalk.FunCodeGenerator);
  2154. smalltalk.addMethod(
  2155. "_performOptimizations",
  2156. smalltalk.method({
  2157. selector: "performOptimizations",
  2158. category: 'testing',
  2159. fn: function (){
  2160. var self=this;
  2161. return smalltalk.send(smalltalk.send(self, "_class", []), "_performOptimizations", []);
  2162. return self;},
  2163. args: [],
  2164. source: "performOptimizations\x0a\x09^self class performOptimizations",
  2165. messageSends: ["performOptimizations", "class"],
  2166. referencedClasses: []
  2167. }),
  2168. smalltalk.FunCodeGenerator);
  2169. smalltalk.addMethod(
  2170. "_send_to_arguments_superSend_",
  2171. smalltalk.method({
  2172. selector: "send:to:arguments:superSend:",
  2173. category: 'visiting',
  2174. fn: function (aSelector, aReceiver, aCollection, aBoolean){
  2175. var self=this;
  2176. return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(str){var tmp=nil;
  2177. (tmp=self['@stream']);smalltalk.send(str, "_nextPutAll_", ["smalltalk.send("]);smalltalk.send(str, "_nextPutAll_", [aReceiver]);smalltalk.send(str, "_nextPutAll_", [smalltalk.send(smalltalk.send(", \x22", "__comma", [smalltalk.send(aSelector, "_asSelector", [])]), "__comma", ["\x22, ["])]);(self['@stream']=str);smalltalk.send(aCollection, "_do_separatedBy_", [(function(each){return smalltalk.send(self, "_visit_", [each]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [", "]);})]);(self['@stream']=tmp);smalltalk.send(str, "_nextPutAll_", ["]"]);((($receiver = aBoolean).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(str, "_nextPutAll_", [smalltalk.send(smalltalk.send(", smalltalk.", "__comma", [smalltalk.send(self, "_classNameFor_", [smalltalk.send(self, "_currentClass", [])])]), "__comma", [".superclass || nil"])]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(str, "_nextPutAll_", [smalltalk.send(smalltalk.send(", smalltalk.", "__comma", [smalltalk.send(self, "_classNameFor_", [smalltalk.send(self, "_currentClass", [])])]), "__comma", [".superclass || nil"])]);})]));return smalltalk.send(str, "_nextPutAll_", [")"]);})]);
  2178. return self;},
  2179. args: ["aSelector", "aReceiver", "aCollection", "aBoolean"],
  2180. source: "send: aSelector to: aReceiver arguments: aCollection superSend: aBoolean\x0a\x09^String streamContents: [:str || tmp |\x0a \x09tmp := stream.\x0a\x09\x09str nextPutAll: 'smalltalk.send('.\x0a\x09\x09str nextPutAll: aReceiver.\x0a\x09\x09str nextPutAll: ', \x22', aSelector asSelector, '\x22, ['.\x0a stream := str.\x0a\x09\x09aCollection\x0a\x09 \x09\x09do: [:each | self visit: each]\x0a\x09 \x09\x09separatedBy: [stream nextPutAll: ', '].\x0a stream := tmp.\x0a str nextPutAll: ']'.\x0a\x09\x09aBoolean ifTrue: [\x0a\x09\x09\x09str nextPutAll: ', smalltalk.', (self classNameFor: self currentClass), '.superclass || nil'].\x0a\x09\x09str nextPutAll: ')']",
  2181. messageSends: ["streamContents:", "nextPutAll:", ",", "asSelector", "do:separatedBy:", "visit:", "ifTrue:", "classNameFor:", "currentClass"],
  2182. referencedClasses: ["String"]
  2183. }),
  2184. smalltalk.FunCodeGenerator);
  2185. smalltalk.addMethod(
  2186. "_tempVariables",
  2187. smalltalk.method({
  2188. selector: "tempVariables",
  2189. category: 'accessing',
  2190. fn: function (){
  2191. var self=this;
  2192. return smalltalk.send(self['@tempVariables'], "_copy", []);
  2193. return self;},
  2194. args: [],
  2195. source: "tempVariables\x0a\x09^tempVariables copy",
  2196. messageSends: ["copy"],
  2197. referencedClasses: []
  2198. }),
  2199. smalltalk.FunCodeGenerator);
  2200. smalltalk.addMethod(
  2201. "_unknownVariables",
  2202. smalltalk.method({
  2203. selector: "unknownVariables",
  2204. category: 'accessing',
  2205. fn: function (){
  2206. var self=this;
  2207. return smalltalk.send(self['@unknownVariables'], "_copy", []);
  2208. return self;},
  2209. args: [],
  2210. source: "unknownVariables\x0a\x09^unknownVariables copy",
  2211. messageSends: ["copy"],
  2212. referencedClasses: []
  2213. }),
  2214. smalltalk.FunCodeGenerator);
  2215. smalltalk.addMethod(
  2216. "_visit_",
  2217. smalltalk.method({
  2218. selector: "visit:",
  2219. category: 'visiting',
  2220. fn: function (aNode){
  2221. var self=this;
  2222. smalltalk.send(aNode, "_accept_", [self]);
  2223. return self;},
  2224. args: ["aNode"],
  2225. source: "visit: aNode\x0a\x09aNode accept: self",
  2226. messageSends: ["accept:"],
  2227. referencedClasses: []
  2228. }),
  2229. smalltalk.FunCodeGenerator);
  2230. smalltalk.addMethod(
  2231. "_visitAssignmentNode_",
  2232. smalltalk.method({
  2233. selector: "visitAssignmentNode:",
  2234. category: 'visiting',
  2235. fn: function (aNode){
  2236. var self=this;
  2237. smalltalk.send(self['@stream'], "_nextPutAll_", ["("]);
  2238. smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_left", [])]);
  2239. smalltalk.send(self['@stream'], "_nextPutAll_", ["="]);
  2240. smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_right", [])]);
  2241. smalltalk.send(self['@stream'], "_nextPutAll_", [")"]);
  2242. return self;},
  2243. args: ["aNode"],
  2244. source: "visitAssignmentNode: aNode\x0a\x09stream nextPutAll: '('.\x0a\x09self visit: aNode left.\x0a\x09stream nextPutAll: '='.\x0a\x09self visit: aNode right.\x0a\x09stream nextPutAll: ')'",
  2245. messageSends: ["nextPutAll:", "visit:", "left", "right"],
  2246. referencedClasses: []
  2247. }),
  2248. smalltalk.FunCodeGenerator);
  2249. smalltalk.addMethod(
  2250. "_visitBlockNode_",
  2251. smalltalk.method({
  2252. selector: "visitBlockNode:",
  2253. category: 'visiting',
  2254. fn: function (aNode){
  2255. var self=this;
  2256. smalltalk.send(self['@stream'], "_nextPutAll_", ["(function("]);
  2257. smalltalk.send(smalltalk.send(aNode, "_parameters", []), "_do_separatedBy_", [(function(each){smalltalk.send(self['@tempVariables'], "_add_", [each]);return smalltalk.send(self['@stream'], "_nextPutAll_", [each]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [", "]);})]);
  2258. smalltalk.send(self['@stream'], "_nextPutAll_", ["){"]);
  2259. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);
  2260. smalltalk.send(self['@stream'], "_nextPutAll_", ["})"]);
  2261. return self;},
  2262. args: ["aNode"],
  2263. source: "visitBlockNode: aNode\x0a\x09stream nextPutAll: '(function('.\x0a\x09aNode parameters \x0a\x09 do: [:each |\x0a\x09\x09tempVariables add: each.\x0a\x09\x09stream nextPutAll: each]\x0a\x09 separatedBy: [stream nextPutAll: ', '].\x0a\x09stream nextPutAll: '){'.\x0a\x09aNode nodes do: [:each | self visit: each].\x0a\x09stream nextPutAll: '})'",
  2264. messageSends: ["nextPutAll:", "do:separatedBy:", "parameters", "add:", "do:", "nodes", "visit:"],
  2265. referencedClasses: []
  2266. }),
  2267. smalltalk.FunCodeGenerator);
  2268. smalltalk.addMethod(
  2269. "_visitBlockSequenceNode_",
  2270. smalltalk.method({
  2271. selector: "visitBlockSequenceNode:",
  2272. category: 'visiting',
  2273. fn: function (aNode){
  2274. var self=this;
  2275. var index=nil;
  2276. (self['@nestedBlocks']=((($receiver = self['@nestedBlocks']).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));
  2277. ((($receiver = smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_isEmpty", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["return nil;"]);})() : (function(){smalltalk.send(smalltalk.send(aNode, "_temps", []), "_do_", [(function(each){var temp=nil;
  2278. (temp=smalltalk.send(self, "_safeVariableNameFor_", [each]));smalltalk.send(self['@tempVariables'], "_add_", [temp]);return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("var ", "__comma", [temp]), "__comma", ["=nil;"])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);})]);(index=(0));return smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){(index=((($receiver = index).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));((($receiver = smalltalk.send(index, "__eq", [smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_size", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["return "]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["return "]);})]));smalltalk.send(self, "_visit_", [each]);return smalltalk.send(self['@stream'], "_nextPutAll_", [";"]);})]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["return nil;"]);}), (function(){smalltalk.send(smalltalk.send(aNode, "_temps", []), "_do_", [(function(each){var temp=nil;
  2279. (temp=smalltalk.send(self, "_safeVariableNameFor_", [each]));smalltalk.send(self['@tempVariables'], "_add_", [temp]);return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("var ", "__comma", [temp]), "__comma", ["=nil;"])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);})]);(index=(0));return smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){(index=((($receiver = index).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));((($receiver = smalltalk.send(index, "__eq", [smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_size", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["return "]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["return "]);})]));smalltalk.send(self, "_visit_", [each]);return smalltalk.send(self['@stream'], "_nextPutAll_", [";"]);})]);})]));
  2280. (self['@nestedBlocks']=((($receiver = self['@nestedBlocks']).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)])));
  2281. return self;},
  2282. args: ["aNode"],
  2283. source: "visitBlockSequenceNode: aNode\x0a\x09| index |\x0a\x09nestedBlocks := nestedBlocks + 1.\x0a\x09aNode nodes isEmpty\x0a\x09 ifTrue: [\x0a\x09\x09stream nextPutAll: 'return nil;']\x0a\x09 ifFalse: [\x0a\x09\x09aNode temps do: [:each | | temp |\x0a temp := self safeVariableNameFor: each.\x0a\x09\x09 tempVariables add: temp.\x0a\x09\x09 stream nextPutAll: 'var ', temp, '=nil;'; lf].\x0a\x09\x09index := 0.\x0a\x09\x09aNode nodes do: [:each |\x0a\x09\x09 index := index + 1.\x0a\x09\x09 index = aNode nodes size ifTrue: [\x0a\x09\x09\x09stream nextPutAll: 'return '].\x0a\x09\x09 self visit: each.\x0a\x09\x09 stream nextPutAll: ';']].\x0a\x09nestedBlocks := nestedBlocks - 1",
  2284. messageSends: ["+", "ifTrue:ifFalse:", "isEmpty", "nodes", "nextPutAll:", "do:", "temps", "safeVariableNameFor:", "add:", ",", "lf", "ifTrue:", "=", "size", "visit:", "-"],
  2285. referencedClasses: []
  2286. }),
  2287. smalltalk.FunCodeGenerator);
  2288. smalltalk.addMethod(
  2289. "_visitCascadeNode_",
  2290. smalltalk.method({
  2291. selector: "visitCascadeNode:",
  2292. category: 'visiting',
  2293. fn: function (aNode){
  2294. var self=this;
  2295. var index=nil;
  2296. (index=(0));
  2297. ((($receiver = smalltalk.send(self['@tempVariables'], "_includes_", ["$rec"])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self['@tempVariables'], "_add_", ["$rec"]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self['@tempVariables'], "_add_", ["$rec"]);})]));
  2298. smalltalk.send(self['@stream'], "_nextPutAll_", ["(function($rec){"]);
  2299. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){(index=((($receiver = index).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));((($receiver = smalltalk.send(index, "__eq", [smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_size", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["return "]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["return "]);})]));smalltalk.send(each, "_receiver_", [smalltalk.send(smalltalk.send((smalltalk.VariableNode || VariableNode), "_new", []), "_value_", ["$rec"])]);smalltalk.send(self, "_visit_", [each]);return smalltalk.send(self['@stream'], "_nextPutAll_", [";"]);})]);
  2300. smalltalk.send(self['@stream'], "_nextPutAll_", ["})("]);
  2301. smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_receiver", [])]);
  2302. smalltalk.send(self['@stream'], "_nextPutAll_", [")"]);
  2303. return self;},
  2304. args: ["aNode"],
  2305. source: "visitCascadeNode: aNode\x0a\x09| index |\x0a\x09index := 0.\x0a\x09(tempVariables includes: '$rec') ifFalse: [\x0a\x09\x09tempVariables add: '$rec'].\x0a\x09stream nextPutAll: '(function($rec){'.\x0a\x09aNode nodes do: [:each |\x0a\x09 index := index + 1.\x0a\x09 index = aNode nodes size ifTrue: [\x0a\x09\x09stream nextPutAll: 'return '].\x0a\x09 each receiver: (VariableNode new value: '$rec').\x0a\x09 self visit: each.\x0a\x09 stream nextPutAll: ';'].\x0a\x09stream nextPutAll: '})('.\x0a\x09self visit: aNode receiver.\x0a\x09stream nextPutAll: ')'",
  2306. messageSends: ["ifFalse:", "includes:", "add:", "nextPutAll:", "do:", "nodes", "+", "ifTrue:", "=", "size", "receiver:", "value:", "new", "visit:", "receiver"],
  2307. referencedClasses: ["VariableNode"]
  2308. }),
  2309. smalltalk.FunCodeGenerator);
  2310. smalltalk.addMethod(
  2311. "_visitClassReferenceNode_",
  2312. smalltalk.method({
  2313. selector: "visitClassReferenceNode:",
  2314. category: 'visiting',
  2315. fn: function (aNode){
  2316. var self=this;
  2317. ((($receiver = smalltalk.send(self['@referencedClasses'], "_includes_", [smalltalk.send(aNode, "_value", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self['@referencedClasses'], "_add_", [smalltalk.send(aNode, "_value", [])]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self['@referencedClasses'], "_add_", [smalltalk.send(aNode, "_value", [])]);})]));
  2318. smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(smalltalk.", "__comma", [smalltalk.send(aNode, "_value", [])]), "__comma", [" || "]), "__comma", [smalltalk.send(aNode, "_value", [])]), "__comma", [")"])]);
  2319. return self;},
  2320. args: ["aNode"],
  2321. source: "visitClassReferenceNode: aNode\x0a\x09(referencedClasses includes: aNode value) ifFalse: [\x0a\x09\x09referencedClasses add: aNode value].\x0a\x09stream nextPutAll: '(smalltalk.', aNode value, ' || ', aNode value, ')'",
  2322. messageSends: ["ifFalse:", "includes:", "value", "add:", "nextPutAll:", ","],
  2323. referencedClasses: []
  2324. }),
  2325. smalltalk.FunCodeGenerator);
  2326. smalltalk.addMethod(
  2327. "_visitDynamicArrayNode_",
  2328. smalltalk.method({
  2329. selector: "visitDynamicArrayNode:",
  2330. category: 'visiting',
  2331. fn: function (aNode){
  2332. var self=this;
  2333. smalltalk.send(self['@stream'], "_nextPutAll_", ["["]);
  2334. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_separatedBy_", [(function(each){return smalltalk.send(self, "_visit_", [each]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [","]);})]);
  2335. smalltalk.send(self['@stream'], "_nextPutAll_", ["]"]);
  2336. return self;},
  2337. args: ["aNode"],
  2338. source: "visitDynamicArrayNode: aNode\x0a\x09stream nextPutAll: '['.\x0a\x09aNode nodes \x0a\x09\x09do: [:each | self visit: each]\x0a\x09\x09separatedBy: [stream nextPutAll: ','].\x0a\x09stream nextPutAll: ']'",
  2339. messageSends: ["nextPutAll:", "do:separatedBy:", "nodes", "visit:"],
  2340. referencedClasses: []
  2341. }),
  2342. smalltalk.FunCodeGenerator);
  2343. smalltalk.addMethod(
  2344. "_visitDynamicDictionaryNode_",
  2345. smalltalk.method({
  2346. selector: "visitDynamicDictionaryNode:",
  2347. category: 'visiting',
  2348. fn: function (aNode){
  2349. var self=this;
  2350. smalltalk.send(self['@stream'], "_nextPutAll_", ["smalltalk.HashedCollection._fromPairs_(["]);
  2351. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_separatedBy_", [(function(each){return smalltalk.send(self, "_visit_", [each]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [","]);})]);
  2352. smalltalk.send(self['@stream'], "_nextPutAll_", ["])"]);
  2353. return self;},
  2354. args: ["aNode"],
  2355. source: "visitDynamicDictionaryNode: aNode\x0a\x09stream nextPutAll: 'smalltalk.HashedCollection._fromPairs_(['.\x0a\x09\x09aNode nodes \x0a\x09\x09\x09do: [:each | self visit: each]\x0a\x09\x09\x09separatedBy: [stream nextPutAll: ','].\x0a\x09\x09stream nextPutAll: '])'",
  2356. messageSends: ["nextPutAll:", "do:separatedBy:", "nodes", "visit:"],
  2357. referencedClasses: []
  2358. }),
  2359. smalltalk.FunCodeGenerator);
  2360. smalltalk.addMethod(
  2361. "_visitFailure_",
  2362. smalltalk.method({
  2363. selector: "visitFailure:",
  2364. category: 'visiting',
  2365. fn: function (aFailure){
  2366. var self=this;
  2367. smalltalk.send(self, "_error_", [smalltalk.send(aFailure, "_asString", [])]);
  2368. return self;},
  2369. args: ["aFailure"],
  2370. source: "visitFailure: aFailure\x0a\x09self error: aFailure asString",
  2371. messageSends: ["error:", "asString"],
  2372. referencedClasses: []
  2373. }),
  2374. smalltalk.FunCodeGenerator);
  2375. smalltalk.addMethod(
  2376. "_visitJSStatementNode_",
  2377. smalltalk.method({
  2378. selector: "visitJSStatementNode:",
  2379. category: 'visiting',
  2380. fn: function (aNode){
  2381. var self=this;
  2382. smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(aNode, "_source", [])]);
  2383. return self;},
  2384. args: ["aNode"],
  2385. source: "visitJSStatementNode: aNode\x0a\x09stream nextPutAll: aNode source",
  2386. messageSends: ["nextPutAll:", "source"],
  2387. referencedClasses: []
  2388. }),
  2389. smalltalk.FunCodeGenerator);
  2390. smalltalk.addMethod(
  2391. "_visitMethodNode_",
  2392. smalltalk.method({
  2393. selector: "visitMethodNode:",
  2394. category: 'visiting',
  2395. fn: function (aNode){
  2396. var self=this;
  2397. var str=nil;
  2398. var currentSelector=nil;
  2399. (self['@currentSelector']=smalltalk.send(smalltalk.send(aNode, "_selector", []), "_asSelector", []));
  2400. (self['@nestedBlocks']=(0));
  2401. (self['@earlyReturn']=false);
  2402. (self['@messageSends']=[]);
  2403. (self['@referencedClasses']=[]);
  2404. (self['@unknownVariables']=[]);
  2405. (self['@tempVariables']=[]);
  2406. (self['@argVariables']=[]);
  2407. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["smalltalk.method({"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("selector: \x22", "__comma", [smalltalk.send(aNode, "_selector", [])]), "__comma", ["\x22,"])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2408. (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("source: ", "__comma", [smalltalk.send(smalltalk.send(self, "_source", []), "_asJavascript", [])]), "__comma", [","])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2409. smalltalk.send(self['@stream'], "_nextPutAll_", ["fn: function("]);
  2410. smalltalk.send(smalltalk.send(aNode, "_arguments", []), "_do_separatedBy_", [(function(each){smalltalk.send(self['@argVariables'], "_add_", [each]);return smalltalk.send(self['@stream'], "_nextPutAll_", [each]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [", "]);})]);
  2411. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["){"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", ["var self=this;"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2412. (str=self['@stream']);
  2413. (self['@stream']=smalltalk.send("", "_writeStream", []));
  2414. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);
  2415. ((($receiver = self['@earlyReturn']).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["var $early={};"]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["try{"]);})(str);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["var $early={};"]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["try{"]);})(str);})]));
  2416. smalltalk.send(str, "_nextPutAll_", [smalltalk.send(self['@stream'], "_contents", [])]);
  2417. (self['@stream']=str);
  2418. (function($rec){smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["return self;"]);})(self['@stream']);
  2419. ((($receiver = self['@earlyReturn']).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function($rec){smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["} catch(e) {if(e===$early)return e[0]; throw e}"]);})(self['@stream']);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function($rec){smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["} catch(e) {if(e===$early)return e[0]; throw e}"]);})(self['@stream']);})]));
  2420. smalltalk.send(self['@stream'], "_nextPutAll_", ["}"]);
  2421. (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(",", "__comma", [smalltalk.send((smalltalk.String || String), "_lf", [])]), "__comma", ["messageSends: "])]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(self['@messageSends'], "_asJavascript", []), "__comma", [","])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("args: ", "__comma", [smalltalk.send(self['@argVariables'], "_asJavascript", [])]), "__comma", [","])]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["referencedClasses: ["]);})(self['@stream']);
  2422. smalltalk.send(self['@referencedClasses'], "_do_separatedBy_", [(function(each){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(each, "_printString", [])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [","]);})]);
  2423. smalltalk.send(self['@stream'], "_nextPutAll_", ["]"]);
  2424. smalltalk.send(self['@stream'], "_nextPutAll_", ["})"]);
  2425. return self;},
  2426. args: ["aNode"],
  2427. source: "visitMethodNode: aNode\x0a\x09| str currentSelector | \x0a\x09currentSelector := aNode selector asSelector.\x0a\x09nestedBlocks := 0.\x0a\x09earlyReturn := false.\x0a\x09messageSends := #().\x0a\x09referencedClasses := #().\x0a\x09unknownVariables := #().\x0a\x09tempVariables := #().\x0a\x09argVariables := #().\x0a\x09stream \x0a\x09 nextPutAll: 'smalltalk.method({'; lf;\x0a\x09 nextPutAll: 'selector: \x22', aNode selector, '\x22,'; lf.\x0a\x09stream nextPutAll: 'source: ', self source asJavascript, ',';lf.\x0a\x09stream nextPutAll: 'fn: function('.\x0a\x09aNode arguments \x0a\x09 do: [:each | \x0a\x09\x09argVariables add: each.\x0a\x09\x09stream nextPutAll: each]\x0a\x09 separatedBy: [stream nextPutAll: ', '].\x0a\x09stream \x0a\x09 nextPutAll: '){'; lf;\x0a\x09 nextPutAll: 'var self=this;'; lf.\x0a\x09str := stream.\x0a\x09stream := '' writeStream.\x0a\x09aNode nodes do: [:each |\x0a\x09 self visit: each].\x0a\x09earlyReturn ifTrue: [\x0a\x09 str nextPutAll: 'var $early={};'; lf; nextPutAll: 'try{'].\x0a\x09str nextPutAll: stream contents.\x0a\x09stream := str.\x0a\x09stream \x0a\x09 lf; \x0a\x09 nextPutAll: 'return self;'.\x0a\x09earlyReturn ifTrue: [\x0a\x09 stream lf; nextPutAll: '} catch(e) {if(e===$early)return e[0]; throw e}'].\x0a\x09stream nextPutAll: '}'.\x0a\x09stream \x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: messageSends asJavascript, ','; lf;\x0a \x09nextPutAll: 'args: ', argVariables asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09referencedClasses \x0a\x09\x09do: [:each | stream nextPutAll: each printString]\x0a\x09\x09separatedBy: [stream nextPutAll: ','].\x0a\x09stream nextPutAll: ']'.\x0a\x09stream nextPutAll: '})'",
  2428. messageSends: ["asSelector", "selector", "nextPutAll:", "lf", ",", "asJavascript", "source", "do:separatedBy:", "arguments", "add:", "writeStream", "do:", "nodes", "visit:", "ifTrue:", "contents", "printString"],
  2429. referencedClasses: ["String"]
  2430. }),
  2431. smalltalk.FunCodeGenerator);
  2432. smalltalk.addMethod(
  2433. "_visitReturnNode_",
  2434. smalltalk.method({
  2435. selector: "visitReturnNode:",
  2436. category: 'visiting',
  2437. fn: function (aNode){
  2438. var self=this;
  2439. ((($receiver = ((($receiver = self['@nestedBlocks']).klass === smalltalk.Number) ? $receiver >(0) : smalltalk.send($receiver, "__gt", [(0)]))).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (self['@earlyReturn']=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (self['@earlyReturn']=true);})]));
  2440. ((($receiver = ((($receiver = self['@nestedBlocks']).klass === smalltalk.Number) ? $receiver >(0) : smalltalk.send($receiver, "__gt", [(0)]))).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){throw $early=["]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["return "]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){throw $early=["]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["return "]);})]));
  2441. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);
  2442. ((($receiver = ((($receiver = self['@nestedBlocks']).klass === smalltalk.Number) ? $receiver >(0) : smalltalk.send($receiver, "__gt", [(0)]))).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["]})()"]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["]})()"]);})]));
  2443. return self;},
  2444. args: ["aNode"],
  2445. source: "visitReturnNode: aNode\x0a\x09nestedBlocks > 0 ifTrue: [\x0a\x09 earlyReturn := true].\x0a\x09nestedBlocks > 0\x0a\x09 ifTrue: [\x0a\x09\x09stream\x0a\x09\x09 nextPutAll: '(function(){throw $early=[']\x0a\x09 ifFalse: [stream nextPutAll: 'return '].\x0a\x09aNode nodes do: [:each |\x0a\x09 self visit: each].\x0a\x09nestedBlocks > 0 ifTrue: [\x0a\x09 stream nextPutAll: ']})()']",
  2446. messageSends: ["ifTrue:", ">", "ifTrue:ifFalse:", "nextPutAll:", "do:", "nodes", "visit:"],
  2447. referencedClasses: []
  2448. }),
  2449. smalltalk.FunCodeGenerator);
  2450. smalltalk.addMethod(
  2451. "_visitSendNode_",
  2452. smalltalk.method({
  2453. selector: "visitSendNode:",
  2454. category: 'visiting',
  2455. fn: function (aNode){
  2456. var self=this;
  2457. var str=nil;
  2458. var receiver=nil;
  2459. var superSend=nil;
  2460. var inlined=nil;
  2461. (str=self['@stream']);
  2462. ((($receiver = smalltalk.send(self['@messageSends'], "_includes_", [smalltalk.send(aNode, "_selector", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self['@messageSends'], "_add_", [smalltalk.send(aNode, "_selector", [])]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self['@messageSends'], "_add_", [smalltalk.send(aNode, "_selector", [])]);})]));
  2463. (self['@stream']=smalltalk.send("", "_writeStream", []));
  2464. smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_receiver", [])]);
  2465. (superSend=smalltalk.send(smalltalk.send(self['@stream'], "_contents", []), "__eq", ["super"]));
  2466. (receiver=((($receiver = superSend).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "self";})() : (function(){return smalltalk.send(self['@stream'], "_contents", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "self";}), (function(){return smalltalk.send(self['@stream'], "_contents", []);})])));
  2467. (self['@stream']=str);
  2468. ((($receiver = smalltalk.send(self, "_performOptimizations", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(self, "_inlineLiteral_receiverNode_argumentNodes_", [smalltalk.send(aNode, "_selector", []), smalltalk.send(aNode, "_receiver", []), smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return ((($receiver = smalltalk.send(self, "_inline_receiver_argumentNodes_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return ((($receiver = smalltalk.send(self, "_inline_receiver_argumentNodes_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));})]));})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return ((($receiver = smalltalk.send(self, "_inlineLiteral_receiverNode_argumentNodes_", [smalltalk.send(aNode, "_selector", []), smalltalk.send(aNode, "_receiver", []), smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return ((($receiver = smalltalk.send(self, "_inline_receiver_argumentNodes_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return ((($receiver = smalltalk.send(self, "_inline_receiver_argumentNodes_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));})]));}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));
  2469. return self;},
  2470. args: ["aNode"],
  2471. source: "visitSendNode: aNode\x0a | str receiver superSend inlined |\x0a str := stream.\x0a (messageSends includes: aNode selector) ifFalse: [\x0a messageSends add: aNode selector].\x0a stream := '' writeStream.\x0a self visit: aNode receiver.\x0a superSend := stream contents = 'super'.\x0a receiver := superSend ifTrue: ['self'] ifFalse: [stream contents].\x0a stream := str.\x0a\x09\x0a\x09self performOptimizations \x0a\x09\x09ifTrue: [\x0a\x09\x09\x09(self inlineLiteral: aNode selector receiverNode: aNode receiver argumentNodes: aNode arguments) ifFalse: [\x0a\x09\x09\x09\x09(self inline: aNode selector receiver: receiver argumentNodes: aNode arguments)\x0a \x09\x09\x09ifTrue: [stream nextPutAll: ' : ', (self send: aNode selector to: '$receiver' arguments: aNode arguments superSend: superSend), ')']\x0a \x09\x09\x09ifFalse: [stream nextPutAll: (self send: aNode selector to: receiver arguments: aNode arguments superSend: superSend)]]]\x0a\x09\x09ifFalse: [stream nextPutAll: (self send: aNode selector to: receiver arguments: aNode arguments superSend: superSend)]",
  2472. messageSends: ["ifFalse:", "includes:", "selector", "add:", "writeStream", "visit:", "receiver", "=", "contents", "ifTrue:ifFalse:", "performOptimizations", "inlineLiteral:receiverNode:argumentNodes:", "arguments", "inline:receiver:argumentNodes:", "nextPutAll:", ",", "send:to:arguments:superSend:"],
  2473. referencedClasses: []
  2474. }),
  2475. smalltalk.FunCodeGenerator);
  2476. smalltalk.addMethod(
  2477. "_visitSequenceNode_",
  2478. smalltalk.method({
  2479. selector: "visitSequenceNode:",
  2480. category: 'visiting',
  2481. fn: function (aNode){
  2482. var self=this;
  2483. smalltalk.send(smalltalk.send(aNode, "_temps", []), "_do_", [(function(each){var temp=nil;
  2484. (temp=smalltalk.send(self, "_safeVariableNameFor_", [each]));smalltalk.send(self['@tempVariables'], "_add_", [temp]);return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("var ", "__comma", [temp]), "__comma", ["=nil;"])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);})]);
  2485. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_separatedBy_", [(function(each){smalltalk.send(self, "_visit_", [each]);return smalltalk.send(self['@stream'], "_nextPutAll_", [";"]);}), (function(){return smalltalk.send(self['@stream'], "_lf", []);})]);
  2486. return self;},
  2487. args: ["aNode"],
  2488. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [:each || temp |\x0a temp := self safeVariableNameFor: each.\x0a\x09 tempVariables add: temp.\x0a\x09 stream nextPutAll: 'var ', temp, '=nil;'; lf].\x0a\x09aNode nodes do: [:each |\x0a\x09 self visit: each.\x0a\x09 stream nextPutAll: ';']\x0a\x09 separatedBy: [stream lf]",
  2489. messageSends: ["do:", "temps", "safeVariableNameFor:", "add:", "nextPutAll:", ",", "lf", "do:separatedBy:", "nodes", "visit:"],
  2490. referencedClasses: []
  2491. }),
  2492. smalltalk.FunCodeGenerator);
  2493. smalltalk.addMethod(
  2494. "_visitValueNode_",
  2495. smalltalk.method({
  2496. selector: "visitValueNode:",
  2497. category: 'visiting',
  2498. fn: function (aNode){
  2499. var self=this;
  2500. smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(aNode, "_value", []), "_asJavascript", [])]);
  2501. return self;},
  2502. args: ["aNode"],
  2503. source: "visitValueNode: aNode\x0a\x09stream nextPutAll: aNode value asJavascript",
  2504. messageSends: ["nextPutAll:", "asJavascript", "value"],
  2505. referencedClasses: []
  2506. }),
  2507. smalltalk.FunCodeGenerator);
  2508. smalltalk.addMethod(
  2509. "_visitVariableNode_",
  2510. smalltalk.method({
  2511. selector: "visitVariableNode:",
  2512. category: 'visiting',
  2513. fn: function (aNode){
  2514. var self=this;
  2515. var varName=nil;
  2516. ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(self, "_currentClass", []), "_allInstanceVariableNames", []), "_includes_", [smalltalk.send(aNode, "_value", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send("self['@", "__comma", [smalltalk.send(aNode, "_value", [])]), "__comma", ["']"])]);})() : (function(){(varName=smalltalk.send(self, "_safeVariableNameFor_", [smalltalk.send(aNode, "_value", [])]));return ((($receiver = smalltalk.send(smalltalk.send(self, "_knownVariables", []), "_includes_", [varName])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){smalltalk.send(self['@unknownVariables'], "_add_", [smalltalk.send(aNode, "_value", [])]);return ((($receiver = smalltalk.send(aNode, "_assigned", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})]));})() : (function(){return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_value", []), "__eq", ["thisContext"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})]));})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){smalltalk.send(self['@unknownVariables'], "_add_", [smalltalk.send(aNode, "_value", [])]);return ((($receiver = smalltalk.send(aNode, "_assigned", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})]));}), (function(){return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_value", []), "__eq", ["thisContext"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})]));})]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send("self['@", "__comma", [smalltalk.send(aNode, "_value", [])]), "__comma", ["']"])]);}), (function(){(varName=smalltalk.send(self, "_safeVariableNameFor_", [smalltalk.send(aNode, "_value", [])]));return ((($receiver = smalltalk.send(smalltalk.send(self, "_knownVariables", []), "_includes_", [varName])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){smalltalk.send(self['@unknownVariables'], "_add_", [smalltalk.send(aNode, "_value", [])]);return ((($receiver = smalltalk.send(aNode, "_assigned", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})]));})() : (function(){return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_value", []), "__eq", ["thisContext"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})]));})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){smalltalk.send(self['@unknownVariables'], "_add_", [smalltalk.send(aNode, "_value", [])]);return ((($receiver = smalltalk.send(aNode, "_assigned", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})]));}), (function(){return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_value", []), "__eq", ["thisContext"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})]));})]));})]));
  2517. return self;},
  2518. args: ["aNode"],
  2519. source: "visitVariableNode: aNode\x0a\x09| varName |\x0a\x09(self currentClass allInstanceVariableNames includes: aNode value) \x0a\x09\x09ifTrue: [stream nextPutAll: 'self[''@', aNode value, ''']']\x0a\x09\x09ifFalse: [\x0a \x09varName := self safeVariableNameFor: aNode value.\x0a\x09\x09\x09(self knownVariables includes: varName) \x0a \x09\x09ifFalse: [\x0a \x09unknownVariables add: aNode value.\x0a \x09aNode assigned \x0a \x09\x09ifTrue: [stream nextPutAll: varName]\x0a \x09\x09ifFalse: [stream nextPutAll: '(typeof ', varName, ' == ''undefined'' ? nil : ', varName, ')']]\x0a \x09\x09ifTrue: [\x0a \x09aNode value = 'thisContext'\x0a \x09\x09ifTrue: [stream nextPutAll: '(smalltalk.getThisContext())']\x0a \x09\x09\x09\x09ifFalse: [stream nextPutAll: varName]]]",
  2520. messageSends: ["ifTrue:ifFalse:", "includes:", "allInstanceVariableNames", "currentClass", "value", "nextPutAll:", ",", "safeVariableNameFor:", "ifFalse:ifTrue:", "knownVariables", "add:", "assigned", "="],
  2521. referencedClasses: []
  2522. }),
  2523. smalltalk.FunCodeGenerator);
  2524. smalltalk.FunCodeGenerator.klass.iVarNames = ['performOptimizations'];
  2525. smalltalk.addMethod(
  2526. "_performOptimizations",
  2527. smalltalk.method({
  2528. selector: "performOptimizations",
  2529. category: 'accessing',
  2530. fn: function (){
  2531. var self=this;
  2532. return (($receiver = self['@performOptimizations']) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver;
  2533. return self;},
  2534. args: [],
  2535. source: "performOptimizations\x0a\x09^performOptimizations ifNil: [true]",
  2536. messageSends: ["ifNil:"],
  2537. referencedClasses: []
  2538. }),
  2539. smalltalk.FunCodeGenerator.klass);
  2540. smalltalk.addMethod(
  2541. "_performOptimizations_",
  2542. smalltalk.method({
  2543. selector: "performOptimizations:",
  2544. category: 'accessing',
  2545. fn: function (aBoolean){
  2546. var self=this;
  2547. (self['@performOptimizations']=aBoolean);
  2548. return self;},
  2549. args: ["aBoolean"],
  2550. source: "performOptimizations: aBoolean\x0a\x09performOptimizations := aBoolean",
  2551. messageSends: [],
  2552. referencedClasses: []
  2553. }),
  2554. smalltalk.FunCodeGenerator.klass);