1
0

Compiler-IR.js 97 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242
  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. "_javascriptSelector",
  1550. smalltalk.method({
  1551. selector: "javascriptSelector",
  1552. category: 'accessing',
  1553. fn: function (){
  1554. var self=this;
  1555. var $2,$1;
  1556. $2=smalltalk.send(self,"_classSend",[]);
  1557. if(($receiver = $2) == nil || $receiver == undefined){
  1558. $1=smalltalk.send(smalltalk.send(self,"_selector",[]),"_asSelector",[]);
  1559. } else {
  1560. $1=smalltalk.send(smalltalk.send(self,"_selector",[]),"_asSuperSelector",[]);
  1561. };
  1562. return $1;
  1563. },
  1564. args: [],
  1565. source: "javascriptSelector\x0a\x09^ self classSend \x0a \x09ifNil: [ self selector asSelector ]\x0a \x09ifNotNil: [ self selector asSuperSelector ]",
  1566. messageSends: ["ifNil:ifNotNil:", "asSelector", "selector", "asSuperSelector", "classSend"],
  1567. referencedClasses: []
  1568. }),
  1569. smalltalk.IRSend);
  1570. smalltalk.addMethod(
  1571. "_selector",
  1572. smalltalk.method({
  1573. selector: "selector",
  1574. category: 'accessing',
  1575. fn: function (){
  1576. var self=this;
  1577. return self["@selector"];
  1578. },
  1579. args: [],
  1580. source: "selector\x0a\x09^ selector",
  1581. messageSends: [],
  1582. referencedClasses: []
  1583. }),
  1584. smalltalk.IRSend);
  1585. smalltalk.addMethod(
  1586. "_selector_",
  1587. smalltalk.method({
  1588. selector: "selector:",
  1589. category: 'accessing',
  1590. fn: function (aString){
  1591. var self=this;
  1592. self["@selector"]=aString;
  1593. return self},
  1594. args: ["aString"],
  1595. source: "selector: aString\x0a\x09selector := aString",
  1596. messageSends: [],
  1597. referencedClasses: []
  1598. }),
  1599. smalltalk.IRSend);
  1600. smalltalk.addClass('IRSequence', smalltalk.IRInstruction, [], 'Compiler-IR');
  1601. smalltalk.addMethod(
  1602. "_accept_",
  1603. smalltalk.method({
  1604. selector: "accept:",
  1605. category: 'visiting',
  1606. fn: function (aVisitor){
  1607. var self=this;
  1608. var $1;
  1609. $1=smalltalk.send(aVisitor,"_visitIRSequence_",[self]);
  1610. return $1;
  1611. },
  1612. args: ["aVisitor"],
  1613. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  1614. messageSends: ["visitIRSequence:"],
  1615. referencedClasses: []
  1616. }),
  1617. smalltalk.IRSequence);
  1618. smalltalk.addMethod(
  1619. "_isSequence",
  1620. smalltalk.method({
  1621. selector: "isSequence",
  1622. category: 'testing',
  1623. fn: function (){
  1624. var self=this;
  1625. return true;
  1626. },
  1627. args: [],
  1628. source: "isSequence\x0a\x09^ true",
  1629. messageSends: [],
  1630. referencedClasses: []
  1631. }),
  1632. smalltalk.IRSequence);
  1633. smalltalk.addClass('IRBlockSequence', smalltalk.IRSequence, [], 'Compiler-IR');
  1634. smalltalk.addMethod(
  1635. "_accept_",
  1636. smalltalk.method({
  1637. selector: "accept:",
  1638. category: 'visiting',
  1639. fn: function (aVisitor){
  1640. var self=this;
  1641. var $1;
  1642. $1=smalltalk.send(aVisitor,"_visitIRBlockSequence_",[self]);
  1643. return $1;
  1644. },
  1645. args: ["aVisitor"],
  1646. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  1647. messageSends: ["visitIRBlockSequence:"],
  1648. referencedClasses: []
  1649. }),
  1650. smalltalk.IRBlockSequence);
  1651. smalltalk.addClass('IRTempDeclaration', smalltalk.IRInstruction, ['name'], 'Compiler-IR');
  1652. smalltalk.IRTempDeclaration.comment="I am a temporary variable declaration instruction"
  1653. smalltalk.addMethod(
  1654. "_accept_",
  1655. smalltalk.method({
  1656. selector: "accept:",
  1657. category: 'visiting',
  1658. fn: function (aVisitor){
  1659. var self=this;
  1660. var $1;
  1661. $1=smalltalk.send(aVisitor,"_visitIRTempDeclaration_",[self]);
  1662. return $1;
  1663. },
  1664. args: ["aVisitor"],
  1665. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  1666. messageSends: ["visitIRTempDeclaration:"],
  1667. referencedClasses: []
  1668. }),
  1669. smalltalk.IRTempDeclaration);
  1670. smalltalk.addMethod(
  1671. "_isTempDeclaration",
  1672. smalltalk.method({
  1673. selector: "isTempDeclaration",
  1674. category: 'visiting',
  1675. fn: function (){
  1676. var self=this;
  1677. return true;
  1678. },
  1679. args: [],
  1680. source: "isTempDeclaration\x0a\x09^ true",
  1681. messageSends: [],
  1682. referencedClasses: []
  1683. }),
  1684. smalltalk.IRTempDeclaration);
  1685. smalltalk.addMethod(
  1686. "_name",
  1687. smalltalk.method({
  1688. selector: "name",
  1689. category: 'accessing',
  1690. fn: function (){
  1691. var self=this;
  1692. return self["@name"];
  1693. },
  1694. args: [],
  1695. source: "name\x0a\x09^ name",
  1696. messageSends: [],
  1697. referencedClasses: []
  1698. }),
  1699. smalltalk.IRTempDeclaration);
  1700. smalltalk.addMethod(
  1701. "_name_",
  1702. smalltalk.method({
  1703. selector: "name:",
  1704. category: 'accessing',
  1705. fn: function (aString){
  1706. var self=this;
  1707. self["@name"]=aString;
  1708. return self},
  1709. args: ["aString"],
  1710. source: "name: aString\x0a\x09name := aString",
  1711. messageSends: [],
  1712. referencedClasses: []
  1713. }),
  1714. smalltalk.IRTempDeclaration);
  1715. smalltalk.addClass('IRValue', smalltalk.IRInstruction, ['value'], 'Compiler-IR');
  1716. smalltalk.IRValue.comment="I am the simplest possible instruction. I represent a value."
  1717. smalltalk.addMethod(
  1718. "_accept_",
  1719. smalltalk.method({
  1720. selector: "accept:",
  1721. category: 'visiting',
  1722. fn: function (aVisitor){
  1723. var self=this;
  1724. var $1;
  1725. $1=smalltalk.send(aVisitor,"_visitIRValue_",[self]);
  1726. return $1;
  1727. },
  1728. args: ["aVisitor"],
  1729. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  1730. messageSends: ["visitIRValue:"],
  1731. referencedClasses: []
  1732. }),
  1733. smalltalk.IRValue);
  1734. smalltalk.addMethod(
  1735. "_value",
  1736. smalltalk.method({
  1737. selector: "value",
  1738. category: 'accessing',
  1739. fn: function (){
  1740. var self=this;
  1741. return self["@value"];
  1742. },
  1743. args: [],
  1744. source: "value\x0a\x09^value",
  1745. messageSends: [],
  1746. referencedClasses: []
  1747. }),
  1748. smalltalk.IRValue);
  1749. smalltalk.addMethod(
  1750. "_value_",
  1751. smalltalk.method({
  1752. selector: "value:",
  1753. category: 'accessing',
  1754. fn: function (aString){
  1755. var self=this;
  1756. self["@value"]=aString;
  1757. return self},
  1758. args: ["aString"],
  1759. source: "value: aString\x0a\x09value := aString",
  1760. messageSends: [],
  1761. referencedClasses: []
  1762. }),
  1763. smalltalk.IRValue);
  1764. smalltalk.addClass('IRVariable', smalltalk.IRInstruction, ['variable'], 'Compiler-IR');
  1765. smalltalk.IRVariable.comment="I am a variable instruction."
  1766. smalltalk.addMethod(
  1767. "_accept_",
  1768. smalltalk.method({
  1769. selector: "accept:",
  1770. category: 'visiting',
  1771. fn: function (aVisitor){
  1772. var self=this;
  1773. var $1;
  1774. $1=smalltalk.send(aVisitor,"_visitIRVariable_",[self]);
  1775. return $1;
  1776. },
  1777. args: ["aVisitor"],
  1778. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  1779. messageSends: ["visitIRVariable:"],
  1780. referencedClasses: []
  1781. }),
  1782. smalltalk.IRVariable);
  1783. smalltalk.addMethod(
  1784. "_isVariable",
  1785. smalltalk.method({
  1786. selector: "isVariable",
  1787. category: 'testing',
  1788. fn: function (){
  1789. var self=this;
  1790. return true;
  1791. },
  1792. args: [],
  1793. source: "isVariable\x0a\x09^ true",
  1794. messageSends: [],
  1795. referencedClasses: []
  1796. }),
  1797. smalltalk.IRVariable);
  1798. smalltalk.addMethod(
  1799. "_variable",
  1800. smalltalk.method({
  1801. selector: "variable",
  1802. category: 'accessing',
  1803. fn: function (){
  1804. var self=this;
  1805. return self["@variable"];
  1806. },
  1807. args: [],
  1808. source: "variable\x0a\x09^ variable",
  1809. messageSends: [],
  1810. referencedClasses: []
  1811. }),
  1812. smalltalk.IRVariable);
  1813. smalltalk.addMethod(
  1814. "_variable_",
  1815. smalltalk.method({
  1816. selector: "variable:",
  1817. category: 'accessing',
  1818. fn: function (aScopeVariable){
  1819. var self=this;
  1820. self["@variable"]=aScopeVariable;
  1821. return self},
  1822. args: ["aScopeVariable"],
  1823. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  1824. messageSends: [],
  1825. referencedClasses: []
  1826. }),
  1827. smalltalk.IRVariable);
  1828. smalltalk.addClass('IRVerbatim', smalltalk.IRInstruction, ['source'], 'Compiler-IR');
  1829. smalltalk.addMethod(
  1830. "_accept_",
  1831. smalltalk.method({
  1832. selector: "accept:",
  1833. category: 'visiting',
  1834. fn: function (aVisitor){
  1835. var self=this;
  1836. var $1;
  1837. $1=smalltalk.send(aVisitor,"_visitIRVerbatim_",[self]);
  1838. return $1;
  1839. },
  1840. args: ["aVisitor"],
  1841. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  1842. messageSends: ["visitIRVerbatim:"],
  1843. referencedClasses: []
  1844. }),
  1845. smalltalk.IRVerbatim);
  1846. smalltalk.addMethod(
  1847. "_source",
  1848. smalltalk.method({
  1849. selector: "source",
  1850. category: 'accessing',
  1851. fn: function (){
  1852. var self=this;
  1853. return self["@source"];
  1854. },
  1855. args: [],
  1856. source: "source\x0a\x09^ source",
  1857. messageSends: [],
  1858. referencedClasses: []
  1859. }),
  1860. smalltalk.IRVerbatim);
  1861. smalltalk.addMethod(
  1862. "_source_",
  1863. smalltalk.method({
  1864. selector: "source:",
  1865. category: 'accessing',
  1866. fn: function (aString){
  1867. var self=this;
  1868. self["@source"]=aString;
  1869. return self},
  1870. args: ["aString"],
  1871. source: "source: aString\x0a\x09source := aString",
  1872. messageSends: [],
  1873. referencedClasses: []
  1874. }),
  1875. smalltalk.IRVerbatim);
  1876. smalltalk.addClass('IRVisitor', smalltalk.Object, [], 'Compiler-IR');
  1877. smalltalk.addMethod(
  1878. "_visit_",
  1879. smalltalk.method({
  1880. selector: "visit:",
  1881. category: 'visiting',
  1882. fn: function (anIRInstruction){
  1883. var self=this;
  1884. var $1;
  1885. $1=smalltalk.send(anIRInstruction,"_accept_",[self]);
  1886. return $1;
  1887. },
  1888. args: ["anIRInstruction"],
  1889. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  1890. messageSends: ["accept:"],
  1891. referencedClasses: []
  1892. }),
  1893. smalltalk.IRVisitor);
  1894. smalltalk.addMethod(
  1895. "_visitIRAssignment_",
  1896. smalltalk.method({
  1897. selector: "visitIRAssignment:",
  1898. category: 'visiting',
  1899. fn: function (anIRAssignment){
  1900. var self=this;
  1901. var $1;
  1902. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRAssignment]);
  1903. return $1;
  1904. },
  1905. args: ["anIRAssignment"],
  1906. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  1907. messageSends: ["visitIRInstruction:"],
  1908. referencedClasses: []
  1909. }),
  1910. smalltalk.IRVisitor);
  1911. smalltalk.addMethod(
  1912. "_visitIRBlockReturn_",
  1913. smalltalk.method({
  1914. selector: "visitIRBlockReturn:",
  1915. category: 'visiting',
  1916. fn: function (anIRBlockReturn){
  1917. var self=this;
  1918. var $1;
  1919. $1=smalltalk.send(self,"_visitIRReturn_",[anIRBlockReturn]);
  1920. return $1;
  1921. },
  1922. args: ["anIRBlockReturn"],
  1923. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  1924. messageSends: ["visitIRReturn:"],
  1925. referencedClasses: []
  1926. }),
  1927. smalltalk.IRVisitor);
  1928. smalltalk.addMethod(
  1929. "_visitIRBlockSequence_",
  1930. smalltalk.method({
  1931. selector: "visitIRBlockSequence:",
  1932. category: 'visiting',
  1933. fn: function (anIRBlockSequence){
  1934. var self=this;
  1935. var $1;
  1936. $1=smalltalk.send(self,"_visitIRSequence_",[anIRBlockSequence]);
  1937. return $1;
  1938. },
  1939. args: ["anIRBlockSequence"],
  1940. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  1941. messageSends: ["visitIRSequence:"],
  1942. referencedClasses: []
  1943. }),
  1944. smalltalk.IRVisitor);
  1945. smalltalk.addMethod(
  1946. "_visitIRClosure_",
  1947. smalltalk.method({
  1948. selector: "visitIRClosure:",
  1949. category: 'visiting',
  1950. fn: function (anIRClosure){
  1951. var self=this;
  1952. var $1;
  1953. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRClosure]);
  1954. return $1;
  1955. },
  1956. args: ["anIRClosure"],
  1957. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  1958. messageSends: ["visitIRInstruction:"],
  1959. referencedClasses: []
  1960. }),
  1961. smalltalk.IRVisitor);
  1962. smalltalk.addMethod(
  1963. "_visitIRDynamicArray_",
  1964. smalltalk.method({
  1965. selector: "visitIRDynamicArray:",
  1966. category: 'visiting',
  1967. fn: function (anIRDynamicArray){
  1968. var self=this;
  1969. var $1;
  1970. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRDynamicArray]);
  1971. return $1;
  1972. },
  1973. args: ["anIRDynamicArray"],
  1974. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  1975. messageSends: ["visitIRInstruction:"],
  1976. referencedClasses: []
  1977. }),
  1978. smalltalk.IRVisitor);
  1979. smalltalk.addMethod(
  1980. "_visitIRDynamicDictionary_",
  1981. smalltalk.method({
  1982. selector: "visitIRDynamicDictionary:",
  1983. category: 'visiting',
  1984. fn: function (anIRDynamicDictionary){
  1985. var self=this;
  1986. var $1;
  1987. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRDynamicDictionary]);
  1988. return $1;
  1989. },
  1990. args: ["anIRDynamicDictionary"],
  1991. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  1992. messageSends: ["visitIRInstruction:"],
  1993. referencedClasses: []
  1994. }),
  1995. smalltalk.IRVisitor);
  1996. smalltalk.addMethod(
  1997. "_visitIRInlinedClosure_",
  1998. smalltalk.method({
  1999. selector: "visitIRInlinedClosure:",
  2000. category: 'visiting',
  2001. fn: function (anIRInlinedClosure){
  2002. var self=this;
  2003. var $1;
  2004. $1=smalltalk.send(self,"_visitIRClosure_",[anIRInlinedClosure]);
  2005. return $1;
  2006. },
  2007. args: ["anIRInlinedClosure"],
  2008. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  2009. messageSends: ["visitIRClosure:"],
  2010. referencedClasses: []
  2011. }),
  2012. smalltalk.IRVisitor);
  2013. smalltalk.addMethod(
  2014. "_visitIRInlinedSequence_",
  2015. smalltalk.method({
  2016. selector: "visitIRInlinedSequence:",
  2017. category: 'visiting',
  2018. fn: function (anIRInlinedSequence){
  2019. var self=this;
  2020. var $1;
  2021. $1=smalltalk.send(self,"_visitIRSequence_",[anIRInlinedSequence]);
  2022. return $1;
  2023. },
  2024. args: ["anIRInlinedSequence"],
  2025. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  2026. messageSends: ["visitIRSequence:"],
  2027. referencedClasses: []
  2028. }),
  2029. smalltalk.IRVisitor);
  2030. smalltalk.addMethod(
  2031. "_visitIRInstruction_",
  2032. smalltalk.method({
  2033. selector: "visitIRInstruction:",
  2034. category: 'visiting',
  2035. fn: function (anIRInstruction){
  2036. var self=this;
  2037. smalltalk.send(smalltalk.send(anIRInstruction,"_instructions",[]),"_do_",[(function(each){
  2038. return smalltalk.send(self,"_visit_",[each]);
  2039. })]);
  2040. return anIRInstruction;
  2041. },
  2042. args: ["anIRInstruction"],
  2043. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  2044. messageSends: ["do:", "visit:", "instructions"],
  2045. referencedClasses: []
  2046. }),
  2047. smalltalk.IRVisitor);
  2048. smalltalk.addMethod(
  2049. "_visitIRMethod_",
  2050. smalltalk.method({
  2051. selector: "visitIRMethod:",
  2052. category: 'visiting',
  2053. fn: function (anIRMethod){
  2054. var self=this;
  2055. var $1;
  2056. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRMethod]);
  2057. return $1;
  2058. },
  2059. args: ["anIRMethod"],
  2060. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  2061. messageSends: ["visitIRInstruction:"],
  2062. referencedClasses: []
  2063. }),
  2064. smalltalk.IRVisitor);
  2065. smalltalk.addMethod(
  2066. "_visitIRNonLocalReturn_",
  2067. smalltalk.method({
  2068. selector: "visitIRNonLocalReturn:",
  2069. category: 'visiting',
  2070. fn: function (anIRNonLocalReturn){
  2071. var self=this;
  2072. var $1;
  2073. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRNonLocalReturn]);
  2074. return $1;
  2075. },
  2076. args: ["anIRNonLocalReturn"],
  2077. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  2078. messageSends: ["visitIRInstruction:"],
  2079. referencedClasses: []
  2080. }),
  2081. smalltalk.IRVisitor);
  2082. smalltalk.addMethod(
  2083. "_visitIRNonLocalReturnHandling_",
  2084. smalltalk.method({
  2085. selector: "visitIRNonLocalReturnHandling:",
  2086. category: 'visiting',
  2087. fn: function (anIRNonLocalReturnHandling){
  2088. var self=this;
  2089. var $1;
  2090. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRNonLocalReturnHandling]);
  2091. return $1;
  2092. },
  2093. args: ["anIRNonLocalReturnHandling"],
  2094. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  2095. messageSends: ["visitIRInstruction:"],
  2096. referencedClasses: []
  2097. }),
  2098. smalltalk.IRVisitor);
  2099. smalltalk.addMethod(
  2100. "_visitIRReturn_",
  2101. smalltalk.method({
  2102. selector: "visitIRReturn:",
  2103. category: 'visiting',
  2104. fn: function (anIRReturn){
  2105. var self=this;
  2106. var $1;
  2107. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRReturn]);
  2108. return $1;
  2109. },
  2110. args: ["anIRReturn"],
  2111. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  2112. messageSends: ["visitIRInstruction:"],
  2113. referencedClasses: []
  2114. }),
  2115. smalltalk.IRVisitor);
  2116. smalltalk.addMethod(
  2117. "_visitIRSend_",
  2118. smalltalk.method({
  2119. selector: "visitIRSend:",
  2120. category: 'visiting',
  2121. fn: function (anIRSend){
  2122. var self=this;
  2123. var $1;
  2124. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRSend]);
  2125. return $1;
  2126. },
  2127. args: ["anIRSend"],
  2128. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  2129. messageSends: ["visitIRInstruction:"],
  2130. referencedClasses: []
  2131. }),
  2132. smalltalk.IRVisitor);
  2133. smalltalk.addMethod(
  2134. "_visitIRSequence_",
  2135. smalltalk.method({
  2136. selector: "visitIRSequence:",
  2137. category: 'visiting',
  2138. fn: function (anIRSequence){
  2139. var self=this;
  2140. var $1;
  2141. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRSequence]);
  2142. return $1;
  2143. },
  2144. args: ["anIRSequence"],
  2145. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  2146. messageSends: ["visitIRInstruction:"],
  2147. referencedClasses: []
  2148. }),
  2149. smalltalk.IRVisitor);
  2150. smalltalk.addMethod(
  2151. "_visitIRTempDeclaration_",
  2152. smalltalk.method({
  2153. selector: "visitIRTempDeclaration:",
  2154. category: 'visiting',
  2155. fn: function (anIRTempDeclaration){
  2156. var self=this;
  2157. var $1;
  2158. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRTempDeclaration]);
  2159. return $1;
  2160. },
  2161. args: ["anIRTempDeclaration"],
  2162. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  2163. messageSends: ["visitIRInstruction:"],
  2164. referencedClasses: []
  2165. }),
  2166. smalltalk.IRVisitor);
  2167. smalltalk.addMethod(
  2168. "_visitIRValue_",
  2169. smalltalk.method({
  2170. selector: "visitIRValue:",
  2171. category: 'visiting',
  2172. fn: function (anIRValue){
  2173. var self=this;
  2174. var $1;
  2175. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRValue]);
  2176. return $1;
  2177. },
  2178. args: ["anIRValue"],
  2179. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  2180. messageSends: ["visitIRInstruction:"],
  2181. referencedClasses: []
  2182. }),
  2183. smalltalk.IRVisitor);
  2184. smalltalk.addMethod(
  2185. "_visitIRVariable_",
  2186. smalltalk.method({
  2187. selector: "visitIRVariable:",
  2188. category: 'visiting',
  2189. fn: function (anIRVariable){
  2190. var self=this;
  2191. var $1;
  2192. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRVariable]);
  2193. return $1;
  2194. },
  2195. args: ["anIRVariable"],
  2196. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  2197. messageSends: ["visitIRInstruction:"],
  2198. referencedClasses: []
  2199. }),
  2200. smalltalk.IRVisitor);
  2201. smalltalk.addMethod(
  2202. "_visitIRVerbatim_",
  2203. smalltalk.method({
  2204. selector: "visitIRVerbatim:",
  2205. category: 'visiting',
  2206. fn: function (anIRVerbatim){
  2207. var self=this;
  2208. var $1;
  2209. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRVerbatim]);
  2210. return $1;
  2211. },
  2212. args: ["anIRVerbatim"],
  2213. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  2214. messageSends: ["visitIRInstruction:"],
  2215. referencedClasses: []
  2216. }),
  2217. smalltalk.IRVisitor);
  2218. smalltalk.addClass('IRJSTranslator', smalltalk.IRVisitor, ['stream'], 'Compiler-IR');
  2219. smalltalk.addMethod(
  2220. "_contents",
  2221. smalltalk.method({
  2222. selector: "contents",
  2223. category: 'accessing',
  2224. fn: function (){
  2225. var self=this;
  2226. var $1;
  2227. $1=smalltalk.send(smalltalk.send(self,"_stream",[]),"_contents",[]);
  2228. return $1;
  2229. },
  2230. args: [],
  2231. source: "contents\x0a\x09^ self stream contents",
  2232. messageSends: ["contents", "stream"],
  2233. referencedClasses: []
  2234. }),
  2235. smalltalk.IRJSTranslator);
  2236. smalltalk.addMethod(
  2237. "_initialize",
  2238. smalltalk.method({
  2239. selector: "initialize",
  2240. category: 'initialization',
  2241. fn: function (){
  2242. var self=this;
  2243. smalltalk.send(self,"_initialize",[],smalltalk.IRVisitor);
  2244. self["@stream"]=smalltalk.send((smalltalk.JSStream || JSStream),"_new",[]);
  2245. return self},
  2246. args: [],
  2247. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  2248. messageSends: ["initialize", "new"],
  2249. referencedClasses: ["JSStream"]
  2250. }),
  2251. smalltalk.IRJSTranslator);
  2252. smalltalk.addMethod(
  2253. "_stream",
  2254. smalltalk.method({
  2255. selector: "stream",
  2256. category: 'accessing',
  2257. fn: function (){
  2258. var self=this;
  2259. return self["@stream"];
  2260. },
  2261. args: [],
  2262. source: "stream\x0a\x09^ stream",
  2263. messageSends: [],
  2264. referencedClasses: []
  2265. }),
  2266. smalltalk.IRJSTranslator);
  2267. smalltalk.addMethod(
  2268. "_stream_",
  2269. smalltalk.method({
  2270. selector: "stream:",
  2271. category: 'accessing',
  2272. fn: function (aStream){
  2273. var self=this;
  2274. self["@stream"]=aStream;
  2275. return self},
  2276. args: ["aStream"],
  2277. source: "stream: aStream\x0a\x09stream := aStream",
  2278. messageSends: [],
  2279. referencedClasses: []
  2280. }),
  2281. smalltalk.IRJSTranslator);
  2282. smalltalk.addMethod(
  2283. "_visitIRAssignment_",
  2284. smalltalk.method({
  2285. selector: "visitIRAssignment:",
  2286. category: 'visiting',
  2287. fn: function (anIRAssignment){
  2288. var self=this;
  2289. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_first",[])]);
  2290. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAssignment",[]);
  2291. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_last",[])]);
  2292. return self},
  2293. args: ["anIRAssignment"],
  2294. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  2295. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"],
  2296. referencedClasses: []
  2297. }),
  2298. smalltalk.IRJSTranslator);
  2299. smalltalk.addMethod(
  2300. "_visitIRClosure_",
  2301. smalltalk.method({
  2302. selector: "visitIRClosure:",
  2303. category: 'visiting',
  2304. fn: function (anIRClosure){
  2305. var self=this;
  2306. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutClosureWith_arguments_",[(function(){
  2307. return smalltalk.send(self,"_visitIRClosure_",[anIRClosure],smalltalk.IRVisitor);
  2308. }),smalltalk.send(anIRClosure,"_arguments",[])]);
  2309. return self},
  2310. args: ["anIRClosure"],
  2311. source: "visitIRClosure: anIRClosure\x0a\x09self stream \x0a\x09\x09nextPutClosureWith: [ super visitIRClosure: anIRClosure ] \x0a\x09\x09arguments: anIRClosure arguments",
  2312. messageSends: ["nextPutClosureWith:arguments:", "visitIRClosure:", "arguments", "stream"],
  2313. referencedClasses: []
  2314. }),
  2315. smalltalk.IRJSTranslator);
  2316. smalltalk.addMethod(
  2317. "_visitIRDynamicArray_",
  2318. smalltalk.method({
  2319. selector: "visitIRDynamicArray:",
  2320. category: 'visiting',
  2321. fn: function (anIRDynamicArray){
  2322. var self=this;
  2323. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["["]);
  2324. smalltalk.send(smalltalk.send(anIRDynamicArray,"_instructions",[]),"_do_separatedBy_",[(function(each){
  2325. return smalltalk.send(self,"_visit_",[each]);
  2326. }),(function(){
  2327. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[","]);
  2328. })]);
  2329. smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
  2330. return self},
  2331. args: ["anIRDynamicArray"],
  2332. 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: ']'",
  2333. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:", "instructions"],
  2334. referencedClasses: []
  2335. }),
  2336. smalltalk.IRJSTranslator);
  2337. smalltalk.addMethod(
  2338. "_visitIRDynamicDictionary_",
  2339. smalltalk.method({
  2340. selector: "visitIRDynamicDictionary:",
  2341. category: 'visiting',
  2342. fn: function (anIRDynamicDictionary){
  2343. var self=this;
  2344. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.HashedCollection._fromPairs_(["]);
  2345. smalltalk.send(smalltalk.send(anIRDynamicDictionary,"_instructions",[]),"_do_separatedBy_",[(function(each){
  2346. return smalltalk.send(self,"_visit_",[each]);
  2347. }),(function(){
  2348. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[","]);
  2349. })]);
  2350. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["])"]);
  2351. return self},
  2352. args: ["anIRDynamicDictionary"],
  2353. 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: '])'",
  2354. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:", "instructions"],
  2355. referencedClasses: []
  2356. }),
  2357. smalltalk.IRJSTranslator);
  2358. smalltalk.addMethod(
  2359. "_visitIRMethod_",
  2360. smalltalk.method({
  2361. selector: "visitIRMethod:",
  2362. category: 'visiting',
  2363. fn: function (anIRMethod){
  2364. var self=this;
  2365. var $1,$2;
  2366. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutMethodDeclaration_with_",[anIRMethod,(function(){
  2367. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutFunctionWith_arguments_",[(function(){
  2368. $1=smalltalk.send(smalltalk.send(anIRMethod,"_internalVariables",[]),"_notEmpty",[]);
  2369. if(smalltalk.assert($1)){
  2370. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutVars_",[smalltalk.send(smalltalk.send(smalltalk.send(anIRMethod,"_internalVariables",[]),"_asArray",[]),"_collect_",[(function(each){
  2371. return smalltalk.send(smalltalk.send(each,"_variable",[]),"_alias",[]);
  2372. })])]);
  2373. };
  2374. $2=smalltalk.send(smalltalk.send(anIRMethod,"_scope",[]),"_hasNonLocalReturn",[]);
  2375. if(smalltalk.assert($2)){
  2376. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutNonLocalReturnHandlingWith_",[(function(){
  2377. return smalltalk.send(self,"_visitIRMethod_",[anIRMethod],smalltalk.IRVisitor);
  2378. })]);
  2379. } else {
  2380. return smalltalk.send(self,"_visitIRMethod_",[anIRMethod],smalltalk.IRVisitor);
  2381. };
  2382. }),smalltalk.send(anIRMethod,"_arguments",[])]);
  2383. })]);
  2384. return self},
  2385. args: ["anIRMethod"],
  2386. 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 ]",
  2387. messageSends: ["nextPutMethodDeclaration:with:", "nextPutFunctionWith:arguments:", "ifTrue:", "nextPutVars:", "collect:", "alias", "variable", "asArray", "internalVariables", "stream", "notEmpty", "ifTrue:ifFalse:", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "hasNonLocalReturn", "scope", "arguments"],
  2388. referencedClasses: []
  2389. }),
  2390. smalltalk.IRJSTranslator);
  2391. smalltalk.addMethod(
  2392. "_visitIRNonLocalReturn_",
  2393. smalltalk.method({
  2394. selector: "visitIRNonLocalReturn:",
  2395. category: 'visiting',
  2396. fn: function (anIRNonLocalReturn){
  2397. var self=this;
  2398. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutNonLocalReturnWith_",[(function(){
  2399. return smalltalk.send(self,"_visitIRNonLocalReturn_",[anIRNonLocalReturn],smalltalk.IRVisitor);
  2400. })]);
  2401. return self},
  2402. args: ["anIRNonLocalReturn"],
  2403. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  2404. messageSends: ["nextPutNonLocalReturnWith:", "visitIRNonLocalReturn:", "stream"],
  2405. referencedClasses: []
  2406. }),
  2407. smalltalk.IRJSTranslator);
  2408. smalltalk.addMethod(
  2409. "_visitIRReturn_",
  2410. smalltalk.method({
  2411. selector: "visitIRReturn:",
  2412. category: 'visiting',
  2413. fn: function (anIRReturn){
  2414. var self=this;
  2415. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutReturnWith_",[(function(){
  2416. return smalltalk.send(self,"_visitIRReturn_",[anIRReturn],smalltalk.IRVisitor);
  2417. })]);
  2418. return self},
  2419. args: ["anIRReturn"],
  2420. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  2421. messageSends: ["nextPutReturnWith:", "visitIRReturn:", "stream"],
  2422. referencedClasses: []
  2423. }),
  2424. smalltalk.IRJSTranslator);
  2425. smalltalk.addMethod(
  2426. "_visitIRSend_",
  2427. smalltalk.method({
  2428. selector: "visitIRSend:",
  2429. category: 'visiting',
  2430. fn: function (anIRSend){
  2431. var self=this;
  2432. var $1,$2,$3;
  2433. $1=_st(anIRSend)._classSend();
  2434. if(($receiver = $1) == nil || $receiver == undefined){
  2435. _st(_st(self)._stream())._nextPutAll_("_st(");
  2436. _st(self)._visit_(_st(_st(anIRSend)._instructions())._first());
  2437. _st(_st(self)._stream())._nextPutAll_(_st(_st(").").__comma(_st(_st(anIRSend)._selector())._asSelector())).__comma("("));
  2438. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  2439. return _st(self)._visit_(each);
  2440. }),(function(){
  2441. return _st(_st(self)._stream())._nextPutAll_(",");
  2442. }));
  2443. _st(_st(self)._stream())._nextPutAll_(")");
  2444. } else {
  2445. $2=_st(self)._stream();
  2446. _st($2)._nextPutAll_(_st(_st(_st(anIRSend)._classSend())._asJavascript()).__comma(".fn.prototype."));
  2447. _st($2)._nextPutAll_(_st(_st(_st(anIRSend)._selector())._asSelector()).__comma(".apply("));
  2448. $3=_st($2)._nextPutAll_("_st(");
  2449. $3;
  2450. _st(self)._visit_(_st(_st(anIRSend)._instructions())._first());
  2451. _st(_st(self)._stream())._nextPutAll_("), [");
  2452. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  2453. return _st(self)._visit_(each);
  2454. }),(function(){
  2455. return _st(_st(self)._stream())._nextPutAll_(",");
  2456. }));
  2457. _st(_st(self)._stream())._nextPutAll_("])");
  2458. };
  2459. return self},
  2460. args: ["anIRSend"],
  2461. source: "visitIRSend: anIRSend\x0a\x09anIRSend classSend \x0a \x09ifNil: [\x0a\x09\x09\x09self stream nextPutAll: '_st('.\x0a\x09\x09\x09self visit: anIRSend instructions first.\x0a \x09\x09 \x09self stream nextPutAll: ').', anIRSend selector asSelector, '('.\x0a\x09\x09\x09anIRSend instructions allButFirst\x0a\x09\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09ifNotNil: [ \x0a\x09\x09\x09self stream \x0a \x09nextPutAll: anIRSend classSend asJavascript, '.fn.prototype.';\x0a\x09\x09\x09\x09nextPutAll: anIRSend selector asSelector, '.apply(';\x0a\x09\x09\x09\x09nextPutAll: '_st('.\x0a\x09\x09\x09self visit: anIRSend instructions first.\x0a\x09\x09\x09self stream nextPutAll: '), ['.\x0a\x09\x09\x09anIRSend instructions allButFirst\x0a\x09\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09\x09\x09self stream nextPutAll: '])' ]",
  2462. messageSends: ["ifNil:ifNotNil:", "nextPutAll:", "stream", "visit:", "first", "instructions", ",", "asSelector", "selector", "do:separatedBy:", "allButFirst", "asJavascript", "classSend"],
  2463. referencedClasses: []
  2464. }),
  2465. smalltalk.IRJSTranslator);
  2466. smalltalk.addMethod(
  2467. "_visitIRSendOld_",
  2468. smalltalk.method({
  2469. selector: "visitIRSendOld:",
  2470. category: 'visiting',
  2471. fn: function (anIRSend){
  2472. var self=this;
  2473. var $1;
  2474. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.send("]);
  2475. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRSend,"_instructions",[]),"_first",[])]);
  2476. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(smalltalk.send(",\x22","__comma",[smalltalk.send(smalltalk.send(anIRSend,"_selector",[]),"_asSelector",[])]),"__comma",["\x22,["])]);
  2477. smalltalk.send(smalltalk.send(smalltalk.send(anIRSend,"_instructions",[]),"_allButFirst",[]),"_do_separatedBy_",[(function(each){
  2478. return smalltalk.send(self,"_visit_",[each]);
  2479. }),(function(){
  2480. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[","]);
  2481. })]);
  2482. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["]"]);
  2483. $1=smalltalk.send(anIRSend,"_classSend",[]);
  2484. if(($receiver = $1) == nil || $receiver == undefined){
  2485. $1;
  2486. } else {
  2487. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(",","__comma",[smalltalk.send(smalltalk.send(anIRSend,"_classSend",[]),"_asJavascript",[])])]);
  2488. };
  2489. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[")"]);
  2490. return self},
  2491. args: ["anIRSend"],
  2492. source: "visitIRSendOld: 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: ')'",
  2493. messageSends: ["nextPutAll:", "stream", "visit:", "first", "instructions", ",", "asSelector", "selector", "do:separatedBy:", "allButFirst", "ifNotNil:", "asJavascript", "classSend"],
  2494. referencedClasses: []
  2495. }),
  2496. smalltalk.IRJSTranslator);
  2497. smalltalk.addMethod(
  2498. "_visitIRSequence_",
  2499. smalltalk.method({
  2500. selector: "visitIRSequence:",
  2501. category: 'visiting',
  2502. fn: function (anIRSequence){
  2503. var self=this;
  2504. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutSequenceWith_",[(function(){
  2505. return smalltalk.send(smalltalk.send(anIRSequence,"_instructions",[]),"_do_",[(function(each){
  2506. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[smalltalk.send(self,"_visit_",[each])]);
  2507. })]);
  2508. })]);
  2509. return self},
  2510. args: ["anIRSequence"],
  2511. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ]]",
  2512. messageSends: ["nextPutSequenceWith:", "do:", "nextPutStatementWith:", "visit:", "stream", "instructions"],
  2513. referencedClasses: []
  2514. }),
  2515. smalltalk.IRJSTranslator);
  2516. smalltalk.addMethod(
  2517. "_visitIRTempDeclaration_",
  2518. smalltalk.method({
  2519. selector: "visitIRTempDeclaration:",
  2520. category: 'visiting',
  2521. fn: function (anIRTempDeclaration){
  2522. var self=this;
  2523. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutVar_",[smalltalk.send(smalltalk.send(anIRTempDeclaration,"_name",[]),"_asVariableName",[])]);
  2524. return self},
  2525. args: ["anIRTempDeclaration"],
  2526. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09self stream nextPutVar: anIRTempDeclaration name asVariableName",
  2527. messageSends: ["nextPutVar:", "asVariableName", "name", "stream"],
  2528. referencedClasses: []
  2529. }),
  2530. smalltalk.IRJSTranslator);
  2531. smalltalk.addMethod(
  2532. "_visitIRValue_",
  2533. smalltalk.method({
  2534. selector: "visitIRValue:",
  2535. category: 'visiting',
  2536. fn: function (anIRValue){
  2537. var self=this;
  2538. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(smalltalk.send(anIRValue,"_value",[]),"_asJavascript",[])]);
  2539. return self},
  2540. args: ["anIRValue"],
  2541. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  2542. messageSends: ["nextPutAll:", "asJavascript", "value", "stream"],
  2543. referencedClasses: []
  2544. }),
  2545. smalltalk.IRJSTranslator);
  2546. smalltalk.addMethod(
  2547. "_visitIRVariable_",
  2548. smalltalk.method({
  2549. selector: "visitIRVariable:",
  2550. category: 'visiting',
  2551. fn: function (anIRVariable){
  2552. var self=this;
  2553. var $1;
  2554. $1=smalltalk.send(smalltalk.send(smalltalk.send(anIRVariable,"_variable",[]),"_name",[]),"__eq",["thisContext"]);
  2555. if(smalltalk.assert($1)){
  2556. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.getThisContext()"]);
  2557. } else {
  2558. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(smalltalk.send(anIRVariable,"_variable",[]),"_alias",[])]);
  2559. };
  2560. return self},
  2561. args: ["anIRVariable"],
  2562. source: "visitIRVariable: anIRVariable\x0a\x09anIRVariable variable name = 'thisContext'\x0a \x09ifTrue: [ self stream nextPutAll: 'smalltalk.getThisContext()' ]\x0a \x09ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]",
  2563. messageSends: ["ifTrue:ifFalse:", "nextPutAll:", "stream", "alias", "variable", "=", "name"],
  2564. referencedClasses: []
  2565. }),
  2566. smalltalk.IRJSTranslator);
  2567. smalltalk.addMethod(
  2568. "_visitIRVerbatim_",
  2569. smalltalk.method({
  2570. selector: "visitIRVerbatim:",
  2571. category: 'visiting',
  2572. fn: function (anIRVerbatim){
  2573. var self=this;
  2574. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
  2575. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(anIRVerbatim,"_source",[])]);
  2576. })]);
  2577. return self},
  2578. args: ["anIRVerbatim"],
  2579. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  2580. messageSends: ["nextPutStatementWith:", "nextPutAll:", "source", "stream"],
  2581. referencedClasses: []
  2582. }),
  2583. smalltalk.IRJSTranslator);
  2584. smalltalk.addClass('JSStream', smalltalk.Object, ['stream'], 'Compiler-IR');
  2585. smalltalk.addMethod(
  2586. "_contents",
  2587. smalltalk.method({
  2588. selector: "contents",
  2589. category: 'accessing',
  2590. fn: function (){
  2591. var self=this;
  2592. var $1;
  2593. $1=smalltalk.send(self["@stream"],"_contents",[]);
  2594. return $1;
  2595. },
  2596. args: [],
  2597. source: "contents\x0a\x09^ stream contents",
  2598. messageSends: ["contents"],
  2599. referencedClasses: []
  2600. }),
  2601. smalltalk.JSStream);
  2602. smalltalk.addMethod(
  2603. "_initialize",
  2604. smalltalk.method({
  2605. selector: "initialize",
  2606. category: 'initialization',
  2607. fn: function (){
  2608. var self=this;
  2609. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  2610. self["@stream"]=smalltalk.send("","_writeStream",[]);
  2611. return self},
  2612. args: [],
  2613. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  2614. messageSends: ["initialize", "writeStream"],
  2615. referencedClasses: []
  2616. }),
  2617. smalltalk.JSStream);
  2618. smalltalk.addMethod(
  2619. "_lf",
  2620. smalltalk.method({
  2621. selector: "lf",
  2622. category: 'streaming',
  2623. fn: function (){
  2624. var self=this;
  2625. smalltalk.send(self["@stream"],"_lf",[]);
  2626. return self},
  2627. args: [],
  2628. source: "lf\x0a\x09stream lf",
  2629. messageSends: ["lf"],
  2630. referencedClasses: []
  2631. }),
  2632. smalltalk.JSStream);
  2633. smalltalk.addMethod(
  2634. "_nextPut_",
  2635. smalltalk.method({
  2636. selector: "nextPut:",
  2637. category: 'streaming',
  2638. fn: function (aString){
  2639. var self=this;
  2640. smalltalk.send(self["@stream"],"_nextPut_",[aString]);
  2641. return self},
  2642. args: ["aString"],
  2643. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  2644. messageSends: ["nextPut:"],
  2645. referencedClasses: []
  2646. }),
  2647. smalltalk.JSStream);
  2648. smalltalk.addMethod(
  2649. "_nextPutAll_",
  2650. smalltalk.method({
  2651. selector: "nextPutAll:",
  2652. category: 'streaming',
  2653. fn: function (aString){
  2654. var self=this;
  2655. smalltalk.send(self["@stream"],"_nextPutAll_",[aString]);
  2656. return self},
  2657. args: ["aString"],
  2658. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  2659. messageSends: ["nextPutAll:"],
  2660. referencedClasses: []
  2661. }),
  2662. smalltalk.JSStream);
  2663. smalltalk.addMethod(
  2664. "_nextPutAssignment",
  2665. smalltalk.method({
  2666. selector: "nextPutAssignment",
  2667. category: 'streaming',
  2668. fn: function (){
  2669. var self=this;
  2670. smalltalk.send(self["@stream"],"_nextPutAll_",["="]);
  2671. return self},
  2672. args: [],
  2673. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  2674. messageSends: ["nextPutAll:"],
  2675. referencedClasses: []
  2676. }),
  2677. smalltalk.JSStream);
  2678. smalltalk.addMethod(
  2679. "_nextPutClosureWith_arguments_",
  2680. smalltalk.method({
  2681. selector: "nextPutClosureWith:arguments:",
  2682. category: 'streaming',
  2683. fn: function (aBlock,anArray){
  2684. var self=this;
  2685. var $1;
  2686. smalltalk.send(self["@stream"],"_nextPutAll_",["(function("]);
  2687. smalltalk.send(anArray,"_do_separatedBy_",[(function(each){
  2688. return smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(each,"_asVariableName",[])]);
  2689. }),(function(){
  2690. return smalltalk.send(self["@stream"],"_nextPut_",[","]);
  2691. })]);
  2692. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  2693. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2694. smalltalk.send(aBlock,"_value",[]);
  2695. smalltalk.send(self["@stream"],"_nextPutAll_",["})"]);
  2696. return self},
  2697. args: ["aBlock", "anArray"],
  2698. 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: '})'",
  2699. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  2700. referencedClasses: []
  2701. }),
  2702. smalltalk.JSStream);
  2703. smalltalk.addMethod(
  2704. "_nextPutContextFor_during_",
  2705. smalltalk.method({
  2706. selector: "nextPutContextFor:during:",
  2707. category: 'streaming',
  2708. fn: function (aMethod,aBlock){
  2709. var self=this;
  2710. var $1;
  2711. _st(self)._nextPutAll_("return smalltalk.withContext(function() {");
  2712. _st(aBlock)._value();
  2713. _st(self)._nextPutAll_("}, self, ");
  2714. _st(self)._nextPutAll_(_st(_st(_st(aMethod)._selector())._asJavascript()).__comma(", "));
  2715. _st(self)._nextPutAll_(_st(_st(aMethod)._arguments())._asJavascript());
  2716. $1=_st(self)._nextPutAll_(")");
  2717. return self},
  2718. args: ["aMethod", "aBlock"],
  2719. source: "nextPutContextFor: aMethod during: aBlock\x0a\x09self nextPutAll: 'return smalltalk.withContext(function() {'.\x0a aBlock value.\x0a self \x0a \x09nextPutAll: '}, self, ';\x0a nextPutAll: aMethod selector asJavascript, ', ';\x0a nextPutAll: aMethod arguments asJavascript;\x0a nextPutAll: ')'",
  2720. messageSends: ["nextPutAll:", "value", ",", "asJavascript", "selector", "arguments"],
  2721. referencedClasses: []
  2722. }),
  2723. smalltalk.JSStream);
  2724. smalltalk.addMethod(
  2725. "_nextPutFunctionWith_arguments_",
  2726. smalltalk.method({
  2727. selector: "nextPutFunctionWith:arguments:",
  2728. category: 'streaming',
  2729. fn: function (aBlock,anArray){
  2730. var self=this;
  2731. var $1,$2;
  2732. smalltalk.send(self["@stream"],"_nextPutAll_",["fn: function("]);
  2733. smalltalk.send(anArray,"_do_separatedBy_",[(function(each){
  2734. return smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(each,"_asVariableName",[])]);
  2735. }),(function(){
  2736. return smalltalk.send(self["@stream"],"_nextPut_",[","]);
  2737. })]);
  2738. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  2739. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2740. smalltalk.send(self["@stream"],"_nextPutAll_",["var self=this;"]);
  2741. $2=smalltalk.send(self["@stream"],"_lf",[]);
  2742. smalltalk.send(aBlock,"_value",[]);
  2743. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  2744. return self},
  2745. args: ["aBlock", "anArray"],
  2746. 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: '}'",
  2747. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  2748. referencedClasses: []
  2749. }),
  2750. smalltalk.JSStream);
  2751. smalltalk.addMethod(
  2752. "_nextPutIf_with_",
  2753. smalltalk.method({
  2754. selector: "nextPutIf:with:",
  2755. category: 'streaming',
  2756. fn: function (aBlock,anotherBlock){
  2757. var self=this;
  2758. var $1;
  2759. smalltalk.send(self["@stream"],"_nextPutAll_",["if("]);
  2760. smalltalk.send(aBlock,"_value",[]);
  2761. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  2762. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2763. smalltalk.send(anotherBlock,"_value",[]);
  2764. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  2765. return self},
  2766. args: ["aBlock", "anotherBlock"],
  2767. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  2768. messageSends: ["nextPutAll:", "value", "lf"],
  2769. referencedClasses: []
  2770. }),
  2771. smalltalk.JSStream);
  2772. smalltalk.addMethod(
  2773. "_nextPutIfElse_with_with_",
  2774. smalltalk.method({
  2775. selector: "nextPutIfElse:with:with:",
  2776. category: 'streaming',
  2777. fn: function (aBlock,ifBlock,elseBlock){
  2778. var self=this;
  2779. var $1,$2;
  2780. smalltalk.send(self["@stream"],"_nextPutAll_",["if("]);
  2781. smalltalk.send(aBlock,"_value",[]);
  2782. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  2783. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2784. smalltalk.send(ifBlock,"_value",[]);
  2785. smalltalk.send(self["@stream"],"_nextPutAll_",["} else {"]);
  2786. $2=smalltalk.send(self["@stream"],"_lf",[]);
  2787. smalltalk.send(elseBlock,"_value",[]);
  2788. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  2789. return self},
  2790. args: ["aBlock", "ifBlock", "elseBlock"],
  2791. 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: '}'",
  2792. messageSends: ["nextPutAll:", "value", "lf"],
  2793. referencedClasses: []
  2794. }),
  2795. smalltalk.JSStream);
  2796. smalltalk.addMethod(
  2797. "_nextPutMethodDeclaration_with_",
  2798. smalltalk.method({
  2799. selector: "nextPutMethodDeclaration:with:",
  2800. category: 'streaming',
  2801. fn: function (aMethod,aBlock){
  2802. var self=this;
  2803. var $1,$2,$3;
  2804. _st(self["@stream"])._nextPutAll_("smalltalk.method({");
  2805. _st(self["@stream"])._lf();
  2806. _st(self["@stream"])._nextPutAll_(_st(_st("selector: \x22").__comma(_st(aMethod)._selector())).__comma("\x22,"));
  2807. _st(self["@stream"])._lf();
  2808. _st(self["@stream"])._nextPutAll_(_st(_st("source: ").__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
  2809. $1=_st(self["@stream"])._lf();
  2810. _st(aBlock)._value();
  2811. _st(self["@stream"])._nextPutAll_(_st(_st(",").__comma(_st((smalltalk.String || String))._lf())).__comma("messageSends: "));
  2812. _st(self["@stream"])._nextPutAll_(_st(_st(_st(_st(aMethod)._messageSends())._asArray())._asJavascript()).__comma(","));
  2813. _st(self["@stream"])._lf();
  2814. _st(self["@stream"])._nextPutAll_(_st(_st("args: ").__comma(_st(_st(_st(_st(aMethod)._arguments())._collect_((function(each){
  2815. return _st(each)._value();
  2816. })))._asArray())._asJavascript())).__comma(","));
  2817. _st(self["@stream"])._lf();
  2818. $2=_st(self["@stream"])._nextPutAll_("referencedClasses: [");
  2819. _st(_st(aMethod)._classReferences())._do_separatedBy_((function(each){
  2820. return _st(self["@stream"])._nextPutAll_(_st(each)._asJavascript());
  2821. }),(function(){
  2822. return _st(self["@stream"])._nextPutAll_(",");
  2823. }));
  2824. _st(self["@stream"])._nextPutAll_("]");
  2825. $3=_st(self["@stream"])._nextPutAll_("})");
  2826. return self},
  2827. args: ["aMethod", "aBlock"],
  2828. 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 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: '})'",
  2829. messageSends: ["nextPutAll:", "lf", ",", "selector", "asJavascript", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"],
  2830. referencedClasses: ["String"]
  2831. }),
  2832. smalltalk.JSStream);
  2833. smalltalk.addMethod(
  2834. "_nextPutNonLocalReturnHandlingWith_",
  2835. smalltalk.method({
  2836. selector: "nextPutNonLocalReturnHandlingWith:",
  2837. category: 'streaming',
  2838. fn: function (aBlock){
  2839. var self=this;
  2840. var $1,$2;
  2841. smalltalk.send(self["@stream"],"_nextPutAll_",["var $early={};"]);
  2842. smalltalk.send(self["@stream"],"_lf",[]);
  2843. smalltalk.send(self["@stream"],"_nextPutAll_",["try {"]);
  2844. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2845. smalltalk.send(aBlock,"_value",[]);
  2846. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  2847. smalltalk.send(self["@stream"],"_lf",[]);
  2848. smalltalk.send(self["@stream"],"_nextPutAll_",["catch(e) {if(e===$early)return e[0]; throw e}"]);
  2849. $2=smalltalk.send(self["@stream"],"_lf",[]);
  2850. return self},
  2851. args: ["aBlock"],
  2852. 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",
  2853. messageSends: ["nextPutAll:", "lf", "value"],
  2854. referencedClasses: []
  2855. }),
  2856. smalltalk.JSStream);
  2857. smalltalk.addMethod(
  2858. "_nextPutNonLocalReturnWith_",
  2859. smalltalk.method({
  2860. selector: "nextPutNonLocalReturnWith:",
  2861. category: 'streaming',
  2862. fn: function (aBlock){
  2863. var self=this;
  2864. smalltalk.send(self["@stream"],"_nextPutAll_",["throw $early=["]);
  2865. smalltalk.send(aBlock,"_value",[]);
  2866. smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
  2867. return self},
  2868. args: ["aBlock"],
  2869. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  2870. messageSends: ["nextPutAll:", "value"],
  2871. referencedClasses: []
  2872. }),
  2873. smalltalk.JSStream);
  2874. smalltalk.addMethod(
  2875. "_nextPutReturn",
  2876. smalltalk.method({
  2877. selector: "nextPutReturn",
  2878. category: 'streaming',
  2879. fn: function (){
  2880. var self=this;
  2881. smalltalk.send(self["@stream"],"_nextPutAll_",["return "]);
  2882. return self},
  2883. args: [],
  2884. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  2885. messageSends: ["nextPutAll:"],
  2886. referencedClasses: []
  2887. }),
  2888. smalltalk.JSStream);
  2889. smalltalk.addMethod(
  2890. "_nextPutReturnWith_",
  2891. smalltalk.method({
  2892. selector: "nextPutReturnWith:",
  2893. category: 'streaming',
  2894. fn: function (aBlock){
  2895. var self=this;
  2896. smalltalk.send(self,"_nextPutReturn",[]);
  2897. smalltalk.send(aBlock,"_value",[]);
  2898. return self},
  2899. args: ["aBlock"],
  2900. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  2901. messageSends: ["nextPutReturn", "value"],
  2902. referencedClasses: []
  2903. }),
  2904. smalltalk.JSStream);
  2905. smalltalk.addMethod(
  2906. "_nextPutSequenceWith_",
  2907. smalltalk.method({
  2908. selector: "nextPutSequenceWith:",
  2909. category: 'streaming',
  2910. fn: function (aBlock){
  2911. var self=this;
  2912. smalltalk.send(aBlock,"_value",[]);
  2913. return self},
  2914. args: ["aBlock"],
  2915. 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",
  2916. messageSends: ["value"],
  2917. referencedClasses: []
  2918. }),
  2919. smalltalk.JSStream);
  2920. smalltalk.addMethod(
  2921. "_nextPutStatement_with_",
  2922. smalltalk.method({
  2923. selector: "nextPutStatement:with:",
  2924. category: 'streaming',
  2925. fn: function (anInteger,aBlock){
  2926. var self=this;
  2927. var $1,$2;
  2928. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("case ","__comma",[smalltalk.send(anInteger,"_asString",[])]),"__comma",[":"])]);
  2929. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2930. smalltalk.send(self,"_nextPutStatementWith_",[aBlock]);
  2931. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("smalltalk.thisContext.pc=","__comma",[smalltalk.send(smalltalk.send(anInteger,"__plus",[(1)]),"_asString",[])]),"__comma",[";"])]);
  2932. $2=smalltalk.send(self["@stream"],"_lf",[]);
  2933. return self},
  2934. args: ["anInteger", "aBlock"],
  2935. 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",
  2936. messageSends: ["nextPutAll:", ",", "asString", "lf", "nextPutStatementWith:", "+"],
  2937. referencedClasses: []
  2938. }),
  2939. smalltalk.JSStream);
  2940. smalltalk.addMethod(
  2941. "_nextPutStatementWith_",
  2942. smalltalk.method({
  2943. selector: "nextPutStatementWith:",
  2944. category: 'streaming',
  2945. fn: function (aBlock){
  2946. var self=this;
  2947. var $1;
  2948. smalltalk.send(aBlock,"_value",[]);
  2949. smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
  2950. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2951. return self},
  2952. args: ["aBlock"],
  2953. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  2954. messageSends: ["value", "nextPutAll:", "lf"],
  2955. referencedClasses: []
  2956. }),
  2957. smalltalk.JSStream);
  2958. smalltalk.addMethod(
  2959. "_nextPutVar_",
  2960. smalltalk.method({
  2961. selector: "nextPutVar:",
  2962. category: 'streaming',
  2963. fn: function (aString){
  2964. var self=this;
  2965. var $1;
  2966. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("var ","__comma",[aString]),"__comma",[";"])]);
  2967. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2968. return self},
  2969. args: ["aString"],
  2970. source: "nextPutVar: aString\x0a\x09stream nextPutAll: 'var ', aString, ';'; lf",
  2971. messageSends: ["nextPutAll:", ",", "lf"],
  2972. referencedClasses: []
  2973. }),
  2974. smalltalk.JSStream);
  2975. smalltalk.addMethod(
  2976. "_nextPutVars_",
  2977. smalltalk.method({
  2978. selector: "nextPutVars:",
  2979. category: 'streaming',
  2980. fn: function (aCollection){
  2981. var self=this;
  2982. var $1;
  2983. smalltalk.send(self["@stream"],"_nextPutAll_",["var "]);
  2984. smalltalk.send(aCollection,"_do_separatedBy_",[(function(each){
  2985. return smalltalk.send(self["@stream"],"_nextPutAll_",[each]);
  2986. }),(function(){
  2987. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  2988. })]);
  2989. smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
  2990. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2991. return self},
  2992. args: ["aCollection"],
  2993. 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",
  2994. messageSends: ["nextPutAll:", "do:separatedBy:", "lf"],
  2995. referencedClasses: []
  2996. }),
  2997. smalltalk.JSStream);
  2998. smalltalk.addMethod(
  2999. "_appendToInstruction_",
  3000. smalltalk.method({
  3001. selector: "appendToInstruction:",
  3002. category: '*Compiler-IR',
  3003. fn: function (anIRInstruction){
  3004. var self=this;
  3005. smalltalk.send(anIRInstruction,"_appendBlock_",[self]);
  3006. return self},
  3007. args: ["anIRInstruction"],
  3008. source: "appendToInstruction: anIRInstruction\x0a anIRInstruction appendBlock: self",
  3009. messageSends: ["appendBlock:"],
  3010. referencedClasses: []
  3011. }),
  3012. smalltalk.BlockClosure);
  3013. smalltalk.addMethod(
  3014. "_asVariableName",
  3015. smalltalk.method({
  3016. selector: "asVariableName",
  3017. category: '*Compiler-IR',
  3018. fn: function (){
  3019. var self=this;
  3020. var $2,$1;
  3021. $2=smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_reservedWords",[]),"_includes_",[self]);
  3022. if(smalltalk.assert($2)){
  3023. $1=smalltalk.send(self,"__comma",["_"]);
  3024. } else {
  3025. $1=self;
  3026. };
  3027. return $1;
  3028. },
  3029. args: [],
  3030. source: "asVariableName\x0a\x09^ (Smalltalk current reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  3031. messageSends: ["ifTrue:ifFalse:", ",", "includes:", "reservedWords", "current"],
  3032. referencedClasses: ["Smalltalk"]
  3033. }),
  3034. smalltalk.String);