1
0

Compiler-IR.js 93 KB

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