Compiler-IR.js 96 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612
  1. smalltalk.addPackage('Compiler-IR', {});
  2. smalltalk.addClass('IRASTTranslator', smalltalk.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  3. smalltalk.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.\x0aI rely on a builder object, instance of IRBuilder."
  4. smalltalk.addMethod(
  5. "_alias_",
  6. smalltalk.method({
  7. selector: "alias:",
  8. category: 'visiting',
  9. fn: function (aNode) {
  10. var self=this;
  11. var variable=nil;
  12. (variable=(function($rec){smalltalk.send($rec, "_variable_", [smalltalk.send(smalltalk.send((smalltalk.AliasVar || AliasVar), "_new", []), "_name_", [smalltalk.send("$", "__comma", [smalltalk.send(self, "_nextAlias", [])])])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRVariable || IRVariable), "_new", [])));
  13. smalltalk.send(smalltalk.send(self, "_sequence", []), "_add_", [(function($rec){smalltalk.send($rec, "_add_", [variable]);smalltalk.send($rec, "_add_", [smalltalk.send(self, "_visit_", [aNode])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRAlias || IRAlias), "_new", []))]);
  14. smalltalk.send(smalltalk.send(smalltalk.send(self, "_method", []), "_internalVariables", []), "_add_", [variable]);
  15. return variable;
  16. return self;},
  17. args: ["aNode"],
  18. source: "alias: aNode\x0a\x09| variable |\x0a\x09variable := IRVariable new \x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias); \x0a\x09\x09yourself.\x0a\x0a\x09self sequence add: (IRAlias new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  19. messageSends: ["variable:", "name:", "new", ",", "nextAlias", "yourself", "add:", "sequence", "visit:", "internalVariables", "method"],
  20. referencedClasses: ["AliasVar", "IRVariable", "IRAlias"]
  21. }),
  22. smalltalk.IRASTTranslator);
  23. smalltalk.addMethod(
  24. "_method",
  25. smalltalk.method({
  26. selector: "method",
  27. category: 'accessing',
  28. fn: function () {
  29. var self=this;
  30. return self['@method'];
  31. return self;},
  32. args: [],
  33. source: "method\x0a\x09^ method",
  34. messageSends: [],
  35. referencedClasses: []
  36. }),
  37. smalltalk.IRASTTranslator);
  38. smalltalk.addMethod(
  39. "_method_",
  40. smalltalk.method({
  41. selector: "method:",
  42. category: 'accessing',
  43. fn: function (anIRMethod) {
  44. var self=this;
  45. (self['@method']=anIRMethod);
  46. return self;},
  47. args: ["anIRMethod"],
  48. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  49. messageSends: [],
  50. referencedClasses: []
  51. }),
  52. smalltalk.IRASTTranslator);
  53. smalltalk.addMethod(
  54. "_nextAlias",
  55. smalltalk.method({
  56. selector: "nextAlias",
  57. category: 'accessing',
  58. fn: function () {
  59. var self=this;
  60. (($receiver = self['@nextAlias']) == nil || $receiver == undefined) ? (function(){return (self['@nextAlias']=(0));})() : $receiver;
  61. (self['@nextAlias']=((($receiver = self['@nextAlias']).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));
  62. return smalltalk.send(self['@nextAlias'], "_asString", []);
  63. return self;},
  64. args: [],
  65. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  66. messageSends: ["ifNil:", "+", "asString"],
  67. referencedClasses: []
  68. }),
  69. smalltalk.IRASTTranslator);
  70. smalltalk.addMethod(
  71. "_sequence",
  72. smalltalk.method({
  73. selector: "sequence",
  74. category: 'accessing',
  75. fn: function () {
  76. var self=this;
  77. return self['@sequence'];
  78. return self;},
  79. args: [],
  80. source: "sequence\x0a\x09^ sequence",
  81. messageSends: [],
  82. referencedClasses: []
  83. }),
  84. smalltalk.IRASTTranslator);
  85. smalltalk.addMethod(
  86. "_sequence_",
  87. smalltalk.method({
  88. selector: "sequence:",
  89. category: 'accessing',
  90. fn: function (anIRSequence) {
  91. var self=this;
  92. (self['@sequence']=anIRSequence);
  93. return self;},
  94. args: ["anIRSequence"],
  95. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  96. messageSends: [],
  97. referencedClasses: []
  98. }),
  99. smalltalk.IRASTTranslator);
  100. smalltalk.addMethod(
  101. "_source",
  102. smalltalk.method({
  103. selector: "source",
  104. category: 'accessing',
  105. fn: function () {
  106. var self=this;
  107. return self['@source'];
  108. return self;},
  109. args: [],
  110. source: "source\x0a\x09^ source",
  111. messageSends: [],
  112. referencedClasses: []
  113. }),
  114. smalltalk.IRASTTranslator);
  115. smalltalk.addMethod(
  116. "_source_",
  117. smalltalk.method({
  118. selector: "source:",
  119. category: 'accessing',
  120. fn: function (aString) {
  121. var self=this;
  122. (self['@source']=aString);
  123. return self;},
  124. args: ["aString"],
  125. source: "source: aString\x0a\x09source := aString",
  126. messageSends: [],
  127. referencedClasses: []
  128. }),
  129. smalltalk.IRASTTranslator);
  130. smalltalk.addMethod(
  131. "_theClass",
  132. smalltalk.method({
  133. selector: "theClass",
  134. category: 'accessing',
  135. fn: function () {
  136. var self=this;
  137. return self['@theClass'];
  138. return self;},
  139. args: [],
  140. source: "theClass\x0a\x09^ theClass",
  141. messageSends: [],
  142. referencedClasses: []
  143. }),
  144. smalltalk.IRASTTranslator);
  145. smalltalk.addMethod(
  146. "_theClass_",
  147. smalltalk.method({
  148. selector: "theClass:",
  149. category: 'accessing',
  150. fn: function (aClass) {
  151. var self=this;
  152. (self['@theClass']=aClass);
  153. return self;},
  154. args: ["aClass"],
  155. source: "theClass: aClass\x0a\x09theClass := aClass",
  156. messageSends: [],
  157. referencedClasses: []
  158. }),
  159. smalltalk.IRASTTranslator);
  160. smalltalk.addMethod(
  161. "_visitAssignmentNode_",
  162. smalltalk.method({
  163. selector: "visitAssignmentNode:",
  164. category: 'visiting',
  165. fn: function (aNode) {
  166. var self=this;
  167. var left=nil;
  168. var right=nil;
  169. ((($receiver = smalltalk.send(smalltalk.send(aNode, "_right", []), "_isAssignmentNode", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){var assignment=nil;
  170. (assignment=smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_right", [])]));smalltalk.send(smalltalk.send(self, "_sequence", []), "_add_", [assignment]);return (right=smalltalk.send(smalltalk.send(assignment, "_instructions", []), "_first", []));})() : (function(){return (right=smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_right", [])]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){var assignment=nil;
  171. (assignment=smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_right", [])]));smalltalk.send(smalltalk.send(self, "_sequence", []), "_add_", [assignment]);return (right=smalltalk.send(smalltalk.send(assignment, "_instructions", []), "_first", []));}), (function(){return (right=smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_right", [])]));})]));
  172. (left=smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_left", [])]));
  173. return (function($rec){smalltalk.send($rec, "_add_", [left]);smalltalk.send($rec, "_add_", [right]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRAssignment || IRAssignment), "_new", []));
  174. return self;},
  175. args: ["aNode"],
  176. source: "visitAssignmentNode: aNode\x0a\x09| left right |\x0a\x09\x0a\x09aNode right isAssignmentNode \x0a\x09\x09ifTrue: [ | assignment |\x0a\x09\x09\x09assignment := self visit: aNode right.\x0a\x09\x09\x09self sequence add: assignment.\x0a\x09\x09\x09right := assignment instructions first ]\x0a\x09\x09ifFalse: [ right := self visit: aNode right ].\x0a\x0a\x09left := self visit: aNode left.\x0a\x09\x0a\x09^ IRAssignment new \x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself",
  177. messageSends: ["ifTrue:ifFalse:", "isAssignmentNode", "right", "visit:", "add:", "sequence", "first", "instructions", "left", "yourself", "new"],
  178. referencedClasses: ["IRAssignment"]
  179. }),
  180. smalltalk.IRASTTranslator);
  181. smalltalk.addMethod(
  182. "_visitBlockNode_",
  183. smalltalk.method({
  184. selector: "visitBlockNode:",
  185. category: 'visiting',
  186. fn: function (aNode) {
  187. var self=this;
  188. var closure=nil;
  189. (closure=(function($rec){smalltalk.send($rec, "_arguments_", [smalltalk.send(aNode, "_parameters", [])]);smalltalk.send($rec, "_scope_", [smalltalk.send(aNode, "_scope", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRClosure || IRClosure), "_new", [])));
  190. smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_scope", []), "_temps", []), "_do_", [(function(each){return smalltalk.send(closure, "_add_", [(function($rec){smalltalk.send($rec, "_name_", [smalltalk.send(each, "_name", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRTempDeclaration || IRTempDeclaration), "_new", []))]);})]);
  191. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(closure, "_add_", [smalltalk.send(self, "_visit_", [each])]);})]);
  192. return closure;
  193. return self;},
  194. args: ["aNode"],
  195. source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself.\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09closure add: (IRTempDeclaration new \x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09yourself) ].\x0a\x09aNode nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
  196. messageSends: ["arguments:", "parameters", "scope:", "scope", "yourself", "new", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"],
  197. referencedClasses: ["IRClosure", "IRTempDeclaration"]
  198. }),
  199. smalltalk.IRASTTranslator);
  200. smalltalk.addMethod(
  201. "_visitBlockSequenceNode_",
  202. smalltalk.method({
  203. selector: "visitBlockSequenceNode:",
  204. category: 'visiting',
  205. fn: function (aNode) {
  206. var self=this;
  207. return smalltalk.send(self, "_withSequence_do_", [smalltalk.send((smalltalk.IRBlockSequence || IRBlockSequence), "_new", []), (function(){return smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(self, "_sequence", []), "_add_", [smalltalk.send(self, "_visit_", [each])]);})]);})]);
  208. return self;},
  209. args: ["aNode"],
  210. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [ aNode nodes do: [ :each | \x0a\x09\x09\x09self sequence add: (self visit: each) ]]",
  211. messageSends: ["withSequence:do:", "new", "do:", "nodes", "add:", "sequence", "visit:"],
  212. referencedClasses: ["IRBlockSequence"]
  213. }),
  214. smalltalk.IRASTTranslator);
  215. smalltalk.addMethod(
  216. "_visitCascadeNode_",
  217. smalltalk.method({
  218. selector: "visitCascadeNode:",
  219. category: 'visiting',
  220. fn: function (aNode) {
  221. var self=this;
  222. var alias=nil;
  223. ((($receiver = smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_isValueNode", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){(alias=smalltalk.send(self, "_alias_", [smalltalk.send(aNode, "_receiver", [])]));return smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(each, "_receiver_", [smalltalk.send(smalltalk.send((smalltalk.VariableNode || VariableNode), "_new", []), "_binding_", [smalltalk.send(alias, "_variable", [])])]);})]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){(alias=smalltalk.send(self, "_alias_", [smalltalk.send(aNode, "_receiver", [])]));return smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(each, "_receiver_", [smalltalk.send(smalltalk.send((smalltalk.VariableNode || VariableNode), "_new", []), "_binding_", [smalltalk.send(alias, "_variable", [])])]);})]);})]));
  224. smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_allButLast", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(self, "_sequence", []), "_add_", [smalltalk.send(self, "_visit_", [each])]);})]);
  225. return smalltalk.send(self, "_alias_", [smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_last", [])]);
  226. return self;},
  227. args: ["aNode"],
  228. source: "visitCascadeNode: aNode\x0a\x09| alias |\x0a\x0a\x09aNode receiver isValueNode ifFalse: [ \x0a\x09\x09alias := self alias: aNode receiver.\x0a\x09\x09aNode nodes do: [ :each |\x0a\x09\x09\x09each receiver: (VariableNode new binding: alias variable) ]].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self alias: aNode nodes last",
  229. messageSends: ["ifFalse:", "isValueNode", "receiver", "alias:", "do:", "nodes", "receiver:", "binding:", "new", "variable", "allButLast", "add:", "sequence", "visit:", "last"],
  230. referencedClasses: ["VariableNode"]
  231. }),
  232. smalltalk.IRASTTranslator);
  233. smalltalk.addMethod(
  234. "_visitJSStatementNode_",
  235. smalltalk.method({
  236. selector: "visitJSStatementNode:",
  237. category: 'visiting',
  238. fn: function (aNode) {
  239. var self=this;
  240. return (function($rec){smalltalk.send($rec, "_source_", [smalltalk.send(aNode, "_source", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRVerbatim || IRVerbatim), "_new", []));
  241. return self;},
  242. args: ["aNode"],
  243. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source;\x0a\x09\x09yourself",
  244. messageSends: ["source:", "source", "yourself", "new"],
  245. referencedClasses: ["IRVerbatim"]
  246. }),
  247. smalltalk.IRASTTranslator);
  248. smalltalk.addMethod(
  249. "_visitMethodNode_",
  250. smalltalk.method({
  251. selector: "visitMethodNode:",
  252. category: 'visiting',
  253. fn: function (aNode) {
  254. var self=this;
  255. smalltalk.send(self, "_method_", [(function($rec){smalltalk.send($rec, "_source_", [smalltalk.send(self, "_source", [])]);smalltalk.send($rec, "_arguments_", [smalltalk.send(aNode, "_arguments", [])]);smalltalk.send($rec, "_selector_", [smalltalk.send(aNode, "_selector", [])]);smalltalk.send($rec, "_messageSends_", [smalltalk.send(aNode, "_messageSends", [])]);smalltalk.send($rec, "_classReferences_", [smalltalk.send(aNode, "_classReferences", [])]);smalltalk.send($rec, "_scope_", [smalltalk.send(aNode, "_scope", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRMethod || IRMethod), "_new", []))]);
  256. smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_scope", []), "_temps", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(self, "_method", []), "_add_", [(function($rec){smalltalk.send($rec, "_name_", [smalltalk.send(each, "_name", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRTempDeclaration || IRTempDeclaration), "_new", []))]);})]);
  257. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(self, "_method", []), "_add_", [smalltalk.send(self, "_visit_", [each])]);})]);
  258. ((($receiver = smalltalk.send(smalltalk.send(aNode, "_scope", []), "_hasLocalReturn", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_method", []), "_add_", [smalltalk.send((smalltalk.IRReturn || IRReturn), "_new", [])]), "_add_", [(function($rec){smalltalk.send($rec, "_variable_", [smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_scope", []), "_pseudoVars", []), "_at_", ["self"])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRVariable || IRVariable), "_new", []))]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_method", []), "_add_", [smalltalk.send((smalltalk.IRReturn || IRReturn), "_new", [])]), "_add_", [(function($rec){smalltalk.send($rec, "_variable_", [smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_scope", []), "_pseudoVars", []), "_at_", ["self"])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRVariable || IRVariable), "_new", []))]);})]));
  259. return smalltalk.send(self, "_method", []);
  260. return self;},
  261. args: ["aNode"],
  262. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09messageSends: aNode messageSends;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode nodes do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [\x0a\x09\x09(self method add: IRReturn new) add: (IRVariable new\x0a\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09^ self method",
  263. messageSends: ["method:", "source:", "source", "arguments:", "arguments", "selector:", "selector", "messageSends:", "messageSends", "classReferences:", "classReferences", "scope:", "scope", "yourself", "new", "do:", "temps", "add:", "method", "name:", "name", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"],
  264. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable"]
  265. }),
  266. smalltalk.IRASTTranslator);
  267. smalltalk.addMethod(
  268. "_visitReturnNode_",
  269. smalltalk.method({
  270. selector: "visitReturnNode:",
  271. category: 'visiting',
  272. fn: function (aNode) {
  273. var self=this;
  274. var return_=nil;
  275. (return_=((($receiver = smalltalk.send(aNode, "_nonLocalReturn", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send((smalltalk.IRNonLocalReturn || IRNonLocalReturn), "_new", []);})() : (function(){return smalltalk.send((smalltalk.IRReturn || IRReturn), "_new", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send((smalltalk.IRNonLocalReturn || IRNonLocalReturn), "_new", []);}), (function(){return smalltalk.send((smalltalk.IRReturn || IRReturn), "_new", []);})])));
  276. smalltalk.send(return_, "_scope_", [smalltalk.send(aNode, "_scope", [])]);
  277. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(return_, "_add_", [smalltalk.send(self, "_visit_", [each])]);})]);
  278. return return_;
  279. return self;},
  280. args: ["aNode"],
  281. source: "visitReturnNode: aNode\x0a\x09| return |\x0a\x09return := aNode nonLocalReturn \x0a\x09\x09ifTrue: [ IRNonLocalReturn new ]\x0a\x09\x09ifFalse: [ IRReturn new ].\x0a\x09return scope: aNode scope.\x0a\x09aNode nodes do: [ :each | return add: (self visit: each) ].\x0a\x09^ return",
  282. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "visit:"],
  283. referencedClasses: ["IRNonLocalReturn", "IRReturn"]
  284. }),
  285. smalltalk.IRASTTranslator);
  286. smalltalk.addMethod(
  287. "_visitSendNode_",
  288. smalltalk.method({
  289. selector: "visitSendNode:",
  290. category: 'visiting',
  291. fn: function (aNode) {
  292. var self=this;
  293. var send=nil;
  294. var receiver=nil;
  295. var arguments=nil;
  296. (send=smalltalk.send((smalltalk.IRSend || IRSend), "_new", []));
  297. (function($rec){smalltalk.send($rec, "_selector_", [smalltalk.send(aNode, "_selector", [])]);return smalltalk.send($rec, "_index_", [smalltalk.send(aNode, "_index", [])]);})(send);
  298. ((($receiver = smalltalk.send(aNode, "_superSend", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(send, "_classSend_", [smalltalk.send(smalltalk.send(self, "_theClass", []), "_superclass", [])]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(send, "_classSend_", [smalltalk.send(smalltalk.send(self, "_theClass", []), "_superclass", [])]);})]));
  299. (receiver=smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_receiver", [])]));
  300. (arguments=smalltalk.send(smalltalk.send(aNode, "_arguments", []), "_collect_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]));
  301. smalltalk.send(send, "_add_", [receiver]);
  302. smalltalk.send(arguments, "_do_", [(function(each){return smalltalk.send(send, "_add_", [each]);})]);
  303. return send;
  304. return self;},
  305. args: ["aNode"],
  306. source: "visitSendNode: aNode\x0a\x09| send receiver arguments |\x0a\x09send := IRSend new.\x0a\x09send \x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09aNode superSend ifTrue: [ send classSend: self theClass superclass ].\x0a\x0a\x09receiver := self visit: aNode receiver.\x0a\x09arguments := aNode arguments collect: [ :each | self visit: each ].\x0a\x0a\x09send add: receiver.\x0a\x09arguments do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  307. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "visit:", "receiver", "collect:", "arguments", "add:", "do:"],
  308. referencedClasses: ["IRSend"]
  309. }),
  310. smalltalk.IRASTTranslator);
  311. smalltalk.addMethod(
  312. "_visitSequenceNode_",
  313. smalltalk.method({
  314. selector: "visitSequenceNode:",
  315. category: 'visiting',
  316. fn: function (aNode) {
  317. var self=this;
  318. return smalltalk.send(self, "_withSequence_do_", [smalltalk.send((smalltalk.IRSequence || IRSequence), "_new", []), (function(){return smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){var instruction=nil;
  319. (instruction=smalltalk.send(self, "_visit_", [each]));return ((($receiver = smalltalk.send(instruction, "_isVariable", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_sequence", []), "_add_", [instruction]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_sequence", []), "_add_", [instruction]);})]));})]);})]);
  320. return self;},
  321. args: ["aNode"],
  322. source: "visitSequenceNode: aNode\x0a\x09^ self \x0a\x09\x09withSequence: IRSequence new \x09\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visit: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ]]]",
  323. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visit:", "ifFalse:", "isVariable", "add:", "sequence"],
  324. referencedClasses: ["IRSequence"]
  325. }),
  326. smalltalk.IRASTTranslator);
  327. smalltalk.addMethod(
  328. "_visitValueNode_",
  329. smalltalk.method({
  330. selector: "visitValueNode:",
  331. category: 'visiting',
  332. fn: function (aNode) {
  333. var self=this;
  334. return (function($rec){smalltalk.send($rec, "_value_", [smalltalk.send(aNode, "_value", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRValue || IRValue), "_new", []));
  335. return self;},
  336. args: ["aNode"],
  337. source: "visitValueNode: aNode\x0a\x09^ IRValue new \x0a\x09\x09value: aNode value; \x0a\x09\x09yourself",
  338. messageSends: ["value:", "value", "yourself", "new"],
  339. referencedClasses: ["IRValue"]
  340. }),
  341. smalltalk.IRASTTranslator);
  342. smalltalk.addMethod(
  343. "_visitVariableNode_",
  344. smalltalk.method({
  345. selector: "visitVariableNode:",
  346. category: 'visiting',
  347. fn: function (aNode) {
  348. var self=this;
  349. return (function($rec){smalltalk.send($rec, "_variable_", [smalltalk.send(aNode, "_binding", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRVariable || IRVariable), "_new", []));
  350. return self;},
  351. args: ["aNode"],
  352. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new \x0a\x09\x09variable: aNode binding; \x0a\x09\x09yourself",
  353. messageSends: ["variable:", "binding", "yourself", "new"],
  354. referencedClasses: ["IRVariable"]
  355. }),
  356. smalltalk.IRASTTranslator);
  357. smalltalk.addMethod(
  358. "_withSequence_do_",
  359. smalltalk.method({
  360. selector: "withSequence:do:",
  361. category: 'accessing',
  362. fn: function (aSequence, aBlock) {
  363. var self=this;
  364. var outerSequence=nil;
  365. (outerSequence=smalltalk.send(self, "_sequence", []));
  366. smalltalk.send(self, "_sequence_", [aSequence]);
  367. smalltalk.send(aBlock, "_value", []);
  368. smalltalk.send(self, "_sequence_", [outerSequence]);
  369. return aSequence;
  370. return self;},
  371. args: ["aSequence", "aBlock"],
  372. source: "withSequence: aSequence do: aBlock\x0a\x09| outerSequence |\x0a\x09outerSequence := self sequence.\x0a\x09self sequence: aSequence.\x0a\x09aBlock value.\x0a\x09self sequence: outerSequence.\x0a\x09^ aSequence",
  373. messageSends: ["sequence", "sequence:", "value"],
  374. referencedClasses: []
  375. }),
  376. smalltalk.IRASTTranslator);
  377. smalltalk.addClass('IRInstruction', smalltalk.Object, ['parent', 'instructions'], 'Compiler-IR');
  378. smalltalk.IRInstruction.comment="I am the abstract root class of the IR (intermediate representation) instructions class hierarchy.\x0aThe IR graph is used to emit JavaScript code using a JSStream. "
  379. smalltalk.addMethod(
  380. "_accept_",
  381. smalltalk.method({
  382. selector: "accept:",
  383. category: 'visiting',
  384. fn: function (aVisitor) {
  385. var self=this;
  386. return smalltalk.send(aVisitor, "_visitIRInstruction_", [self]);
  387. return self;},
  388. args: ["aVisitor"],
  389. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  390. messageSends: ["visitIRInstruction:"],
  391. referencedClasses: []
  392. }),
  393. smalltalk.IRInstruction);
  394. smalltalk.addMethod(
  395. "_add_",
  396. smalltalk.method({
  397. selector: "add:",
  398. category: 'building',
  399. fn: function (anObject) {
  400. var self=this;
  401. smalltalk.send(anObject, "_parent_", [self]);
  402. return smalltalk.send(smalltalk.send(self, "_instructions", []), "_add_", [anObject]);
  403. return self;},
  404. args: ["anObject"],
  405. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  406. messageSends: ["parent:", "add:", "instructions"],
  407. referencedClasses: []
  408. }),
  409. smalltalk.IRInstruction);
  410. smalltalk.addMethod(
  411. "_canBeAssigned",
  412. smalltalk.method({
  413. selector: "canBeAssigned",
  414. category: 'testing',
  415. fn: function () {
  416. var self=this;
  417. return true;
  418. return self;},
  419. args: [],
  420. source: "canBeAssigned\x0a\x09^ true",
  421. messageSends: [],
  422. referencedClasses: []
  423. }),
  424. smalltalk.IRInstruction);
  425. smalltalk.addMethod(
  426. "_instructions",
  427. smalltalk.method({
  428. selector: "instructions",
  429. category: 'accessing',
  430. fn: function () {
  431. var self=this;
  432. return (($receiver = self['@instructions']) == nil || $receiver == undefined) ? (function(){return (self['@instructions']=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection), "_new", []));})() : $receiver;
  433. return self;},
  434. args: [],
  435. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  436. messageSends: ["ifNil:", "new"],
  437. referencedClasses: ["OrderedCollection"]
  438. }),
  439. smalltalk.IRInstruction);
  440. smalltalk.addMethod(
  441. "_isClosure",
  442. smalltalk.method({
  443. selector: "isClosure",
  444. category: 'testing',
  445. fn: function () {
  446. var self=this;
  447. return false;
  448. return self;},
  449. args: [],
  450. source: "isClosure\x0a\x09^ false",
  451. messageSends: [],
  452. referencedClasses: []
  453. }),
  454. smalltalk.IRInstruction);
  455. smalltalk.addMethod(
  456. "_isInlined",
  457. smalltalk.method({
  458. selector: "isInlined",
  459. category: 'testing',
  460. fn: function () {
  461. var self=this;
  462. return false;
  463. return self;},
  464. args: [],
  465. source: "isInlined\x0a\x09^ false",
  466. messageSends: [],
  467. referencedClasses: []
  468. }),
  469. smalltalk.IRInstruction);
  470. smalltalk.addMethod(
  471. "_isReturn",
  472. smalltalk.method({
  473. selector: "isReturn",
  474. category: 'testing',
  475. fn: function () {
  476. var self=this;
  477. return false;
  478. return self;},
  479. args: [],
  480. source: "isReturn\x0a\x09^ false",
  481. messageSends: [],
  482. referencedClasses: []
  483. }),
  484. smalltalk.IRInstruction);
  485. smalltalk.addMethod(
  486. "_isSend",
  487. smalltalk.method({
  488. selector: "isSend",
  489. category: 'testing',
  490. fn: function () {
  491. var self=this;
  492. return false;
  493. return self;},
  494. args: [],
  495. source: "isSend\x0a\x09^ false",
  496. messageSends: [],
  497. referencedClasses: []
  498. }),
  499. smalltalk.IRInstruction);
  500. smalltalk.addMethod(
  501. "_isVariable",
  502. smalltalk.method({
  503. selector: "isVariable",
  504. category: 'testing',
  505. fn: function () {
  506. var self=this;
  507. return false;
  508. return self;},
  509. args: [],
  510. source: "isVariable\x0a\x09^ false",
  511. messageSends: [],
  512. referencedClasses: []
  513. }),
  514. smalltalk.IRInstruction);
  515. smalltalk.addMethod(
  516. "_parent",
  517. smalltalk.method({
  518. selector: "parent",
  519. category: 'accessing',
  520. fn: function () {
  521. var self=this;
  522. return self['@parent'];
  523. return self;},
  524. args: [],
  525. source: "parent\x0a\x09^ parent",
  526. messageSends: [],
  527. referencedClasses: []
  528. }),
  529. smalltalk.IRInstruction);
  530. smalltalk.addMethod(
  531. "_parent_",
  532. smalltalk.method({
  533. selector: "parent:",
  534. category: 'accessing',
  535. fn: function (anIRInstruction) {
  536. var self=this;
  537. (self['@parent']=anIRInstruction);
  538. return self;},
  539. args: ["anIRInstruction"],
  540. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  541. messageSends: [],
  542. referencedClasses: []
  543. }),
  544. smalltalk.IRInstruction);
  545. smalltalk.addMethod(
  546. "_remove",
  547. smalltalk.method({
  548. selector: "remove",
  549. category: 'building',
  550. fn: function () {
  551. var self=this;
  552. smalltalk.send(smalltalk.send(self, "_parent", []), "_remove_", [self]);
  553. return self;},
  554. args: [],
  555. source: "remove\x0a\x09self parent remove: self",
  556. messageSends: ["remove:", "parent"],
  557. referencedClasses: []
  558. }),
  559. smalltalk.IRInstruction);
  560. smalltalk.addMethod(
  561. "_remove_",
  562. smalltalk.method({
  563. selector: "remove:",
  564. category: 'building',
  565. fn: function (anIRInstruction) {
  566. var self=this;
  567. smalltalk.send(smalltalk.send(self, "_instructions", []), "_remove_", [anIRInstruction]);
  568. return self;},
  569. args: ["anIRInstruction"],
  570. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  571. messageSends: ["remove:", "instructions"],
  572. referencedClasses: []
  573. }),
  574. smalltalk.IRInstruction);
  575. smalltalk.addMethod(
  576. "_replace_with_",
  577. smalltalk.method({
  578. selector: "replace:with:",
  579. category: 'building',
  580. fn: function (anIRInstruction, anotherIRInstruction) {
  581. var self=this;
  582. smalltalk.send(anotherIRInstruction, "_parent_", [self]);
  583. smalltalk.send(smalltalk.send(self, "_instructions", []), "_at_put_", [smalltalk.send(smalltalk.send(self, "_instructions", []), "_indexOf_", [anIRInstruction]), anotherIRInstruction]);
  584. return self;},
  585. args: ["anIRInstruction", "anotherIRInstruction"],
  586. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions \x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  587. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"],
  588. referencedClasses: []
  589. }),
  590. smalltalk.IRInstruction);
  591. smalltalk.addMethod(
  592. "_replaceWith_",
  593. smalltalk.method({
  594. selector: "replaceWith:",
  595. category: 'building',
  596. fn: function (anIRInstruction) {
  597. var self=this;
  598. smalltalk.send(smalltalk.send(self, "_parent", []), "_replace_with_", [self, anIRInstruction]);
  599. return self;},
  600. args: ["anIRInstruction"],
  601. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  602. messageSends: ["replace:with:", "parent"],
  603. referencedClasses: []
  604. }),
  605. smalltalk.IRInstruction);
  606. smalltalk.addMethod(
  607. "_on_",
  608. smalltalk.method({
  609. selector: "on:",
  610. category: 'instance creation',
  611. fn: function (aBuilder) {
  612. var self=this;
  613. return (function($rec){smalltalk.send($rec, "_builder_", [aBuilder]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  614. return self;},
  615. args: ["aBuilder"],
  616. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  617. messageSends: ["builder:", "yourself", "new"],
  618. referencedClasses: []
  619. }),
  620. smalltalk.IRInstruction.klass);
  621. smalltalk.addClass('IRAssignment', smalltalk.IRInstruction, [], 'Compiler-IR');
  622. smalltalk.addMethod(
  623. "_accept_",
  624. smalltalk.method({
  625. selector: "accept:",
  626. category: 'visiting',
  627. fn: function (aVisitor) {
  628. var self=this;
  629. return smalltalk.send(aVisitor, "_visitIRAssignment_", [self]);
  630. return self;},
  631. args: ["aVisitor"],
  632. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  633. messageSends: ["visitIRAssignment:"],
  634. referencedClasses: []
  635. }),
  636. smalltalk.IRAssignment);
  637. smalltalk.addClass('IRAlias', smalltalk.IRAssignment, [], 'Compiler-IR');
  638. smalltalk.addMethod(
  639. "_accept_",
  640. smalltalk.method({
  641. selector: "accept:",
  642. category: 'visiting',
  643. fn: function (aVisitor) {
  644. var self=this;
  645. return smalltalk.send(aVisitor, "_visitIRAlias_", [self]);
  646. return self;},
  647. args: ["aVisitor"],
  648. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAlias: self",
  649. messageSends: ["visitIRAlias:"],
  650. referencedClasses: []
  651. }),
  652. smalltalk.IRAlias);
  653. smalltalk.addClass('IRScopedInstruction', smalltalk.IRInstruction, ['scope'], 'Compiler-IR');
  654. smalltalk.addMethod(
  655. "_scope",
  656. smalltalk.method({
  657. selector: "scope",
  658. category: 'accessing',
  659. fn: function () {
  660. var self=this;
  661. return self['@scope'];
  662. return self;},
  663. args: [],
  664. source: "scope\x0a\x09^ scope",
  665. messageSends: [],
  666. referencedClasses: []
  667. }),
  668. smalltalk.IRScopedInstruction);
  669. smalltalk.addMethod(
  670. "_scope_",
  671. smalltalk.method({
  672. selector: "scope:",
  673. category: 'accessing',
  674. fn: function (aScope) {
  675. var self=this;
  676. (self['@scope']=aScope);
  677. return self;},
  678. args: ["aScope"],
  679. source: "scope: aScope\x0a\x09scope := aScope",
  680. messageSends: [],
  681. referencedClasses: []
  682. }),
  683. smalltalk.IRScopedInstruction);
  684. smalltalk.addClass('IRClosure', smalltalk.IRScopedInstruction, ['arguments'], 'Compiler-IR');
  685. smalltalk.addMethod(
  686. "_accept_",
  687. smalltalk.method({
  688. selector: "accept:",
  689. category: 'visiting',
  690. fn: function (aVisitor) {
  691. var self=this;
  692. return smalltalk.send(aVisitor, "_visitIRClosure_", [self]);
  693. return self;},
  694. args: ["aVisitor"],
  695. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  696. messageSends: ["visitIRClosure:"],
  697. referencedClasses: []
  698. }),
  699. smalltalk.IRClosure);
  700. smalltalk.addMethod(
  701. "_arguments",
  702. smalltalk.method({
  703. selector: "arguments",
  704. category: 'accessing',
  705. fn: function () {
  706. var self=this;
  707. return (($receiver = self['@arguments']) == nil || $receiver == undefined) ? (function(){return [];})() : $receiver;
  708. return self;},
  709. args: [],
  710. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  711. messageSends: ["ifNil:"],
  712. referencedClasses: []
  713. }),
  714. smalltalk.IRClosure);
  715. smalltalk.addMethod(
  716. "_arguments_",
  717. smalltalk.method({
  718. selector: "arguments:",
  719. category: 'accessing',
  720. fn: function (aCollection) {
  721. var self=this;
  722. (self['@arguments']=aCollection);
  723. return self;},
  724. args: ["aCollection"],
  725. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  726. messageSends: [],
  727. referencedClasses: []
  728. }),
  729. smalltalk.IRClosure);
  730. smalltalk.addMethod(
  731. "_isClosure",
  732. smalltalk.method({
  733. selector: "isClosure",
  734. category: 'testing',
  735. fn: function () {
  736. var self=this;
  737. return true;
  738. return self;},
  739. args: [],
  740. source: "isClosure\x0a\x09^ true",
  741. messageSends: [],
  742. referencedClasses: []
  743. }),
  744. smalltalk.IRClosure);
  745. smalltalk.addMethod(
  746. "_scope_",
  747. smalltalk.method({
  748. selector: "scope:",
  749. category: 'accessing',
  750. fn: function (aScope) {
  751. var self=this;
  752. smalltalk.send(self, "_scope_", [aScope], smalltalk.IRClosure.superclass || nil);
  753. smalltalk.send(aScope, "_instruction_", [self]);
  754. return self;},
  755. args: ["aScope"],
  756. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  757. messageSends: ["scope:", "instruction:"],
  758. referencedClasses: []
  759. }),
  760. smalltalk.IRClosure);
  761. smalltalk.addClass('IRMethod', smalltalk.IRScopedInstruction, ['source', 'selector', 'classReferences', 'messageSends', 'arguments', 'internalVariables'], 'Compiler-IR');
  762. smalltalk.IRMethod.comment="I am a method instruction"
  763. smalltalk.addMethod(
  764. "_accept_",
  765. smalltalk.method({
  766. selector: "accept:",
  767. category: 'visiting',
  768. fn: function (aVisitor) {
  769. var self=this;
  770. return smalltalk.send(aVisitor, "_visitIRMethod_", [self]);
  771. return self;},
  772. args: ["aVisitor"],
  773. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  774. messageSends: ["visitIRMethod:"],
  775. referencedClasses: []
  776. }),
  777. smalltalk.IRMethod);
  778. smalltalk.addMethod(
  779. "_arguments",
  780. smalltalk.method({
  781. selector: "arguments",
  782. category: 'accessing',
  783. fn: function () {
  784. var self=this;
  785. return self['@arguments'];
  786. return self;},
  787. args: [],
  788. source: "arguments\x0a\x09^ arguments",
  789. messageSends: [],
  790. referencedClasses: []
  791. }),
  792. smalltalk.IRMethod);
  793. smalltalk.addMethod(
  794. "_arguments_",
  795. smalltalk.method({
  796. selector: "arguments:",
  797. category: 'accessing',
  798. fn: function (aCollection) {
  799. var self=this;
  800. (self['@arguments']=aCollection);
  801. return self;},
  802. args: ["aCollection"],
  803. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  804. messageSends: [],
  805. referencedClasses: []
  806. }),
  807. smalltalk.IRMethod);
  808. smalltalk.addMethod(
  809. "_classReferences",
  810. smalltalk.method({
  811. selector: "classReferences",
  812. category: 'accessing',
  813. fn: function () {
  814. var self=this;
  815. return self['@classReferences'];
  816. return self;},
  817. args: [],
  818. source: "classReferences\x0a\x09^ classReferences",
  819. messageSends: [],
  820. referencedClasses: []
  821. }),
  822. smalltalk.IRMethod);
  823. smalltalk.addMethod(
  824. "_classReferences_",
  825. smalltalk.method({
  826. selector: "classReferences:",
  827. category: 'accessing',
  828. fn: function (aCollection) {
  829. var self=this;
  830. (self['@classReferences']=aCollection);
  831. return self;},
  832. args: ["aCollection"],
  833. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  834. messageSends: [],
  835. referencedClasses: []
  836. }),
  837. smalltalk.IRMethod);
  838. smalltalk.addMethod(
  839. "_internalVariables",
  840. smalltalk.method({
  841. selector: "internalVariables",
  842. category: 'accessing',
  843. fn: function () {
  844. var self=this;
  845. return (($receiver = self['@internalVariables']) == nil || $receiver == undefined) ? (function(){return (self['@internalVariables']=smalltalk.send((smalltalk.Set || Set), "_new", []));})() : $receiver;
  846. return self;},
  847. args: [],
  848. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  849. messageSends: ["ifNil:", "new"],
  850. referencedClasses: ["Set"]
  851. }),
  852. smalltalk.IRMethod);
  853. smalltalk.addMethod(
  854. "_messageSends",
  855. smalltalk.method({
  856. selector: "messageSends",
  857. category: 'accessing',
  858. fn: function () {
  859. var self=this;
  860. return self['@messageSends'];
  861. return self;},
  862. args: [],
  863. source: "messageSends\x0a\x09^ messageSends",
  864. messageSends: [],
  865. referencedClasses: []
  866. }),
  867. smalltalk.IRMethod);
  868. smalltalk.addMethod(
  869. "_messageSends_",
  870. smalltalk.method({
  871. selector: "messageSends:",
  872. category: 'accessing',
  873. fn: function (aCollection) {
  874. var self=this;
  875. (self['@messageSends']=aCollection);
  876. return self;},
  877. args: ["aCollection"],
  878. source: "messageSends: aCollection\x0a\x09messageSends := aCollection",
  879. messageSends: [],
  880. referencedClasses: []
  881. }),
  882. smalltalk.IRMethod);
  883. smalltalk.addMethod(
  884. "_scope_",
  885. smalltalk.method({
  886. selector: "scope:",
  887. category: 'accessing',
  888. fn: function (aScope) {
  889. var self=this;
  890. smalltalk.send(self, "_scope_", [aScope], smalltalk.IRMethod.superclass || nil);
  891. smalltalk.send(aScope, "_instruction_", [self]);
  892. return self;},
  893. args: ["aScope"],
  894. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  895. messageSends: ["scope:", "instruction:"],
  896. referencedClasses: []
  897. }),
  898. smalltalk.IRMethod);
  899. smalltalk.addMethod(
  900. "_selector",
  901. smalltalk.method({
  902. selector: "selector",
  903. category: 'accessing',
  904. fn: function () {
  905. var self=this;
  906. return self['@selector'];
  907. return self;},
  908. args: [],
  909. source: "selector\x0a\x09^ selector",
  910. messageSends: [],
  911. referencedClasses: []
  912. }),
  913. smalltalk.IRMethod);
  914. smalltalk.addMethod(
  915. "_selector_",
  916. smalltalk.method({
  917. selector: "selector:",
  918. category: 'accessing',
  919. fn: function (aString) {
  920. var self=this;
  921. (self['@selector']=aString);
  922. return self;},
  923. args: ["aString"],
  924. source: "selector: aString\x0a\x09selector := aString",
  925. messageSends: [],
  926. referencedClasses: []
  927. }),
  928. smalltalk.IRMethod);
  929. smalltalk.addMethod(
  930. "_source",
  931. smalltalk.method({
  932. selector: "source",
  933. category: 'accessing',
  934. fn: function () {
  935. var self=this;
  936. return self['@source'];
  937. return self;},
  938. args: [],
  939. source: "source\x0a\x09^ source",
  940. messageSends: [],
  941. referencedClasses: []
  942. }),
  943. smalltalk.IRMethod);
  944. smalltalk.addMethod(
  945. "_source_",
  946. smalltalk.method({
  947. selector: "source:",
  948. category: 'accessing',
  949. fn: function (aString) {
  950. var self=this;
  951. (self['@source']=aString);
  952. return self;},
  953. args: ["aString"],
  954. source: "source: aString\x0a\x09source := aString",
  955. messageSends: [],
  956. referencedClasses: []
  957. }),
  958. smalltalk.IRMethod);
  959. smalltalk.addClass('IRReturn', smalltalk.IRScopedInstruction, [], 'Compiler-IR');
  960. smalltalk.IRReturn.comment="I am a local return instruction."
  961. smalltalk.addMethod(
  962. "_accept_",
  963. smalltalk.method({
  964. selector: "accept:",
  965. category: 'visiting',
  966. fn: function (aVisitor) {
  967. var self=this;
  968. return smalltalk.send(aVisitor, "_visitIRReturn_", [self]);
  969. return self;},
  970. args: ["aVisitor"],
  971. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  972. messageSends: ["visitIRReturn:"],
  973. referencedClasses: []
  974. }),
  975. smalltalk.IRReturn);
  976. smalltalk.addMethod(
  977. "_canBeAssigned",
  978. smalltalk.method({
  979. selector: "canBeAssigned",
  980. category: 'testing',
  981. fn: function () {
  982. var self=this;
  983. return false;
  984. return self;},
  985. args: [],
  986. source: "canBeAssigned\x0a\x09^ false",
  987. messageSends: [],
  988. referencedClasses: []
  989. }),
  990. smalltalk.IRReturn);
  991. smalltalk.addMethod(
  992. "_isReturn",
  993. smalltalk.method({
  994. selector: "isReturn",
  995. category: 'testing',
  996. fn: function () {
  997. var self=this;
  998. return true;
  999. return self;},
  1000. args: [],
  1001. source: "isReturn\x0a\x09^ true",
  1002. messageSends: [],
  1003. referencedClasses: []
  1004. }),
  1005. smalltalk.IRReturn);
  1006. smalltalk.addClass('IRNonLocalReturn', smalltalk.IRReturn, [], 'Compiler-IR');
  1007. smalltalk.IRNonLocalReturn.comment="I am a non local return instruction.\x0aNon local returns are handled using a try/catch JS statement.\x0a\x0aSee IRNonLocalReturnHandling class"
  1008. smalltalk.addMethod(
  1009. "_accept_",
  1010. smalltalk.method({
  1011. selector: "accept:",
  1012. category: 'visiting',
  1013. fn: function (aVisitor) {
  1014. var self=this;
  1015. return smalltalk.send(aVisitor, "_visitIRNonLocalReturn_", [self]);
  1016. return self;},
  1017. args: ["aVisitor"],
  1018. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  1019. messageSends: ["visitIRNonLocalReturn:"],
  1020. referencedClasses: []
  1021. }),
  1022. smalltalk.IRNonLocalReturn);
  1023. smalltalk.addClass('IRSend', smalltalk.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  1024. smalltalk.IRSend.comment="I am a message send instruction. "
  1025. smalltalk.addMethod(
  1026. "_accept_",
  1027. smalltalk.method({
  1028. selector: "accept:",
  1029. category: 'visiting',
  1030. fn: function (aVisitor) {
  1031. var self=this;
  1032. return smalltalk.send(aVisitor, "_visitIRSend_", [self]);
  1033. return self;},
  1034. args: ["aVisitor"],
  1035. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  1036. messageSends: ["visitIRSend:"],
  1037. referencedClasses: []
  1038. }),
  1039. smalltalk.IRSend);
  1040. smalltalk.addMethod(
  1041. "_classSend",
  1042. smalltalk.method({
  1043. selector: "classSend",
  1044. category: 'accessing',
  1045. fn: function () {
  1046. var self=this;
  1047. return self['@classSend'];
  1048. return self;},
  1049. args: [],
  1050. source: "classSend\x0a\x09^ classSend",
  1051. messageSends: [],
  1052. referencedClasses: []
  1053. }),
  1054. smalltalk.IRSend);
  1055. smalltalk.addMethod(
  1056. "_classSend_",
  1057. smalltalk.method({
  1058. selector: "classSend:",
  1059. category: 'accessing',
  1060. fn: function (aClass) {
  1061. var self=this;
  1062. (self['@classSend']=aClass);
  1063. return self;},
  1064. args: ["aClass"],
  1065. source: "classSend: aClass\x0a\x09classSend := aClass",
  1066. messageSends: [],
  1067. referencedClasses: []
  1068. }),
  1069. smalltalk.IRSend);
  1070. smalltalk.addMethod(
  1071. "_index",
  1072. smalltalk.method({
  1073. selector: "index",
  1074. category: 'accessing',
  1075. fn: function () {
  1076. var self=this;
  1077. return self['@index'];
  1078. return self;},
  1079. args: [],
  1080. source: "index\x0a\x09^ index",
  1081. messageSends: [],
  1082. referencedClasses: []
  1083. }),
  1084. smalltalk.IRSend);
  1085. smalltalk.addMethod(
  1086. "_index_",
  1087. smalltalk.method({
  1088. selector: "index:",
  1089. category: 'accessing',
  1090. fn: function (anInteger) {
  1091. var self=this;
  1092. (self['@index']=anInteger);
  1093. return self;},
  1094. args: ["anInteger"],
  1095. source: "index: anInteger\x0a\x09index := anInteger",
  1096. messageSends: [],
  1097. referencedClasses: []
  1098. }),
  1099. smalltalk.IRSend);
  1100. smalltalk.addMethod(
  1101. "_isSend",
  1102. smalltalk.method({
  1103. selector: "isSend",
  1104. category: 'testing',
  1105. fn: function () {
  1106. var self=this;
  1107. return true;
  1108. return self;},
  1109. args: [],
  1110. source: "isSend\x0a\x09^ true",
  1111. messageSends: [],
  1112. referencedClasses: []
  1113. }),
  1114. smalltalk.IRSend);
  1115. smalltalk.addMethod(
  1116. "_selector",
  1117. smalltalk.method({
  1118. selector: "selector",
  1119. category: 'accessing',
  1120. fn: function () {
  1121. var self=this;
  1122. return self['@selector'];
  1123. return self;},
  1124. args: [],
  1125. source: "selector\x0a\x09^ selector",
  1126. messageSends: [],
  1127. referencedClasses: []
  1128. }),
  1129. smalltalk.IRSend);
  1130. smalltalk.addMethod(
  1131. "_selector_",
  1132. smalltalk.method({
  1133. selector: "selector:",
  1134. category: 'accessing',
  1135. fn: function (aString) {
  1136. var self=this;
  1137. (self['@selector']=aString);
  1138. return self;},
  1139. args: ["aString"],
  1140. source: "selector: aString\x0a\x09selector := aString",
  1141. messageSends: [],
  1142. referencedClasses: []
  1143. }),
  1144. smalltalk.IRSend);
  1145. smalltalk.addClass('IRSequence', smalltalk.IRInstruction, [], 'Compiler-IR');
  1146. smalltalk.addMethod(
  1147. "_accept_",
  1148. smalltalk.method({
  1149. selector: "accept:",
  1150. category: 'visiting',
  1151. fn: function (aVisitor) {
  1152. var self=this;
  1153. return smalltalk.send(aVisitor, "_visitIRSequence_", [self]);
  1154. return self;},
  1155. args: ["aVisitor"],
  1156. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  1157. messageSends: ["visitIRSequence:"],
  1158. referencedClasses: []
  1159. }),
  1160. smalltalk.IRSequence);
  1161. smalltalk.addMethod(
  1162. "_add_",
  1163. smalltalk.method({
  1164. selector: "add:",
  1165. category: 'adding',
  1166. fn: function (anIRInstruction) {
  1167. var self=this;
  1168. var statement=nil;
  1169. (statement=smalltalk.send((smalltalk.IRStatement || IRStatement), "_new", []));
  1170. smalltalk.send(statement, "_add_", [anIRInstruction]);
  1171. smalltalk.send(smalltalk.send(self, "_instructions", []), "_add_", [statement]);
  1172. return anIRInstruction;
  1173. return self;},
  1174. args: ["anIRInstruction"],
  1175. source: "add: anIRInstruction\x0a\x09| statement |\x0a\x09statement := IRStatement new.\x0a\x09statement add: anIRInstruction.\x0a\x09self instructions add: statement.\x0a\x09^ anIRInstruction",
  1176. messageSends: ["new", "add:", "instructions"],
  1177. referencedClasses: ["IRStatement"]
  1178. }),
  1179. smalltalk.IRSequence);
  1180. smalltalk.addClass('IRBlockSequence', smalltalk.IRSequence, [], 'Compiler-IR');
  1181. smalltalk.addMethod(
  1182. "_accept_",
  1183. smalltalk.method({
  1184. selector: "accept:",
  1185. category: 'visiting',
  1186. fn: function (aVisitor) {
  1187. var self=this;
  1188. return smalltalk.send(aVisitor, "_visitIRBlockSequence_", [self]);
  1189. return self;},
  1190. args: ["aVisitor"],
  1191. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  1192. messageSends: ["visitIRBlockSequence:"],
  1193. referencedClasses: []
  1194. }),
  1195. smalltalk.IRBlockSequence);
  1196. smalltalk.addClass('IRStatement', smalltalk.IRInstruction, [], 'Compiler-IR');
  1197. smalltalk.IRStatement.comment="I am a statement instruction. \x0aStatements can be used to control the PC count, among other things."
  1198. smalltalk.addMethod(
  1199. "_accept_",
  1200. smalltalk.method({
  1201. selector: "accept:",
  1202. category: 'visiting',
  1203. fn: function (aVisitor) {
  1204. var self=this;
  1205. return smalltalk.send(aVisitor, "_visitIRStatement_", [self]);
  1206. return self;},
  1207. args: ["aVisitor"],
  1208. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRStatement: self",
  1209. messageSends: ["visitIRStatement:"],
  1210. referencedClasses: []
  1211. }),
  1212. smalltalk.IRStatement);
  1213. smalltalk.addMethod(
  1214. "_canBeAssigned",
  1215. smalltalk.method({
  1216. selector: "canBeAssigned",
  1217. category: 'testing',
  1218. fn: function () {
  1219. var self=this;
  1220. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_instructions", []), "_first", []), "_canBeAssigned", []);
  1221. return self;},
  1222. args: [],
  1223. source: "canBeAssigned\x0a\x09^ self instructions first canBeAssigned",
  1224. messageSends: ["canBeAssigned", "first", "instructions"],
  1225. referencedClasses: []
  1226. }),
  1227. smalltalk.IRStatement);
  1228. smalltalk.addMethod(
  1229. "_isReturn",
  1230. smalltalk.method({
  1231. selector: "isReturn",
  1232. category: 'testing',
  1233. fn: function () {
  1234. var self=this;
  1235. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_instructions", []), "_first", []), "_isReturn", []);
  1236. return self;},
  1237. args: [],
  1238. source: "isReturn\x0a\x09^ self instructions first isReturn",
  1239. messageSends: ["isReturn", "first", "instructions"],
  1240. referencedClasses: []
  1241. }),
  1242. smalltalk.IRStatement);
  1243. smalltalk.addClass('IRTempDeclaration', smalltalk.IRInstruction, ['name'], 'Compiler-IR');
  1244. smalltalk.IRTempDeclaration.comment="I am a temporary variable declaration instruction"
  1245. smalltalk.addMethod(
  1246. "_accept_",
  1247. smalltalk.method({
  1248. selector: "accept:",
  1249. category: 'visiting',
  1250. fn: function (aVisitor) {
  1251. var self=this;
  1252. return smalltalk.send(aVisitor, "_visitIRTempDeclaration_", [self]);
  1253. return self;},
  1254. args: ["aVisitor"],
  1255. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  1256. messageSends: ["visitIRTempDeclaration:"],
  1257. referencedClasses: []
  1258. }),
  1259. smalltalk.IRTempDeclaration);
  1260. smalltalk.addMethod(
  1261. "_name",
  1262. smalltalk.method({
  1263. selector: "name",
  1264. category: 'accessing',
  1265. fn: function () {
  1266. var self=this;
  1267. return self['@name'];
  1268. return self;},
  1269. args: [],
  1270. source: "name\x0a\x09^ name",
  1271. messageSends: [],
  1272. referencedClasses: []
  1273. }),
  1274. smalltalk.IRTempDeclaration);
  1275. smalltalk.addMethod(
  1276. "_name_",
  1277. smalltalk.method({
  1278. selector: "name:",
  1279. category: 'accessing',
  1280. fn: function (aString) {
  1281. var self=this;
  1282. (self['@name']=aString);
  1283. return self;},
  1284. args: ["aString"],
  1285. source: "name: aString\x0a\x09name := aString",
  1286. messageSends: [],
  1287. referencedClasses: []
  1288. }),
  1289. smalltalk.IRTempDeclaration);
  1290. smalltalk.addClass('IRValue', smalltalk.IRInstruction, ['value'], 'Compiler-IR');
  1291. smalltalk.IRValue.comment="I am the simplest possible instruction. I represent a value."
  1292. smalltalk.addMethod(
  1293. "_accept_",
  1294. smalltalk.method({
  1295. selector: "accept:",
  1296. category: 'visiting',
  1297. fn: function (aVisitor) {
  1298. var self=this;
  1299. return smalltalk.send(aVisitor, "_visitIRValue_", [self]);
  1300. return self;},
  1301. args: ["aVisitor"],
  1302. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  1303. messageSends: ["visitIRValue:"],
  1304. referencedClasses: []
  1305. }),
  1306. smalltalk.IRValue);
  1307. smalltalk.addMethod(
  1308. "_value",
  1309. smalltalk.method({
  1310. selector: "value",
  1311. category: 'accessing',
  1312. fn: function () {
  1313. var self=this;
  1314. return self['@value'];
  1315. return self;},
  1316. args: [],
  1317. source: "value\x0a\x09^value",
  1318. messageSends: [],
  1319. referencedClasses: []
  1320. }),
  1321. smalltalk.IRValue);
  1322. smalltalk.addMethod(
  1323. "_value_",
  1324. smalltalk.method({
  1325. selector: "value:",
  1326. category: 'accessing',
  1327. fn: function (aString) {
  1328. var self=this;
  1329. (self['@value']=aString);
  1330. return self;},
  1331. args: ["aString"],
  1332. source: "value: aString\x0a\x09value := aString",
  1333. messageSends: [],
  1334. referencedClasses: []
  1335. }),
  1336. smalltalk.IRValue);
  1337. smalltalk.addClass('IRVariable', smalltalk.IRInstruction, ['variable'], 'Compiler-IR');
  1338. smalltalk.IRVariable.comment="I am a variable instruction."
  1339. smalltalk.addMethod(
  1340. "_accept_",
  1341. smalltalk.method({
  1342. selector: "accept:",
  1343. category: 'visiting',
  1344. fn: function (aVisitor) {
  1345. var self=this;
  1346. return smalltalk.send(aVisitor, "_visitIRVariable_", [self]);
  1347. return self;},
  1348. args: ["aVisitor"],
  1349. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  1350. messageSends: ["visitIRVariable:"],
  1351. referencedClasses: []
  1352. }),
  1353. smalltalk.IRVariable);
  1354. smalltalk.addMethod(
  1355. "_isVariable",
  1356. smalltalk.method({
  1357. selector: "isVariable",
  1358. category: 'testing',
  1359. fn: function () {
  1360. var self=this;
  1361. return true;
  1362. return self;},
  1363. args: [],
  1364. source: "isVariable\x0a\x09^ true",
  1365. messageSends: [],
  1366. referencedClasses: []
  1367. }),
  1368. smalltalk.IRVariable);
  1369. smalltalk.addMethod(
  1370. "_variable",
  1371. smalltalk.method({
  1372. selector: "variable",
  1373. category: 'accessing',
  1374. fn: function () {
  1375. var self=this;
  1376. return self['@variable'];
  1377. return self;},
  1378. args: [],
  1379. source: "variable\x0a\x09^ variable",
  1380. messageSends: [],
  1381. referencedClasses: []
  1382. }),
  1383. smalltalk.IRVariable);
  1384. smalltalk.addMethod(
  1385. "_variable_",
  1386. smalltalk.method({
  1387. selector: "variable:",
  1388. category: 'accessing',
  1389. fn: function (aScopeVariable) {
  1390. var self=this;
  1391. (self['@variable']=aScopeVariable);
  1392. return self;},
  1393. args: ["aScopeVariable"],
  1394. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  1395. messageSends: [],
  1396. referencedClasses: []
  1397. }),
  1398. smalltalk.IRVariable);
  1399. smalltalk.addClass('IRVerbatim', smalltalk.IRInstruction, ['source'], 'Compiler-IR');
  1400. smalltalk.addMethod(
  1401. "_accept_",
  1402. smalltalk.method({
  1403. selector: "accept:",
  1404. category: 'visiting',
  1405. fn: function (aVisitor) {
  1406. var self=this;
  1407. return smalltalk.send(aVisitor, "_visitIRVerbatim_", [self]);
  1408. return self;},
  1409. args: ["aVisitor"],
  1410. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  1411. messageSends: ["visitIRVerbatim:"],
  1412. referencedClasses: []
  1413. }),
  1414. smalltalk.IRVerbatim);
  1415. smalltalk.addMethod(
  1416. "_source",
  1417. smalltalk.method({
  1418. selector: "source",
  1419. category: 'accessing',
  1420. fn: function () {
  1421. var self=this;
  1422. return self['@source'];
  1423. return self;},
  1424. args: [],
  1425. source: "source\x0a\x09^ source",
  1426. messageSends: [],
  1427. referencedClasses: []
  1428. }),
  1429. smalltalk.IRVerbatim);
  1430. smalltalk.addMethod(
  1431. "_source_",
  1432. smalltalk.method({
  1433. selector: "source:",
  1434. category: 'accessing',
  1435. fn: function (aString) {
  1436. var self=this;
  1437. (self['@source']=aString);
  1438. return self;},
  1439. args: ["aString"],
  1440. source: "source: aString\x0a\x09source := aString",
  1441. messageSends: [],
  1442. referencedClasses: []
  1443. }),
  1444. smalltalk.IRVerbatim);
  1445. smalltalk.addClass('IRVisitor', smalltalk.Object, [], 'Compiler-IR');
  1446. smalltalk.addMethod(
  1447. "_visit_",
  1448. smalltalk.method({
  1449. selector: "visit:",
  1450. category: 'visiting',
  1451. fn: function (anIRInstruction) {
  1452. var self=this;
  1453. return smalltalk.send(anIRInstruction, "_accept_", [self]);
  1454. return self;},
  1455. args: ["anIRInstruction"],
  1456. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  1457. messageSends: ["accept:"],
  1458. referencedClasses: []
  1459. }),
  1460. smalltalk.IRVisitor);
  1461. smalltalk.addMethod(
  1462. "_visitIRAlias_",
  1463. smalltalk.method({
  1464. selector: "visitIRAlias:",
  1465. category: 'visiting',
  1466. fn: function (anIRAlias) {
  1467. var self=this;
  1468. return smalltalk.send(self, "_visitIRAssignment_", [anIRAlias]);
  1469. return self;},
  1470. args: ["anIRAlias"],
  1471. source: "visitIRAlias: anIRAlias\x0a\x09^ self visitIRAssignment: anIRAlias",
  1472. messageSends: ["visitIRAssignment:"],
  1473. referencedClasses: []
  1474. }),
  1475. smalltalk.IRVisitor);
  1476. smalltalk.addMethod(
  1477. "_visitIRAssignment_",
  1478. smalltalk.method({
  1479. selector: "visitIRAssignment:",
  1480. category: 'visiting',
  1481. fn: function (anIRAssignment) {
  1482. var self=this;
  1483. return smalltalk.send(self, "_visitIRInstruction_", [anIRAssignment]);
  1484. return self;},
  1485. args: ["anIRAssignment"],
  1486. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  1487. messageSends: ["visitIRInstruction:"],
  1488. referencedClasses: []
  1489. }),
  1490. smalltalk.IRVisitor);
  1491. smalltalk.addMethod(
  1492. "_visitIRBlockSequence_",
  1493. smalltalk.method({
  1494. selector: "visitIRBlockSequence:",
  1495. category: 'visiting',
  1496. fn: function (anIRBlockSequence) {
  1497. var self=this;
  1498. return smalltalk.send(self, "_visitIRSequence_", [anIRBlockSequence]);
  1499. return self;},
  1500. args: ["anIRBlockSequence"],
  1501. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  1502. messageSends: ["visitIRSequence:"],
  1503. referencedClasses: []
  1504. }),
  1505. smalltalk.IRVisitor);
  1506. smalltalk.addMethod(
  1507. "_visitIRClosure_",
  1508. smalltalk.method({
  1509. selector: "visitIRClosure:",
  1510. category: 'visiting',
  1511. fn: function (anIRClosure) {
  1512. var self=this;
  1513. return smalltalk.send(self, "_visitIRInstruction_", [anIRClosure]);
  1514. return self;},
  1515. args: ["anIRClosure"],
  1516. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  1517. messageSends: ["visitIRInstruction:"],
  1518. referencedClasses: []
  1519. }),
  1520. smalltalk.IRVisitor);
  1521. smalltalk.addMethod(
  1522. "_visitIRInlinedAssignment_",
  1523. smalltalk.method({
  1524. selector: "visitIRInlinedAssignment:",
  1525. category: 'visiting',
  1526. fn: function (anIRInlinedAssignment) {
  1527. var self=this;
  1528. return smalltalk.send(self, "_visitIRAssignment_", [anIRInlinedAssignment]);
  1529. return self;},
  1530. args: ["anIRInlinedAssignment"],
  1531. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09^ self visitIRAssignment: anIRInlinedAssignment",
  1532. messageSends: ["visitIRAssignment:"],
  1533. referencedClasses: []
  1534. }),
  1535. smalltalk.IRVisitor);
  1536. smalltalk.addMethod(
  1537. "_visitIRInlinedClosure_",
  1538. smalltalk.method({
  1539. selector: "visitIRInlinedClosure:",
  1540. category: 'visiting',
  1541. fn: function (anIRClosure) {
  1542. var self=this;
  1543. return smalltalk.send(self, "_visitIRClosure_", [anIRClosure]);
  1544. return self;},
  1545. args: ["anIRClosure"],
  1546. source: "visitIRInlinedClosure: anIRClosure\x0a\x09^ self visitIRClosure: anIRClosure",
  1547. messageSends: ["visitIRClosure:"],
  1548. referencedClasses: []
  1549. }),
  1550. smalltalk.IRVisitor);
  1551. smalltalk.addMethod(
  1552. "_visitIRInlinedIfFalse_",
  1553. smalltalk.method({
  1554. selector: "visitIRInlinedIfFalse:",
  1555. category: 'visiting',
  1556. fn: function (anIRInlinedIfFalse) {
  1557. var self=this;
  1558. return smalltalk.send(self, "_visitIRInlinedSend_", [anIRInlinedIfFalse]);
  1559. return self;},
  1560. args: ["anIRInlinedIfFalse"],
  1561. source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09^ self visitIRInlinedSend: anIRInlinedIfFalse",
  1562. messageSends: ["visitIRInlinedSend:"],
  1563. referencedClasses: []
  1564. }),
  1565. smalltalk.IRVisitor);
  1566. smalltalk.addMethod(
  1567. "_visitIRInlinedIfTrue_",
  1568. smalltalk.method({
  1569. selector: "visitIRInlinedIfTrue:",
  1570. category: 'visiting',
  1571. fn: function (anIRInlinedIfTrue) {
  1572. var self=this;
  1573. return smalltalk.send(self, "_visitIRInlinedSend_", [anIRInlinedIfTrue]);
  1574. return self;},
  1575. args: ["anIRInlinedIfTrue"],
  1576. source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09^ self visitIRInlinedSend: anIRInlinedIfTrue",
  1577. messageSends: ["visitIRInlinedSend:"],
  1578. referencedClasses: []
  1579. }),
  1580. smalltalk.IRVisitor);
  1581. smalltalk.addMethod(
  1582. "_visitIRInlinedNonLocalReturn_",
  1583. smalltalk.method({
  1584. selector: "visitIRInlinedNonLocalReturn:",
  1585. category: 'visiting',
  1586. fn: function (anIRNonLocalReturn) {
  1587. var self=this;
  1588. return smalltalk.send(self, "_visitIRReturn_", [anIRNonLocalReturn]);
  1589. return self;},
  1590. args: ["anIRNonLocalReturn"],
  1591. source: "visitIRInlinedNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRReturn: anIRNonLocalReturn",
  1592. messageSends: ["visitIRReturn:"],
  1593. referencedClasses: []
  1594. }),
  1595. smalltalk.IRVisitor);
  1596. smalltalk.addMethod(
  1597. "_visitIRInlinedSend_",
  1598. smalltalk.method({
  1599. selector: "visitIRInlinedSend:",
  1600. category: 'visiting',
  1601. fn: function (anIRInlinedSend) {
  1602. var self=this;
  1603. return smalltalk.send(self, "_visitIRSend_", [anIRInlinedSend]);
  1604. return self;},
  1605. args: ["anIRInlinedSend"],
  1606. source: "visitIRInlinedSend: anIRInlinedSend\x0a\x09^ self visitIRSend: anIRInlinedSend",
  1607. messageSends: ["visitIRSend:"],
  1608. referencedClasses: []
  1609. }),
  1610. smalltalk.IRVisitor);
  1611. smalltalk.addMethod(
  1612. "_visitIRInstruction_",
  1613. smalltalk.method({
  1614. selector: "visitIRInstruction:",
  1615. category: 'visiting',
  1616. fn: function (anIRInstruction) {
  1617. var self=this;
  1618. smalltalk.send(smalltalk.send(anIRInstruction, "_instructions", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);
  1619. return anIRInstruction;
  1620. return self;},
  1621. args: ["anIRInstruction"],
  1622. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  1623. messageSends: ["do:", "instructions", "visit:"],
  1624. referencedClasses: []
  1625. }),
  1626. smalltalk.IRVisitor);
  1627. smalltalk.addMethod(
  1628. "_visitIRMethod_",
  1629. smalltalk.method({
  1630. selector: "visitIRMethod:",
  1631. category: 'visiting',
  1632. fn: function (anIRMethod) {
  1633. var self=this;
  1634. return smalltalk.send(self, "_visitIRInstruction_", [anIRMethod]);
  1635. return self;},
  1636. args: ["anIRMethod"],
  1637. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  1638. messageSends: ["visitIRInstruction:"],
  1639. referencedClasses: []
  1640. }),
  1641. smalltalk.IRVisitor);
  1642. smalltalk.addMethod(
  1643. "_visitIRNonLocalReturn_",
  1644. smalltalk.method({
  1645. selector: "visitIRNonLocalReturn:",
  1646. category: 'visiting',
  1647. fn: function (anIRNonLocalReturn) {
  1648. var self=this;
  1649. return smalltalk.send(self, "_visitIRInstruction_", [anIRNonLocalReturn]);
  1650. return self;},
  1651. args: ["anIRNonLocalReturn"],
  1652. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  1653. messageSends: ["visitIRInstruction:"],
  1654. referencedClasses: []
  1655. }),
  1656. smalltalk.IRVisitor);
  1657. smalltalk.addMethod(
  1658. "_visitIRNonLocalReturnHandling_",
  1659. smalltalk.method({
  1660. selector: "visitIRNonLocalReturnHandling:",
  1661. category: 'visiting',
  1662. fn: function (anIRNonLocalReturnHandling) {
  1663. var self=this;
  1664. return smalltalk.send(self, "_visitIRInstruction_", [anIRNonLocalReturnHandling]);
  1665. return self;},
  1666. args: ["anIRNonLocalReturnHandling"],
  1667. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  1668. messageSends: ["visitIRInstruction:"],
  1669. referencedClasses: []
  1670. }),
  1671. smalltalk.IRVisitor);
  1672. smalltalk.addMethod(
  1673. "_visitIRReturn_",
  1674. smalltalk.method({
  1675. selector: "visitIRReturn:",
  1676. category: 'visiting',
  1677. fn: function (anIRReturn) {
  1678. var self=this;
  1679. return smalltalk.send(self, "_visitIRInstruction_", [anIRReturn]);
  1680. return self;},
  1681. args: ["anIRReturn"],
  1682. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  1683. messageSends: ["visitIRInstruction:"],
  1684. referencedClasses: []
  1685. }),
  1686. smalltalk.IRVisitor);
  1687. smalltalk.addMethod(
  1688. "_visitIRSend_",
  1689. smalltalk.method({
  1690. selector: "visitIRSend:",
  1691. category: 'visiting',
  1692. fn: function (anIRSend) {
  1693. var self=this;
  1694. return smalltalk.send(self, "_visitIRInstruction_", [anIRSend]);
  1695. return self;},
  1696. args: ["anIRSend"],
  1697. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  1698. messageSends: ["visitIRInstruction:"],
  1699. referencedClasses: []
  1700. }),
  1701. smalltalk.IRVisitor);
  1702. smalltalk.addMethod(
  1703. "_visitIRSequence_",
  1704. smalltalk.method({
  1705. selector: "visitIRSequence:",
  1706. category: 'visiting',
  1707. fn: function (anIRSequence) {
  1708. var self=this;
  1709. return smalltalk.send(self, "_visitIRInstruction_", [anIRSequence]);
  1710. return self;},
  1711. args: ["anIRSequence"],
  1712. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  1713. messageSends: ["visitIRInstruction:"],
  1714. referencedClasses: []
  1715. }),
  1716. smalltalk.IRVisitor);
  1717. smalltalk.addMethod(
  1718. "_visitIRStatement_",
  1719. smalltalk.method({
  1720. selector: "visitIRStatement:",
  1721. category: 'visiting',
  1722. fn: function (anIRStatement) {
  1723. var self=this;
  1724. return smalltalk.send(self, "_visitIRInstruction_", [anIRStatement]);
  1725. return self;},
  1726. args: ["anIRStatement"],
  1727. source: "visitIRStatement: anIRStatement\x0a\x09^ self visitIRInstruction: anIRStatement",
  1728. messageSends: ["visitIRInstruction:"],
  1729. referencedClasses: []
  1730. }),
  1731. smalltalk.IRVisitor);
  1732. smalltalk.addMethod(
  1733. "_visitIRTempDeclaration_",
  1734. smalltalk.method({
  1735. selector: "visitIRTempDeclaration:",
  1736. category: 'visiting',
  1737. fn: function (anIRTempDeclaration) {
  1738. var self=this;
  1739. return smalltalk.send(self, "_visitIRInstruction_", [anIRTempDeclaration]);
  1740. return self;},
  1741. args: ["anIRTempDeclaration"],
  1742. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  1743. messageSends: ["visitIRInstruction:"],
  1744. referencedClasses: []
  1745. }),
  1746. smalltalk.IRVisitor);
  1747. smalltalk.addMethod(
  1748. "_visitIRValue_",
  1749. smalltalk.method({
  1750. selector: "visitIRValue:",
  1751. category: 'visiting',
  1752. fn: function (anIRValue) {
  1753. var self=this;
  1754. return smalltalk.send(self, "_visitIRInstruction_", [anIRValue]);
  1755. return self;},
  1756. args: ["anIRValue"],
  1757. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  1758. messageSends: ["visitIRInstruction:"],
  1759. referencedClasses: []
  1760. }),
  1761. smalltalk.IRVisitor);
  1762. smalltalk.addMethod(
  1763. "_visitIRVariable_",
  1764. smalltalk.method({
  1765. selector: "visitIRVariable:",
  1766. category: 'visiting',
  1767. fn: function (anIRVariable) {
  1768. var self=this;
  1769. return smalltalk.send(self, "_visitIRInstruction_", [anIRVariable]);
  1770. return self;},
  1771. args: ["anIRVariable"],
  1772. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  1773. messageSends: ["visitIRInstruction:"],
  1774. referencedClasses: []
  1775. }),
  1776. smalltalk.IRVisitor);
  1777. smalltalk.addMethod(
  1778. "_visitIRVerbatim_",
  1779. smalltalk.method({
  1780. selector: "visitIRVerbatim:",
  1781. category: 'visiting',
  1782. fn: function (anIRVerbatim) {
  1783. var self=this;
  1784. return smalltalk.send(self, "_visitIRInstruction_", [anIRVerbatim]);
  1785. return self;},
  1786. args: ["anIRVerbatim"],
  1787. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  1788. messageSends: ["visitIRInstruction:"],
  1789. referencedClasses: []
  1790. }),
  1791. smalltalk.IRVisitor);
  1792. smalltalk.addClass('IRJSTranslator', smalltalk.IRVisitor, ['stream'], 'Compiler-IR');
  1793. smalltalk.addMethod(
  1794. "_contents",
  1795. smalltalk.method({
  1796. selector: "contents",
  1797. category: 'accessing',
  1798. fn: function () {
  1799. var self=this;
  1800. return smalltalk.send(smalltalk.send(self, "_stream", []), "_contents", []);
  1801. return self;},
  1802. args: [],
  1803. source: "contents\x0a\x09^ self stream contents",
  1804. messageSends: ["contents", "stream"],
  1805. referencedClasses: []
  1806. }),
  1807. smalltalk.IRJSTranslator);
  1808. smalltalk.addMethod(
  1809. "_initialize",
  1810. smalltalk.method({
  1811. selector: "initialize",
  1812. category: 'initialization',
  1813. fn: function () {
  1814. var self=this;
  1815. smalltalk.send(self, "_initialize", [], smalltalk.IRJSTranslator.superclass || nil);
  1816. (self['@stream']=smalltalk.send((smalltalk.JSStream || JSStream), "_new", []));
  1817. return self;},
  1818. args: [],
  1819. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  1820. messageSends: ["initialize", "new"],
  1821. referencedClasses: ["JSStream"]
  1822. }),
  1823. smalltalk.IRJSTranslator);
  1824. smalltalk.addMethod(
  1825. "_stream",
  1826. smalltalk.method({
  1827. selector: "stream",
  1828. category: 'accessing',
  1829. fn: function () {
  1830. var self=this;
  1831. return self['@stream'];
  1832. return self;},
  1833. args: [],
  1834. source: "stream\x0a\x09^ stream",
  1835. messageSends: [],
  1836. referencedClasses: []
  1837. }),
  1838. smalltalk.IRJSTranslator);
  1839. smalltalk.addMethod(
  1840. "_stream_",
  1841. smalltalk.method({
  1842. selector: "stream:",
  1843. category: 'accessing',
  1844. fn: function (aStream) {
  1845. var self=this;
  1846. (self['@stream']=aStream);
  1847. return self;},
  1848. args: ["aStream"],
  1849. source: "stream: aStream\x0a\x09stream := aStream",
  1850. messageSends: [],
  1851. referencedClasses: []
  1852. }),
  1853. smalltalk.IRJSTranslator);
  1854. smalltalk.addMethod(
  1855. "_visitIRAssignment_",
  1856. smalltalk.method({
  1857. selector: "visitIRAssignment:",
  1858. category: 'visiting',
  1859. fn: function (anIRAssignment) {
  1860. var self=this;
  1861. smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRAssignment, "_instructions", []), "_first", [])]);
  1862. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAssignment", []);
  1863. smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRAssignment, "_instructions", []), "_last", [])]);
  1864. return self;},
  1865. args: ["anIRAssignment"],
  1866. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  1867. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"],
  1868. referencedClasses: []
  1869. }),
  1870. smalltalk.IRJSTranslator);
  1871. smalltalk.addMethod(
  1872. "_visitIRBlockSequence_",
  1873. smalltalk.method({
  1874. selector: "visitIRBlockSequence:",
  1875. category: 'visiting',
  1876. fn: function (anIRBlockSequence) {
  1877. var self=this;
  1878. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutSequenceWith_", [(function(){return ((($receiver = smalltalk.send(smalltalk.send(anIRBlockSequence, "_instructions", []), "_notEmpty", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(smalltalk.send(smalltalk.send(anIRBlockSequence, "_instructions", []), "_allButLast", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(anIRBlockSequence, "_instructions", []), "_last", []), "_isReturn", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutReturn", []);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutReturn", []);})]));return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRBlockSequence, "_instructions", []), "_last", [])]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(smalltalk.send(smalltalk.send(anIRBlockSequence, "_instructions", []), "_allButLast", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(anIRBlockSequence, "_instructions", []), "_last", []), "_isReturn", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutReturn", []);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutReturn", []);})]));return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRBlockSequence, "_instructions", []), "_last", [])]);})]));})]);
  1879. return self;},
  1880. args: ["anIRBlockSequence"],
  1881. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRBlockSequence instructions notEmpty ifTrue: [\x0a\x09\x09\x09anIRBlockSequence instructions allButLast do: [ :each | \x0a\x09\x09\x09\x09self visit: each ].\x0a\x09\x09\x09anIRBlockSequence instructions last isReturn ifFalse: [\x0a\x09\x09\x09\x09self stream nextPutReturn ].\x0a\x09\x09\x09self visit: anIRBlockSequence instructions last ]]",
  1882. messageSends: ["nextPutSequenceWith:", "stream", "ifTrue:", "notEmpty", "instructions", "do:", "allButLast", "visit:", "ifFalse:", "isReturn", "last", "nextPutReturn"],
  1883. referencedClasses: []
  1884. }),
  1885. smalltalk.IRJSTranslator);
  1886. smalltalk.addMethod(
  1887. "_visitIRClosure_",
  1888. smalltalk.method({
  1889. selector: "visitIRClosure:",
  1890. category: 'visiting',
  1891. fn: function (anIRClosure) {
  1892. var self=this;
  1893. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutClosureWith_arguments_", [(function(){return smalltalk.send(self, "_visitIRClosure_", [anIRClosure], smalltalk.IRJSTranslator.superclass || nil);}), smalltalk.send(anIRClosure, "_arguments", [])]);
  1894. return self;},
  1895. args: ["anIRClosure"],
  1896. source: "visitIRClosure: anIRClosure\x0a\x09self stream \x0a\x09\x09nextPutClosureWith: [ super visitIRClosure: anIRClosure ] \x0a\x09\x09arguments: anIRClosure arguments",
  1897. messageSends: ["nextPutClosureWith:arguments:", "stream", "visitIRClosure:", "arguments"],
  1898. referencedClasses: []
  1899. }),
  1900. smalltalk.IRJSTranslator);
  1901. smalltalk.addMethod(
  1902. "_visitIRMethod_",
  1903. smalltalk.method({
  1904. selector: "visitIRMethod:",
  1905. category: 'visiting',
  1906. fn: function (anIRMethod) {
  1907. var self=this;
  1908. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutMethodDeclaration_with_", [anIRMethod, (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutFunctionWith_arguments_", [(function(){((($receiver = smalltalk.send(smalltalk.send(anIRMethod, "_internalVariables", []), "_notEmpty", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutVars_", [smalltalk.send(smalltalk.send(smalltalk.send(anIRMethod, "_internalVariables", []), "_asArray", []), "_collect_", [(function(each){return smalltalk.send(smalltalk.send(each, "_variable", []), "_alias", []);})])]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutVars_", [smalltalk.send(smalltalk.send(smalltalk.send(anIRMethod, "_internalVariables", []), "_asArray", []), "_collect_", [(function(each){return smalltalk.send(smalltalk.send(each, "_variable", []), "_alias", []);})])]);})]));return ((($receiver = smalltalk.send(smalltalk.send(anIRMethod, "_scope", []), "_hasNonLocalReturn", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutNonLocalReturnHandlingWith_", [(function(){return smalltalk.send(self, "_visitIRMethod_", [anIRMethod], smalltalk.IRJSTranslator.superclass || nil);})]);})() : (function(){return smalltalk.send(self, "_visitIRMethod_", [anIRMethod], smalltalk.IRJSTranslator.superclass || nil);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutNonLocalReturnHandlingWith_", [(function(){return smalltalk.send(self, "_visitIRMethod_", [anIRMethod], smalltalk.IRJSTranslator.superclass || nil);})]);}), (function(){return smalltalk.send(self, "_visitIRMethod_", [anIRMethod], smalltalk.IRJSTranslator.superclass || nil);})]));}), smalltalk.send(anIRMethod, "_arguments", [])]);})]);
  1909. return self;},
  1910. args: ["anIRMethod"],
  1911. source: "visitIRMethod: anIRMethod\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod \x0a\x09\x09with: [ self stream \x0a\x09\x09\x09nextPutFunctionWith: [ \x0a\x09\x09\x09\x09anIRMethod internalVariables notEmpty ifTrue: [\x0a\x09\x09\x09\x09\x09self stream nextPutVars: (anIRMethod internalVariables asArray collect: [ :each |\x0a\x09\x09\x09\x09\x09\x09each variable alias ]) ].\x0a\x09\x09\x09\x09anIRMethod scope hasNonLocalReturn \x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09self stream nextPutNonLocalReturnHandlingWith: [\x0a\x09\x09\x09\x09\x09\x09\x09super visitIRMethod: anIRMethod ]]\x0a\x09\x09\x09\x09\x09ifFalse: [ super visitIRMethod: anIRMethod ]]\x0a\x09\x09\x09arguments: anIRMethod arguments ]",
  1912. messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "ifTrue:", "notEmpty", "internalVariables", "nextPutVars:", "collect:", "asArray", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"],
  1913. referencedClasses: []
  1914. }),
  1915. smalltalk.IRJSTranslator);
  1916. smalltalk.addMethod(
  1917. "_visitIRNonLocalReturn_",
  1918. smalltalk.method({
  1919. selector: "visitIRNonLocalReturn:",
  1920. category: 'visiting',
  1921. fn: function (anIRNonLocalReturn) {
  1922. var self=this;
  1923. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutNonLocalReturnWith_", [(function(){return smalltalk.send(self, "_visitIRNonLocalReturn_", [anIRNonLocalReturn], smalltalk.IRJSTranslator.superclass || nil);})]);
  1924. return self;},
  1925. args: ["anIRNonLocalReturn"],
  1926. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  1927. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"],
  1928. referencedClasses: []
  1929. }),
  1930. smalltalk.IRJSTranslator);
  1931. smalltalk.addMethod(
  1932. "_visitIRReturn_",
  1933. smalltalk.method({
  1934. selector: "visitIRReturn:",
  1935. category: 'visiting',
  1936. fn: function (anIRReturn) {
  1937. var self=this;
  1938. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutReturnWith_", [(function(){return smalltalk.send(self, "_visitIRReturn_", [anIRReturn], smalltalk.IRJSTranslator.superclass || nil);})]);
  1939. return self;},
  1940. args: ["anIRReturn"],
  1941. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  1942. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"],
  1943. referencedClasses: []
  1944. }),
  1945. smalltalk.IRJSTranslator);
  1946. smalltalk.addMethod(
  1947. "_visitIRSend_",
  1948. smalltalk.method({
  1949. selector: "visitIRSend:",
  1950. category: 'visiting',
  1951. fn: function (anIRSend) {
  1952. var self=this;
  1953. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", ["smalltalk.send("]);
  1954. smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRSend, "_instructions", []), "_first", [])]);
  1955. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(smalltalk.send(",\x22", "__comma", [smalltalk.send(smalltalk.send(anIRSend, "_selector", []), "_asSelector", [])]), "__comma", ["\x22,["])]);
  1956. smalltalk.send(smalltalk.send(smalltalk.send(anIRSend, "_instructions", []), "_allButFirst", []), "_do_separatedBy_", [(function(each){return smalltalk.send(self, "_visit_", [each]);}), (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [","]);})]);
  1957. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", ["]"]);
  1958. ((($receiver = ((($receiver = smalltalk.send(anIRSend, "_index", [])).klass === smalltalk.Number) ? $receiver >(1) : smalltalk.send($receiver, "__gt", [(1)]))).klass === smalltalk.Boolean) ? ($receiver ? (function(){(($receiver = smalltalk.send(anIRSend, "_classSend", [])) == nil || $receiver == undefined) ? (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [",undefined"]);})() : (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(",", "__comma", [smalltalk.send(smalltalk.send(anIRSend, "_classSend", []), "_asJavascript", [])])]);})();return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(",", "__comma", [smalltalk.send(smalltalk.send(anIRSend, "_index", []), "_asJavascript", [])])]);})() : (function(){return (($receiver = smalltalk.send(anIRSend, "_classSend", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(",", "__comma", [smalltalk.send(smalltalk.send(anIRSend, "_classSend", []), "_asJavascript", [])])]);})() : nil;})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){(($receiver = smalltalk.send(anIRSend, "_classSend", [])) == nil || $receiver == undefined) ? (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [",undefined"]);})() : (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(",", "__comma", [smalltalk.send(smalltalk.send(anIRSend, "_classSend", []), "_asJavascript", [])])]);})();return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(",", "__comma", [smalltalk.send(smalltalk.send(anIRSend, "_index", []), "_asJavascript", [])])]);}), (function(){return (($receiver = smalltalk.send(anIRSend, "_classSend", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(",", "__comma", [smalltalk.send(smalltalk.send(anIRSend, "_classSend", []), "_asJavascript", [])])]);})() : nil;})]));
  1959. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [")"]);
  1960. return self;},
  1961. args: ["anIRSend"],
  1962. source: "visitIRSend: anIRSend\x0a\x09self stream nextPutAll: 'smalltalk.send('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll: ',\x22', anIRSend selector asSelector, '\x22,['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ']'.\x0a\x09anIRSend index > 1 \x0a\x09\x09ifTrue: [\x0a\x09\x09\x09anIRSend classSend \x0a\x09\x09\x09\x09ifNil: [ self stream nextPutAll: ',undefined' ]\x0a\x09\x09\x09\x09ifNotNil: [ self stream nextPutAll: ',', anIRSend classSend asJavascript ].\x0a\x09\x09\x09self stream nextPutAll: ',', anIRSend index asJavascript ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09anIRSend classSend ifNotNil: [ \x0a\x09\x09\x09\x09self stream nextPutAll: ',', anIRSend classSend asJavascript ]].\x0a\x09self stream nextPutAll: ')'",
  1963. messageSends: ["nextPutAll:", "stream", "visit:", "first", "instructions", ",", "asSelector", "selector", "do:separatedBy:", "allButFirst", "ifTrue:ifFalse:", ">", "index", "ifNil:ifNotNil:", "classSend", "asJavascript", "ifNotNil:"],
  1964. referencedClasses: []
  1965. }),
  1966. smalltalk.IRJSTranslator);
  1967. smalltalk.addMethod(
  1968. "_visitIRSequence_",
  1969. smalltalk.method({
  1970. selector: "visitIRSequence:",
  1971. category: 'visiting',
  1972. fn: function (anIRSequence) {
  1973. var self=this;
  1974. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutSequenceWith_", [(function(){return smalltalk.send(self, "_visitIRSequence_", [anIRSequence], smalltalk.IRJSTranslator.superclass || nil);})]);
  1975. return self;},
  1976. args: ["anIRSequence"],
  1977. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09\x22self instructions do: [ :each |\x0a\x09\x09\x09((IRStatement on: self builder)\x0a\x09\x09\x09\x09pc: self builder nextPc;\x0a\x09\x09\x09\x09with: each;\x0a\x09\x09\x09\x09yourself) emitOn: aStream ]\x22\x0a\x09\x09super visitIRSequence: anIRSequence ]",
  1978. messageSends: ["nextPutSequenceWith:", "stream", "visitIRSequence:"],
  1979. referencedClasses: []
  1980. }),
  1981. smalltalk.IRJSTranslator);
  1982. smalltalk.addMethod(
  1983. "_visitIRStatement_",
  1984. smalltalk.method({
  1985. selector: "visitIRStatement:",
  1986. category: 'visiting',
  1987. fn: function (anIRStatement) {
  1988. var self=this;
  1989. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutStatementWith_", [(function(){return smalltalk.send(self, "_visitIRStatement_", [anIRStatement], smalltalk.IRJSTranslator.superclass || nil);})]);
  1990. return self;},
  1991. args: ["anIRStatement"],
  1992. source: "visitIRStatement: anIRStatement\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09super visitIRStatement: anIRStatement ]",
  1993. messageSends: ["nextPutStatementWith:", "stream", "visitIRStatement:"],
  1994. referencedClasses: []
  1995. }),
  1996. smalltalk.IRJSTranslator);
  1997. smalltalk.addMethod(
  1998. "_visitIRTempDeclaration_",
  1999. smalltalk.method({
  2000. selector: "visitIRTempDeclaration:",
  2001. category: 'visiting',
  2002. fn: function (anIRTempDeclaration) {
  2003. var self=this;
  2004. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutVar_", [smalltalk.send(smalltalk.send(anIRTempDeclaration, "_name", []), "_asVariableName", [])]);
  2005. return self;},
  2006. args: ["anIRTempDeclaration"],
  2007. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09self stream nextPutVar: anIRTempDeclaration name asVariableName",
  2008. messageSends: ["nextPutVar:", "stream", "asVariableName", "name"],
  2009. referencedClasses: []
  2010. }),
  2011. smalltalk.IRJSTranslator);
  2012. smalltalk.addMethod(
  2013. "_visitIRValue_",
  2014. smalltalk.method({
  2015. selector: "visitIRValue:",
  2016. category: 'visiting',
  2017. fn: function (anIRValue) {
  2018. var self=this;
  2019. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(smalltalk.send(anIRValue, "_value", []), "_asJavascript", [])]);
  2020. return self;},
  2021. args: ["anIRValue"],
  2022. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  2023. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"],
  2024. referencedClasses: []
  2025. }),
  2026. smalltalk.IRJSTranslator);
  2027. smalltalk.addMethod(
  2028. "_visitIRVariable_",
  2029. smalltalk.method({
  2030. selector: "visitIRVariable:",
  2031. category: 'visiting',
  2032. fn: function (anIRVariable) {
  2033. var self=this;
  2034. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(smalltalk.send(anIRVariable, "_variable", []), "_alias", [])]);
  2035. return self;},
  2036. args: ["anIRVariable"],
  2037. source: "visitIRVariable: anIRVariable\x0a\x09self stream nextPutAll: anIRVariable variable alias",
  2038. messageSends: ["nextPutAll:", "stream", "alias", "variable"],
  2039. referencedClasses: []
  2040. }),
  2041. smalltalk.IRJSTranslator);
  2042. smalltalk.addMethod(
  2043. "_visitIRVerbatim_",
  2044. smalltalk.method({
  2045. selector: "visitIRVerbatim:",
  2046. category: 'visiting',
  2047. fn: function (anIRVerbatim) {
  2048. var self=this;
  2049. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutStatementWith_", [(function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(anIRVerbatim, "_source", [])]);})]);
  2050. return self;},
  2051. args: ["anIRVerbatim"],
  2052. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  2053. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"],
  2054. referencedClasses: []
  2055. }),
  2056. smalltalk.IRJSTranslator);
  2057. smalltalk.addClass('JSStream', smalltalk.Object, ['stream'], 'Compiler-IR');
  2058. smalltalk.addMethod(
  2059. "_contents",
  2060. smalltalk.method({
  2061. selector: "contents",
  2062. category: 'accessing',
  2063. fn: function () {
  2064. var self=this;
  2065. return smalltalk.send(self['@stream'], "_contents", []);
  2066. return self;},
  2067. args: [],
  2068. source: "contents\x0a\x09^ stream contents",
  2069. messageSends: ["contents"],
  2070. referencedClasses: []
  2071. }),
  2072. smalltalk.JSStream);
  2073. smalltalk.addMethod(
  2074. "_initialize",
  2075. smalltalk.method({
  2076. selector: "initialize",
  2077. category: 'initialization',
  2078. fn: function () {
  2079. var self=this;
  2080. smalltalk.send(self, "_initialize", [], smalltalk.JSStream.superclass || nil);
  2081. (self['@stream']=smalltalk.send("", "_writeStream", []));
  2082. return self;},
  2083. args: [],
  2084. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  2085. messageSends: ["initialize", "writeStream"],
  2086. referencedClasses: []
  2087. }),
  2088. smalltalk.JSStream);
  2089. smalltalk.addMethod(
  2090. "_lf",
  2091. smalltalk.method({
  2092. selector: "lf",
  2093. category: 'streaming',
  2094. fn: function () {
  2095. var self=this;
  2096. smalltalk.send(self['@stream'], "_lf", []);
  2097. return self;},
  2098. args: [],
  2099. source: "lf\x0a\x09stream lf",
  2100. messageSends: ["lf"],
  2101. referencedClasses: []
  2102. }),
  2103. smalltalk.JSStream);
  2104. smalltalk.addMethod(
  2105. "_nextPut_",
  2106. smalltalk.method({
  2107. selector: "nextPut:",
  2108. category: 'streaming',
  2109. fn: function (aString) {
  2110. var self=this;
  2111. smalltalk.send(self['@stream'], "_nextPut_", [aString]);
  2112. return self;},
  2113. args: ["aString"],
  2114. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  2115. messageSends: ["nextPut:"],
  2116. referencedClasses: []
  2117. }),
  2118. smalltalk.JSStream);
  2119. smalltalk.addMethod(
  2120. "_nextPutAll_",
  2121. smalltalk.method({
  2122. selector: "nextPutAll:",
  2123. category: 'streaming',
  2124. fn: function (aString) {
  2125. var self=this;
  2126. smalltalk.send(self['@stream'], "_nextPutAll_", [aString]);
  2127. return self;},
  2128. args: ["aString"],
  2129. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  2130. messageSends: ["nextPutAll:"],
  2131. referencedClasses: []
  2132. }),
  2133. smalltalk.JSStream);
  2134. smalltalk.addMethod(
  2135. "_nextPutAssignment",
  2136. smalltalk.method({
  2137. selector: "nextPutAssignment",
  2138. category: 'streaming',
  2139. fn: function () {
  2140. var self=this;
  2141. smalltalk.send(self['@stream'], "_nextPutAll_", ["="]);
  2142. return self;},
  2143. args: [],
  2144. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  2145. messageSends: ["nextPutAll:"],
  2146. referencedClasses: []
  2147. }),
  2148. smalltalk.JSStream);
  2149. smalltalk.addMethod(
  2150. "_nextPutClosureWith_arguments_",
  2151. smalltalk.method({
  2152. selector: "nextPutClosureWith:arguments:",
  2153. category: 'streaming',
  2154. fn: function (aBlock, anArray) {
  2155. var self=this;
  2156. smalltalk.send(self['@stream'], "_nextPutAll_", ["(function("]);
  2157. smalltalk.send(anArray, "_do_separatedBy_", [(function(each){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(each, "_asVariableName", [])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPut_", [","]);})]);
  2158. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["){"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2159. smalltalk.send(aBlock, "_value", []);
  2160. smalltalk.send(self['@stream'], "_nextPutAll_", ["})"]);
  2161. return self;},
  2162. args: ["aBlock", "anArray"],
  2163. source: "nextPutClosureWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: '(function('.\x0a\x09anArray \x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '})'",
  2164. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  2165. referencedClasses: []
  2166. }),
  2167. smalltalk.JSStream);
  2168. smalltalk.addMethod(
  2169. "_nextPutFunctionWith_arguments_",
  2170. smalltalk.method({
  2171. selector: "nextPutFunctionWith:arguments:",
  2172. category: 'streaming',
  2173. fn: function (aBlock, anArray) {
  2174. var self=this;
  2175. smalltalk.send(self['@stream'], "_nextPutAll_", ["fn: function("]);
  2176. smalltalk.send(anArray, "_do_separatedBy_", [(function(each){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(each, "_asVariableName", [])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPut_", [","]);})]);
  2177. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["){"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2178. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["var self=this;"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2179. smalltalk.send(aBlock, "_value", []);
  2180. smalltalk.send(self['@stream'], "_nextPutAll_", ["}"]);
  2181. return self;},
  2182. args: ["aBlock", "anArray"],
  2183. source: "nextPutFunctionWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: 'fn: function('.\x0a\x09anArray \x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09stream nextPutAll: 'var self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '}'",
  2184. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  2185. referencedClasses: []
  2186. }),
  2187. smalltalk.JSStream);
  2188. smalltalk.addMethod(
  2189. "_nextPutIf_with_",
  2190. smalltalk.method({
  2191. selector: "nextPutIf:with:",
  2192. category: 'streaming',
  2193. fn: function (aBlock, anotherBlock) {
  2194. var self=this;
  2195. smalltalk.send(self['@stream'], "_nextPutAll_", ["if("]);
  2196. smalltalk.send(aBlock, "_value", []);
  2197. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["){"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2198. smalltalk.send(anotherBlock, "_value", []);
  2199. smalltalk.send(self['@stream'], "_nextPutAll_", ["}"]);
  2200. return self;},
  2201. args: ["aBlock", "anotherBlock"],
  2202. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  2203. messageSends: ["nextPutAll:", "value", "lf"],
  2204. referencedClasses: []
  2205. }),
  2206. smalltalk.JSStream);
  2207. smalltalk.addMethod(
  2208. "_nextPutMethodDeclaration_with_",
  2209. smalltalk.method({
  2210. selector: "nextPutMethodDeclaration:with:",
  2211. category: 'streaming',
  2212. fn: function (aMethod, aBlock) {
  2213. var self=this;
  2214. (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(aMethod, "_selector", [])]), "__comma", ["\x22,"])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("source: ", "__comma", [smalltalk.send(smalltalk.send(aMethod, "_source", []), "_asJavascript", [])]), "__comma", [","])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2215. smalltalk.send(aBlock, "_value", []);
  2216. (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(smalltalk.send(smalltalk.send(aMethod, "_messageSends", []), "_asArray", []), "_asJavascript", []), "__comma", [","])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("args: ", "__comma", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod, "_arguments", []), "_collect_", [(function(each){return smalltalk.send(each, "_value", []);})]), "_asArray", []), "_asJavascript", [])]), "__comma", [","])]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["referencedClasses: ["]);})(self['@stream']);
  2217. smalltalk.send(smalltalk.send(aMethod, "_classReferences", []), "_do_separatedBy_", [(function(each){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(each, "_asJavascript", [])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [","]);})]);
  2218. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["]"]);return smalltalk.send($rec, "_nextPutAll_", ["})"]);})(self['@stream']);
  2219. return self;},
  2220. args: ["aMethod", "aBlock"],
  2221. source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream \x0a\x09\x09nextPutAll: 'smalltalk.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: \x22', aMethod selector, '\x22,'; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.\x0a\x09aBlock value.\x0a\x09stream \x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;\x0a \x09nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences \x0a\x09\x09do: [:each | stream nextPutAll: each asJavascript]\x0a\x09\x09separatedBy: [stream nextPutAll: ','].\x0a\x09stream \x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'",
  2222. messageSends: ["nextPutAll:", "lf", ",", "selector", "asJavascript", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"],
  2223. referencedClasses: ["String"]
  2224. }),
  2225. smalltalk.JSStream);
  2226. smalltalk.addMethod(
  2227. "_nextPutNonLocalReturnHandlingWith_",
  2228. smalltalk.method({
  2229. selector: "nextPutNonLocalReturnHandlingWith:",
  2230. category: 'streaming',
  2231. fn: function (aBlock) {
  2232. var self=this;
  2233. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["var $early={};"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", ["try {"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2234. smalltalk.send(aBlock, "_value", []);
  2235. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["}"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", ["catch(e) {if(e===$early)return e[0]; throw e}"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2236. return self;},
  2237. args: ["aBlock"],
  2238. source: "nextPutNonLocalReturnHandlingWith: aBlock\x0a\x09stream \x0a\x09\x09nextPutAll: 'var $early={};'; lf;\x0a\x09\x09nextPutAll: 'try {'; lf.\x0a\x09aBlock value.\x0a\x09stream \x0a\x09\x09nextPutAll: '}'; lf;\x0a\x09\x09nextPutAll: 'catch(e) {if(e===$early)return e[0]; throw e}'; lf",
  2239. messageSends: ["nextPutAll:", "lf", "value"],
  2240. referencedClasses: []
  2241. }),
  2242. smalltalk.JSStream);
  2243. smalltalk.addMethod(
  2244. "_nextPutNonLocalReturnWith_",
  2245. smalltalk.method({
  2246. selector: "nextPutNonLocalReturnWith:",
  2247. category: 'streaming',
  2248. fn: function (aBlock) {
  2249. var self=this;
  2250. smalltalk.send(self['@stream'], "_nextPutAll_", ["throw $early=["]);
  2251. smalltalk.send(aBlock, "_value", []);
  2252. smalltalk.send(self['@stream'], "_nextPutAll_", ["]"]);
  2253. return self;},
  2254. args: ["aBlock"],
  2255. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  2256. messageSends: ["nextPutAll:", "value"],
  2257. referencedClasses: []
  2258. }),
  2259. smalltalk.JSStream);
  2260. smalltalk.addMethod(
  2261. "_nextPutReturn",
  2262. smalltalk.method({
  2263. selector: "nextPutReturn",
  2264. category: 'streaming',
  2265. fn: function () {
  2266. var self=this;
  2267. smalltalk.send(self['@stream'], "_nextPutAll_", ["return "]);
  2268. return self;},
  2269. args: [],
  2270. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  2271. messageSends: ["nextPutAll:"],
  2272. referencedClasses: []
  2273. }),
  2274. smalltalk.JSStream);
  2275. smalltalk.addMethod(
  2276. "_nextPutReturnWith_",
  2277. smalltalk.method({
  2278. selector: "nextPutReturnWith:",
  2279. category: 'streaming',
  2280. fn: function (aBlock) {
  2281. var self=this;
  2282. smalltalk.send(self, "_nextPutReturn", []);
  2283. smalltalk.send(aBlock, "_value", []);
  2284. return self;},
  2285. args: ["aBlock"],
  2286. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  2287. messageSends: ["nextPutReturn", "value"],
  2288. referencedClasses: []
  2289. }),
  2290. smalltalk.JSStream);
  2291. smalltalk.addMethod(
  2292. "_nextPutSendTo_selector_arguments_",
  2293. smalltalk.method({
  2294. selector: "nextPutSendTo:selector:arguments:",
  2295. category: 'streaming',
  2296. fn: function (receiver, selector, arguments) {
  2297. var self=this;
  2298. smalltalk.send(self['@stream'], "_nextPutAll_", ["smalltalk.send("]);
  2299. smalltalk.send(receiver, "_emitOn_", [self]);
  2300. smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(",\x22", "__comma", [smalltalk.send(selector, "_asSelector", [])]), "__comma", ["\x22,["])]);
  2301. smalltalk.send(arguments, "_do_separatedBy_", [(function(each){return smalltalk.send(each, "_emitOn_", [self]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [","]);})]);
  2302. smalltalk.send(self['@stream'], "_nextPutAll_", ["])"]);
  2303. return self;},
  2304. args: ["receiver", "selector", "arguments"],
  2305. source: "nextPutSendTo: receiver selector: selector arguments: arguments\x0a\x09stream nextPutAll: 'smalltalk.send('.\x0a\x09receiver emitOn: self. \x0a\x09stream nextPutAll: ',\x22', selector asSelector, '\x22,['.\x0a\x09arguments \x0a\x09\x09do: [ :each | each emitOn: self ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: '])'",
  2306. messageSends: ["nextPutAll:", "emitOn:", ",", "asSelector", "do:separatedBy:"],
  2307. referencedClasses: []
  2308. }),
  2309. smalltalk.JSStream);
  2310. smalltalk.addMethod(
  2311. "_nextPutSequenceWith_",
  2312. smalltalk.method({
  2313. selector: "nextPutSequenceWith:",
  2314. category: 'streaming',
  2315. fn: function (aBlock) {
  2316. var self=this;
  2317. smalltalk.send(aBlock, "_value", []);
  2318. return self;},
  2319. args: ["aBlock"],
  2320. source: "nextPutSequenceWith: aBlock\x0a\x09\x22stream \x0a\x09\x09nextPutAll: 'switch(smalltalk.thisContext.pc){'; lf.\x22\x0a\x09aBlock value.\x0a\x09\x22stream \x0a\x09\x09nextPutAll: '};'; lf\x22",
  2321. messageSends: ["value"],
  2322. referencedClasses: []
  2323. }),
  2324. smalltalk.JSStream);
  2325. smalltalk.addMethod(
  2326. "_nextPutStatement_with_",
  2327. smalltalk.method({
  2328. selector: "nextPutStatement:with:",
  2329. category: 'streaming',
  2330. fn: function (anInteger, aBlock) {
  2331. var self=this;
  2332. (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("case ", "__comma", [smalltalk.send(anInteger, "_asString", [])]), "__comma", [":"])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2333. smalltalk.send(self, "_nextPutStatementWith_", [aBlock]);
  2334. (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("smalltalk.thisContext.pc=", "__comma", [smalltalk.send(((($receiver = anInteger).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])), "_asString", [])]), "__comma", [";"])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2335. return self;},
  2336. args: ["anInteger", "aBlock"],
  2337. source: "nextPutStatement: anInteger with: aBlock\x0a\x09stream nextPutAll: 'case ', anInteger asString, ':'; lf.\x0a\x09self nextPutStatementWith: aBlock.\x0a\x09stream nextPutAll: 'smalltalk.thisContext.pc=', (anInteger + 1) asString, ';'; lf",
  2338. messageSends: ["nextPutAll:", ",", "asString", "lf", "nextPutStatementWith:", "+"],
  2339. referencedClasses: []
  2340. }),
  2341. smalltalk.JSStream);
  2342. smalltalk.addMethod(
  2343. "_nextPutStatementWith_",
  2344. smalltalk.method({
  2345. selector: "nextPutStatementWith:",
  2346. category: 'streaming',
  2347. fn: function (aBlock) {
  2348. var self=this;
  2349. smalltalk.send(aBlock, "_value", []);
  2350. (function($rec){smalltalk.send($rec, "_nextPutAll_", [";"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2351. return self;},
  2352. args: ["aBlock"],
  2353. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  2354. messageSends: ["value", "nextPutAll:", "lf"],
  2355. referencedClasses: []
  2356. }),
  2357. smalltalk.JSStream);
  2358. smalltalk.addMethod(
  2359. "_nextPutVar_",
  2360. smalltalk.method({
  2361. selector: "nextPutVar:",
  2362. category: 'streaming',
  2363. fn: function (aString) {
  2364. var self=this;
  2365. (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("var ", "__comma", [aString]), "__comma", [";"])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2366. return self;},
  2367. args: ["aString"],
  2368. source: "nextPutVar: aString\x0a\x09stream nextPutAll: 'var ', aString, ';'; lf",
  2369. messageSends: ["nextPutAll:", ",", "lf"],
  2370. referencedClasses: []
  2371. }),
  2372. smalltalk.JSStream);
  2373. smalltalk.addMethod(
  2374. "_nextPutVars_",
  2375. smalltalk.method({
  2376. selector: "nextPutVars:",
  2377. category: 'streaming',
  2378. fn: function (aCollection) {
  2379. var self=this;
  2380. smalltalk.send(self['@stream'], "_nextPutAll_", ["var "]);
  2381. smalltalk.send(aCollection, "_do_separatedBy_", [(function(each){return smalltalk.send(self['@stream'], "_nextPutAll_", [each]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [","]);})]);
  2382. (function($rec){smalltalk.send($rec, "_nextPutAll_", [";"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2383. return self;},
  2384. args: ["aCollection"],
  2385. source: "nextPutVars: aCollection\x0a\x09stream nextPutAll: 'var '.\x0a\x09aCollection \x0a\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ';'; lf",
  2386. messageSends: ["nextPutAll:", "do:separatedBy:", "lf"],
  2387. referencedClasses: []
  2388. }),
  2389. smalltalk.JSStream);
  2390. smalltalk.addMethod(
  2391. "_appendToInstruction_",
  2392. smalltalk.method({
  2393. selector: "appendToInstruction:",
  2394. category: '*Compiler-IR',
  2395. fn: function (anIRInstruction) {
  2396. var self=this;
  2397. smalltalk.send(anIRInstruction, "_appendBlock_", [self]);
  2398. return self;},
  2399. args: ["anIRInstruction"],
  2400. source: "appendToInstruction: anIRInstruction\x0a anIRInstruction appendBlock: self",
  2401. messageSends: ["appendBlock:"],
  2402. referencedClasses: []
  2403. }),
  2404. smalltalk.BlockClosure);
  2405. smalltalk.addMethod(
  2406. "_asVariableName",
  2407. smalltalk.method({
  2408. selector: "asVariableName",
  2409. category: '*Compiler-IR',
  2410. fn: function () {
  2411. var self=this;
  2412. return ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_reservedWords", []), "_includes_", [self])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "__comma", ["_"]);})() : (function(){return self;})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self, "__comma", ["_"]);}), (function(){return self;})]));
  2413. return self;},
  2414. args: [],
  2415. source: "asVariableName\x0a\x09^ (Smalltalk current reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  2416. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", "current", ","],
  2417. referencedClasses: ["Smalltalk"]
  2418. }),
  2419. smalltalk.String);