1
0

Compiler-IR.js 94 KB

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