Compiler-IR.js 93 KB

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