2
0

Compiler-IR.js 133 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358
  1. define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-Core", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){
  2. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  3. smalltalk.addPackage('Compiler-IR');
  4. smalltalk.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5. smalltalk.addClass('IRASTTranslator', globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  6. globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  7. smalltalk.addMethod(
  8. smalltalk.method({
  9. selector: "alias:",
  10. protocol: 'visiting',
  11. fn: function (aNode){
  12. var self=this;
  13. var variable;
  14. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  15. function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  16. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  17. return smalltalk.withContext(function($ctx1) {
  18. var $1,$2,$3,$4,$6,$5,$7,$8,$10,$11,$9,$12;
  19. $1=_st(aNode)._isImmutable();
  20. if(smalltalk.assert($1)){
  21. $2=self._visit_(aNode);
  22. $ctx1.sendIdx["visit:"]=1;
  23. return $2;
  24. };
  25. $3=_st($IRVariable())._new();
  26. $ctx1.sendIdx["new"]=1;
  27. $4=$3;
  28. $6=_st($AliasVar())._new();
  29. $ctx1.sendIdx["new"]=2;
  30. $5=_st($6)._name_("$".__comma(self._nextAlias()));
  31. _st($4)._variable_($5);
  32. $7=_st($3)._yourself();
  33. $ctx1.sendIdx["yourself"]=1;
  34. variable=$7;
  35. $8=self._sequence();
  36. $10=_st($IRAssignment())._new();
  37. _st($10)._add_(variable);
  38. $ctx1.sendIdx["add:"]=2;
  39. _st($10)._add_(self._visit_(aNode));
  40. $ctx1.sendIdx["add:"]=3;
  41. $11=_st($10)._yourself();
  42. $9=$11;
  43. _st($8)._add_($9);
  44. $ctx1.sendIdx["add:"]=1;
  45. _st(_st(self._method())._internalVariables())._add_(variable);
  46. $12=variable;
  47. return $12;
  48. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},globals.IRASTTranslator)});
  49. },
  50. args: ["aNode"],
  51. 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",
  52. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"],
  53. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"]
  54. }),
  55. globals.IRASTTranslator);
  56. smalltalk.addMethod(
  57. smalltalk.method({
  58. selector: "aliasTemporally:",
  59. protocol: 'visiting',
  60. fn: function (aCollection){
  61. var self=this;
  62. var threshold,result;
  63. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  64. return smalltalk.withContext(function($ctx1) {
  65. var $1,$2,$4,$3,$5;
  66. threshold=(0);
  67. _st(aCollection)._withIndexDo_((function(each,i){
  68. return smalltalk.withContext(function($ctx2) {
  69. $1=_st(each)._subtreeNeedsAliasing();
  70. if(smalltalk.assert($1)){
  71. threshold=i;
  72. return threshold;
  73. };
  74. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  75. }));
  76. $ctx1.sendIdx["withIndexDo:"]=1;
  77. result=_st($OrderedCollection())._new();
  78. _st(aCollection)._withIndexDo_((function(each,i){
  79. return smalltalk.withContext(function($ctx2) {
  80. $2=result;
  81. $4=_st(i).__lt_eq(threshold);
  82. if(smalltalk.assert($4)){
  83. $3=self._alias_(each);
  84. } else {
  85. $3=self._visit_(each);
  86. };
  87. return _st($2)._add_($3);
  88. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  89. }));
  90. $5=result;
  91. return $5;
  92. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},globals.IRASTTranslator)});
  93. },
  94. args: ["aCollection"],
  95. source: "aliasTemporally: aCollection\x0a\x09\x22https://github.com/NicolasPetton/amber/issues/296\x0a\x09\x0a\x09If a node is aliased, all preceding ones are aliased as well.\x0a\x09The tree is iterated twice. First we get the aliasing dependency,\x0a\x09then the aliasing itself is done\x22\x0a\x0a\x09| threshold result |\x0a\x09threshold := 0.\x0a\x09\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09each subtreeNeedsAliasing\x0a\x09\x09\x09ifTrue: [ threshold := i ] ].\x0a\x0a\x09result := OrderedCollection new.\x0a\x09aCollection 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\x09^ result",
  96. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"],
  97. referencedClasses: ["OrderedCollection"]
  98. }),
  99. globals.IRASTTranslator);
  100. smalltalk.addMethod(
  101. smalltalk.method({
  102. selector: "method",
  103. protocol: 'accessing',
  104. fn: function (){
  105. var self=this;
  106. var $1;
  107. $1=self["@method"];
  108. return $1;
  109. },
  110. args: [],
  111. source: "method\x0a\x09^ method",
  112. messageSends: [],
  113. referencedClasses: []
  114. }),
  115. globals.IRASTTranslator);
  116. smalltalk.addMethod(
  117. smalltalk.method({
  118. selector: "method:",
  119. protocol: 'accessing',
  120. fn: function (anIRMethod){
  121. var self=this;
  122. self["@method"]=anIRMethod;
  123. return self
  124. },
  125. args: ["anIRMethod"],
  126. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  127. messageSends: [],
  128. referencedClasses: []
  129. }),
  130. globals.IRASTTranslator);
  131. smalltalk.addMethod(
  132. smalltalk.method({
  133. selector: "nextAlias",
  134. protocol: 'accessing',
  135. fn: function (){
  136. var self=this;
  137. return smalltalk.withContext(function($ctx1) {
  138. var $1,$2,$receiver;
  139. $1=self["@nextAlias"];
  140. if(($receiver = $1) == null || $receiver.isNil){
  141. self["@nextAlias"]=(0);
  142. self["@nextAlias"];
  143. } else {
  144. $1;
  145. };
  146. self["@nextAlias"]=_st(self["@nextAlias"]).__plus((1));
  147. $2=_st(self["@nextAlias"])._asString();
  148. return $2;
  149. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},globals.IRASTTranslator)});
  150. },
  151. args: [],
  152. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  153. messageSends: ["ifNil:", "+", "asString"],
  154. referencedClasses: []
  155. }),
  156. globals.IRASTTranslator);
  157. smalltalk.addMethod(
  158. smalltalk.method({
  159. selector: "sequence",
  160. protocol: 'accessing',
  161. fn: function (){
  162. var self=this;
  163. var $1;
  164. $1=self["@sequence"];
  165. return $1;
  166. },
  167. args: [],
  168. source: "sequence\x0a\x09^ sequence",
  169. messageSends: [],
  170. referencedClasses: []
  171. }),
  172. globals.IRASTTranslator);
  173. smalltalk.addMethod(
  174. smalltalk.method({
  175. selector: "sequence:",
  176. protocol: 'accessing',
  177. fn: function (anIRSequence){
  178. var self=this;
  179. self["@sequence"]=anIRSequence;
  180. return self
  181. },
  182. args: ["anIRSequence"],
  183. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  184. messageSends: [],
  185. referencedClasses: []
  186. }),
  187. globals.IRASTTranslator);
  188. smalltalk.addMethod(
  189. smalltalk.method({
  190. selector: "source",
  191. protocol: 'accessing',
  192. fn: function (){
  193. var self=this;
  194. var $1;
  195. $1=self["@source"];
  196. return $1;
  197. },
  198. args: [],
  199. source: "source\x0a\x09^ source",
  200. messageSends: [],
  201. referencedClasses: []
  202. }),
  203. globals.IRASTTranslator);
  204. smalltalk.addMethod(
  205. smalltalk.method({
  206. selector: "source:",
  207. protocol: 'accessing',
  208. fn: function (aString){
  209. var self=this;
  210. self["@source"]=aString;
  211. return self
  212. },
  213. args: ["aString"],
  214. source: "source: aString\x0a\x09source := aString",
  215. messageSends: [],
  216. referencedClasses: []
  217. }),
  218. globals.IRASTTranslator);
  219. smalltalk.addMethod(
  220. smalltalk.method({
  221. selector: "theClass",
  222. protocol: 'accessing',
  223. fn: function (){
  224. var self=this;
  225. var $1;
  226. $1=self["@theClass"];
  227. return $1;
  228. },
  229. args: [],
  230. source: "theClass\x0a\x09^ theClass",
  231. messageSends: [],
  232. referencedClasses: []
  233. }),
  234. globals.IRASTTranslator);
  235. smalltalk.addMethod(
  236. smalltalk.method({
  237. selector: "theClass:",
  238. protocol: 'accessing',
  239. fn: function (aClass){
  240. var self=this;
  241. self["@theClass"]=aClass;
  242. return self
  243. },
  244. args: ["aClass"],
  245. source: "theClass: aClass\x0a\x09theClass := aClass",
  246. messageSends: [],
  247. referencedClasses: []
  248. }),
  249. globals.IRASTTranslator);
  250. smalltalk.addMethod(
  251. smalltalk.method({
  252. selector: "visitAssignmentNode:",
  253. protocol: 'visiting',
  254. fn: function (aNode){
  255. var self=this;
  256. var left,right,assignment;
  257. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  258. return smalltalk.withContext(function($ctx1) {
  259. var $1,$3,$4,$2,$5;
  260. right=self._visit_(_st(aNode)._right());
  261. $ctx1.sendIdx["visit:"]=1;
  262. left=self._visit_(_st(aNode)._left());
  263. $1=self._sequence();
  264. $3=_st($IRAssignment())._new();
  265. _st($3)._add_(left);
  266. $ctx1.sendIdx["add:"]=2;
  267. _st($3)._add_(right);
  268. $4=_st($3)._yourself();
  269. $2=$4;
  270. _st($1)._add_($2);
  271. $ctx1.sendIdx["add:"]=1;
  272. $5=left;
  273. return $5;
  274. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},globals.IRASTTranslator)});
  275. },
  276. args: ["aNode"],
  277. 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",
  278. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"],
  279. referencedClasses: ["IRAssignment"]
  280. }),
  281. globals.IRASTTranslator);
  282. smalltalk.addMethod(
  283. smalltalk.method({
  284. selector: "visitBlockNode:",
  285. protocol: 'visiting',
  286. fn: function (aNode){
  287. var self=this;
  288. var closure;
  289. function $IRClosure(){return globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  290. function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  291. return smalltalk.withContext(function($ctx1) {
  292. var $1,$2,$3,$4,$6,$5,$7,$8,$9;
  293. $1=_st($IRClosure())._new();
  294. $ctx1.sendIdx["new"]=1;
  295. _st($1)._arguments_(_st(aNode)._parameters());
  296. _st($1)._requiresSmalltalkContext_(_st(aNode)._requiresSmalltalkContext());
  297. $2=$1;
  298. $3=_st(aNode)._scope();
  299. $ctx1.sendIdx["scope"]=1;
  300. _st($2)._scope_($3);
  301. $ctx1.sendIdx["scope:"]=1;
  302. $4=_st($1)._yourself();
  303. $ctx1.sendIdx["yourself"]=1;
  304. closure=$4;
  305. $6=_st(aNode)._scope();
  306. $ctx1.sendIdx["scope"]=2;
  307. $5=_st($6)._temps();
  308. _st($5)._do_((function(each){
  309. return smalltalk.withContext(function($ctx2) {
  310. $7=_st($IRTempDeclaration())._new();
  311. _st($7)._name_(_st(each)._name());
  312. _st($7)._scope_(_st(aNode)._scope());
  313. $8=_st($7)._yourself();
  314. return _st(closure)._add_($8);
  315. $ctx2.sendIdx["add:"]=1;
  316. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  317. }));
  318. $ctx1.sendIdx["do:"]=1;
  319. _st(_st(aNode)._nodes())._do_((function(each){
  320. return smalltalk.withContext(function($ctx2) {
  321. return _st(closure)._add_(self._visit_(each));
  322. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  323. }));
  324. $9=closure;
  325. return $9;
  326. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},globals.IRASTTranslator)});
  327. },
  328. args: ["aNode"],
  329. source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\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\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x09aNode nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
  330. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"],
  331. referencedClasses: ["IRClosure", "IRTempDeclaration"]
  332. }),
  333. globals.IRASTTranslator);
  334. smalltalk.addMethod(
  335. smalltalk.method({
  336. selector: "visitBlockSequenceNode:",
  337. protocol: 'visiting',
  338. fn: function (aNode){
  339. var self=this;
  340. function $IRBlockSequence(){return globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  341. function $IRBlockReturn(){return globals.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)}
  342. return smalltalk.withContext(function($ctx1) {
  343. var $2,$3,$5,$4,$6,$7,$10,$9,$8,$11,$13,$14,$17,$16,$15,$18,$12,$1;
  344. $2=_st($IRBlockSequence())._new();
  345. $ctx1.sendIdx["new"]=1;
  346. $1=self._withSequence_do_($2,(function(){
  347. return smalltalk.withContext(function($ctx2) {
  348. $3=_st(aNode)._nodes();
  349. $ctx2.sendIdx["nodes"]=1;
  350. return _st($3)._ifNotEmpty_((function(){
  351. return smalltalk.withContext(function($ctx3) {
  352. $5=_st(aNode)._nodes();
  353. $ctx3.sendIdx["nodes"]=2;
  354. $4=_st($5)._allButLast();
  355. _st($4)._do_((function(each){
  356. return smalltalk.withContext(function($ctx4) {
  357. $6=self._sequence();
  358. $ctx4.sendIdx["sequence"]=1;
  359. $7=self._visitOrAlias_(each);
  360. $ctx4.sendIdx["visitOrAlias:"]=1;
  361. return _st($6)._add_($7);
  362. $ctx4.sendIdx["add:"]=1;
  363. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  364. }));
  365. $10=_st(aNode)._nodes();
  366. $ctx3.sendIdx["nodes"]=3;
  367. $9=_st($10)._last();
  368. $ctx3.sendIdx["last"]=1;
  369. $8=_st($9)._isReturnNode();
  370. if(smalltalk.assert($8)){
  371. return _st(self._sequence())._add_(self._visitOrAlias_(_st(_st(aNode)._nodes())._last()));
  372. } else {
  373. $11=self._sequence();
  374. $ctx3.sendIdx["sequence"]=2;
  375. $13=_st($IRBlockReturn())._new();
  376. $14=$13;
  377. $17=_st(aNode)._nodes();
  378. $ctx3.sendIdx["nodes"]=4;
  379. $16=_st($17)._last();
  380. $ctx3.sendIdx["last"]=2;
  381. $15=self._visitOrAlias_($16);
  382. $ctx3.sendIdx["visitOrAlias:"]=2;
  383. _st($14)._add_($15);
  384. $ctx3.sendIdx["add:"]=3;
  385. $18=_st($13)._yourself();
  386. $12=$18;
  387. return _st($11)._add_($12);
  388. $ctx3.sendIdx["add:"]=2;
  389. };
  390. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  391. }));
  392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  393. }));
  394. return $1;
  395. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},globals.IRASTTranslator)});
  396. },
  397. args: ["aNode"],
  398. 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 visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode nodes last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode nodes last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode nodes last) ] ]]",
  399. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"],
  400. referencedClasses: ["IRBlockSequence", "IRBlockReturn"]
  401. }),
  402. globals.IRASTTranslator);
  403. smalltalk.addMethod(
  404. smalltalk.method({
  405. selector: "visitCascadeNode:",
  406. protocol: 'visiting',
  407. fn: function (aNode){
  408. var self=this;
  409. var alias,receiver;
  410. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  411. return smalltalk.withContext(function($ctx1) {
  412. var $2,$1,$3,$5,$4,$6;
  413. $2=_st(aNode)._receiver();
  414. $ctx1.sendIdx["receiver"]=1;
  415. $1=_st($2)._isImmutable();
  416. if(smalltalk.assert($1)){
  417. receiver=_st(aNode)._receiver();
  418. $ctx1.sendIdx["receiver"]=2;
  419. receiver;
  420. } else {
  421. alias=self._alias_(_st(aNode)._receiver());
  422. $ctx1.sendIdx["alias:"]=1;
  423. alias;
  424. receiver=_st(_st($VariableNode())._new())._binding_(_st(alias)._variable());
  425. receiver;
  426. };
  427. $3=_st(aNode)._nodes();
  428. $ctx1.sendIdx["nodes"]=1;
  429. _st($3)._do_((function(each){
  430. return smalltalk.withContext(function($ctx2) {
  431. return _st(each)._receiver_(receiver);
  432. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  433. }));
  434. $ctx1.sendIdx["do:"]=1;
  435. $5=_st(aNode)._nodes();
  436. $ctx1.sendIdx["nodes"]=2;
  437. $4=_st($5)._allButLast();
  438. _st($4)._do_((function(each){
  439. return smalltalk.withContext(function($ctx2) {
  440. return _st(self._sequence())._add_(self._visit_(each));
  441. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  442. }));
  443. $6=self._alias_(_st(_st(aNode)._nodes())._last());
  444. return $6;
  445. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias,receiver:receiver},globals.IRASTTranslator)});
  446. },
  447. args: ["aNode"],
  448. source: "visitCascadeNode: aNode\x0a\x09| alias receiver |\x0a\x0a\x09aNode receiver isImmutable \x0a\x09\x09ifTrue: [ receiver := aNode receiver ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09alias := self alias: aNode receiver.\x0a\x09\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09\x09each receiver: receiver ].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self alias: aNode nodes last",
  449. messageSends: ["ifTrue:ifFalse:", "isImmutable", "receiver", "alias:", "binding:", "new", "variable", "do:", "nodes", "receiver:", "allButLast", "add:", "sequence", "visit:", "last"],
  450. referencedClasses: ["VariableNode"]
  451. }),
  452. globals.IRASTTranslator);
  453. smalltalk.addMethod(
  454. smalltalk.method({
  455. selector: "visitDynamicArrayNode:",
  456. protocol: 'visiting',
  457. fn: function (aNode){
  458. var self=this;
  459. var array;
  460. function $IRDynamicArray(){return globals.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)}
  461. return smalltalk.withContext(function($ctx1) {
  462. var $1;
  463. array=_st($IRDynamicArray())._new();
  464. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  465. return smalltalk.withContext(function($ctx2) {
  466. return _st(array)._add_(each);
  467. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  468. }));
  469. $1=array;
  470. return $1;
  471. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},globals.IRASTTranslator)});
  472. },
  473. args: ["aNode"],
  474. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
  475. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"],
  476. referencedClasses: ["IRDynamicArray"]
  477. }),
  478. globals.IRASTTranslator);
  479. smalltalk.addMethod(
  480. smalltalk.method({
  481. selector: "visitDynamicDictionaryNode:",
  482. protocol: 'visiting',
  483. fn: function (aNode){
  484. var self=this;
  485. var dictionary;
  486. function $IRDynamicDictionary(){return globals.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)}
  487. return smalltalk.withContext(function($ctx1) {
  488. var $1;
  489. dictionary=_st($IRDynamicDictionary())._new();
  490. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  491. return smalltalk.withContext(function($ctx2) {
  492. return _st(dictionary)._add_(each);
  493. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  494. }));
  495. $1=dictionary;
  496. return $1;
  497. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},globals.IRASTTranslator)});
  498. },
  499. args: ["aNode"],
  500. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  501. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"],
  502. referencedClasses: ["IRDynamicDictionary"]
  503. }),
  504. globals.IRASTTranslator);
  505. smalltalk.addMethod(
  506. smalltalk.method({
  507. selector: "visitJSStatementNode:",
  508. protocol: 'visiting',
  509. fn: function (aNode){
  510. var self=this;
  511. function $IRVerbatim(){return globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  512. return smalltalk.withContext(function($ctx1) {
  513. var $2,$3,$1;
  514. $2=_st($IRVerbatim())._new();
  515. _st($2)._source_(_st(_st(aNode)._source())._crlfSanitized());
  516. $3=_st($2)._yourself();
  517. $1=$3;
  518. return $1;
  519. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},globals.IRASTTranslator)});
  520. },
  521. args: ["aNode"],
  522. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  523. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"],
  524. referencedClasses: ["IRVerbatim"]
  525. }),
  526. globals.IRASTTranslator);
  527. smalltalk.addMethod(
  528. smalltalk.method({
  529. selector: "visitMethodNode:",
  530. protocol: 'visiting',
  531. fn: function (aNode){
  532. var self=this;
  533. function $IRMethod(){return globals.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)}
  534. function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  535. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  536. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  537. return smalltalk.withContext(function($ctx1) {
  538. var $2,$3,$4,$5,$1,$7,$6,$8,$10,$11,$12,$13,$9,$14,$16,$15,$18,$19,$17,$20,$21,$22;
  539. $2=_st($IRMethod())._new();
  540. $ctx1.sendIdx["new"]=1;
  541. _st($2)._source_(_st(self._source())._crlfSanitized());
  542. _st($2)._theClass_(self._theClass());
  543. _st($2)._arguments_(_st(aNode)._arguments());
  544. _st($2)._selector_(_st(aNode)._selector());
  545. _st($2)._sendIndexes_(_st(aNode)._sendIndexes());
  546. _st($2)._superSends_(_st(aNode)._superSends());
  547. _st($2)._requiresSmalltalkContext_(_st(aNode)._requiresSmalltalkContext());
  548. _st($2)._classReferences_(_st(aNode)._classReferences());
  549. $3=$2;
  550. $4=_st(aNode)._scope();
  551. $ctx1.sendIdx["scope"]=1;
  552. _st($3)._scope_($4);
  553. $ctx1.sendIdx["scope:"]=1;
  554. $5=_st($2)._yourself();
  555. $ctx1.sendIdx["yourself"]=1;
  556. $1=$5;
  557. self._method_($1);
  558. $7=_st(aNode)._scope();
  559. $ctx1.sendIdx["scope"]=2;
  560. $6=_st($7)._temps();
  561. _st($6)._do_((function(each){
  562. return smalltalk.withContext(function($ctx2) {
  563. $8=self._method();
  564. $ctx2.sendIdx["method"]=1;
  565. $10=_st($IRTempDeclaration())._new();
  566. $ctx2.sendIdx["new"]=2;
  567. _st($10)._name_(_st(each)._name());
  568. $11=$10;
  569. $12=_st(aNode)._scope();
  570. $ctx2.sendIdx["scope"]=3;
  571. _st($11)._scope_($12);
  572. $13=_st($10)._yourself();
  573. $ctx2.sendIdx["yourself"]=2;
  574. $9=$13;
  575. return _st($8)._add_($9);
  576. $ctx2.sendIdx["add:"]=1;
  577. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  578. }));
  579. $ctx1.sendIdx["do:"]=1;
  580. _st(_st(aNode)._nodes())._do_((function(each){
  581. return smalltalk.withContext(function($ctx2) {
  582. $14=self._method();
  583. $ctx2.sendIdx["method"]=2;
  584. return _st($14)._add_(self._visit_(each));
  585. $ctx2.sendIdx["add:"]=2;
  586. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  587. }));
  588. $16=_st(aNode)._scope();
  589. $ctx1.sendIdx["scope"]=4;
  590. $15=_st($16)._hasLocalReturn();
  591. if(! smalltalk.assert($15)){
  592. $18=self._method();
  593. $ctx1.sendIdx["method"]=3;
  594. $19=_st($IRReturn())._new();
  595. $ctx1.sendIdx["new"]=3;
  596. $17=_st($18)._add_($19);
  597. $20=_st($IRVariable())._new();
  598. _st($20)._variable_(_st(_st(_st(aNode)._scope())._pseudoVars())._at_("self"));
  599. $21=_st($20)._yourself();
  600. _st($17)._add_($21);
  601. $ctx1.sendIdx["add:"]=3;
  602. };
  603. $22=self._method();
  604. return $22;
  605. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},globals.IRASTTranslator)});
  606. },
  607. args: ["aNode"],
  608. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09superSends: aNode superSends;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\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\x09scope: aNode scope;\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",
  609. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "superSends:", "superSends", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"],
  610. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable"]
  611. }),
  612. globals.IRASTTranslator);
  613. smalltalk.addMethod(
  614. smalltalk.method({
  615. selector: "visitOrAlias:",
  616. protocol: 'visiting',
  617. fn: function (aNode){
  618. var self=this;
  619. return smalltalk.withContext(function($ctx1) {
  620. var $2,$1;
  621. $2=_st(aNode)._shouldBeAliased();
  622. if(smalltalk.assert($2)){
  623. $1=self._alias_(aNode);
  624. } else {
  625. $1=self._visit_(aNode);
  626. };
  627. return $1;
  628. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},globals.IRASTTranslator)});
  629. },
  630. args: ["aNode"],
  631. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  632. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"],
  633. referencedClasses: []
  634. }),
  635. globals.IRASTTranslator);
  636. smalltalk.addMethod(
  637. smalltalk.method({
  638. selector: "visitReturnNode:",
  639. protocol: 'visiting',
  640. fn: function (aNode){
  641. var self=this;
  642. var return_;
  643. function $IRNonLocalReturn(){return globals.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)}
  644. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  645. return smalltalk.withContext(function($ctx1) {
  646. var $1,$2;
  647. $1=_st(aNode)._nonLocalReturn();
  648. if(smalltalk.assert($1)){
  649. return_=_st($IRNonLocalReturn())._new();
  650. $ctx1.sendIdx["new"]=1;
  651. } else {
  652. return_=_st($IRReturn())._new();
  653. };
  654. _st(return_)._scope_(_st(aNode)._scope());
  655. _st(_st(aNode)._nodes())._do_((function(each){
  656. return smalltalk.withContext(function($ctx2) {
  657. return _st(return_)._add_(self._alias_(each));
  658. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  659. }));
  660. $2=return_;
  661. return $2;
  662. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},globals.IRASTTranslator)});
  663. },
  664. args: ["aNode"],
  665. 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",
  666. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "alias:"],
  667. referencedClasses: ["IRNonLocalReturn", "IRReturn"]
  668. }),
  669. globals.IRASTTranslator);
  670. smalltalk.addMethod(
  671. smalltalk.method({
  672. selector: "visitSendNode:",
  673. protocol: 'visiting',
  674. fn: function (aNode){
  675. var self=this;
  676. var send,all,receiver,arguments;
  677. function $IRSend(){return globals.IRSend||(typeof IRSend=="undefined"?nil:IRSend)}
  678. return smalltalk.withContext(function($ctx1) {
  679. var $1,$2,$3,$4;
  680. send=_st($IRSend())._new();
  681. $1=send;
  682. _st($1)._selector_(_st(aNode)._selector());
  683. $2=_st($1)._index_(_st(aNode)._index());
  684. $3=_st(aNode)._superSend();
  685. if(smalltalk.assert($3)){
  686. _st(send)._classSend_(_st(self._theClass())._superclass());
  687. };
  688. all=self._aliasTemporally_(_st([_st(aNode)._receiver()]).__comma(_st(aNode)._arguments()));
  689. receiver=_st(all)._first();
  690. arguments=_st(all)._allButFirst();
  691. _st(send)._add_(receiver);
  692. $ctx1.sendIdx["add:"]=1;
  693. _st(arguments)._do_((function(each){
  694. return smalltalk.withContext(function($ctx2) {
  695. return _st(send)._add_(each);
  696. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  697. }));
  698. $4=send;
  699. return $4;
  700. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments:arguments},globals.IRASTTranslator)});
  701. },
  702. args: ["aNode"],
  703. 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\x09\x0a\x09all := self aliasTemporally: { 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",
  704. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "aliasTemporally:", ",", "receiver", "arguments", "first", "allButFirst", "add:", "do:"],
  705. referencedClasses: ["IRSend"]
  706. }),
  707. globals.IRASTTranslator);
  708. smalltalk.addMethod(
  709. smalltalk.method({
  710. selector: "visitSequenceNode:",
  711. protocol: 'visiting',
  712. fn: function (aNode){
  713. var self=this;
  714. function $IRSequence(){return globals.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)}
  715. return smalltalk.withContext(function($ctx1) {
  716. var $2,$1;
  717. $1=self._withSequence_do_(_st($IRSequence())._new(),(function(){
  718. return smalltalk.withContext(function($ctx2) {
  719. return _st(_st(aNode)._nodes())._do_((function(each){
  720. var instruction;
  721. return smalltalk.withContext(function($ctx3) {
  722. instruction=self._visitOrAlias_(each);
  723. instruction;
  724. $2=_st(instruction)._isVariable();
  725. if(! smalltalk.assert($2)){
  726. return _st(self._sequence())._add_(instruction);
  727. };
  728. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  729. }));
  730. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  731. }));
  732. return $1;
  733. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.IRASTTranslator)});
  734. },
  735. args: ["aNode"],
  736. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visitOrAlias: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ] ]]",
  737. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"],
  738. referencedClasses: ["IRSequence"]
  739. }),
  740. globals.IRASTTranslator);
  741. smalltalk.addMethod(
  742. smalltalk.method({
  743. selector: "visitValueNode:",
  744. protocol: 'visiting',
  745. fn: function (aNode){
  746. var self=this;
  747. function $IRValue(){return globals.IRValue||(typeof IRValue=="undefined"?nil:IRValue)}
  748. return smalltalk.withContext(function($ctx1) {
  749. var $2,$3,$1;
  750. $2=_st($IRValue())._new();
  751. _st($2)._value_(_st(aNode)._value());
  752. $3=_st($2)._yourself();
  753. $1=$3;
  754. return $1;
  755. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},globals.IRASTTranslator)});
  756. },
  757. args: ["aNode"],
  758. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  759. messageSends: ["value:", "new", "value", "yourself"],
  760. referencedClasses: ["IRValue"]
  761. }),
  762. globals.IRASTTranslator);
  763. smalltalk.addMethod(
  764. smalltalk.method({
  765. selector: "visitVariableNode:",
  766. protocol: 'visiting',
  767. fn: function (aNode){
  768. var self=this;
  769. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  770. return smalltalk.withContext(function($ctx1) {
  771. var $2,$3,$1;
  772. $2=_st($IRVariable())._new();
  773. _st($2)._variable_(_st(aNode)._binding());
  774. $3=_st($2)._yourself();
  775. $1=$3;
  776. return $1;
  777. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.IRASTTranslator)});
  778. },
  779. args: ["aNode"],
  780. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  781. messageSends: ["variable:", "new", "binding", "yourself"],
  782. referencedClasses: ["IRVariable"]
  783. }),
  784. globals.IRASTTranslator);
  785. smalltalk.addMethod(
  786. smalltalk.method({
  787. selector: "withSequence:do:",
  788. protocol: 'accessing',
  789. fn: function (aSequence,aBlock){
  790. var self=this;
  791. var outerSequence;
  792. return smalltalk.withContext(function($ctx1) {
  793. outerSequence=self._sequence();
  794. self._sequence_(aSequence);
  795. $ctx1.sendIdx["sequence:"]=1;
  796. _st(aBlock)._value();
  797. self._sequence_(outerSequence);
  798. return aSequence;
  799. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},globals.IRASTTranslator)});
  800. },
  801. args: ["aSequence", "aBlock"],
  802. 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",
  803. messageSends: ["sequence", "sequence:", "value"],
  804. referencedClasses: []
  805. }),
  806. globals.IRASTTranslator);
  807. smalltalk.addClass('IRInstruction', globals.Object, ['parent', 'instructions'], 'Compiler-IR');
  808. globals.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.";
  809. smalltalk.addMethod(
  810. smalltalk.method({
  811. selector: "accept:",
  812. protocol: 'visiting',
  813. fn: function (aVisitor){
  814. var self=this;
  815. return smalltalk.withContext(function($ctx1) {
  816. var $1;
  817. $1=_st(aVisitor)._visitIRInstruction_(self);
  818. return $1;
  819. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInstruction)});
  820. },
  821. args: ["aVisitor"],
  822. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  823. messageSends: ["visitIRInstruction:"],
  824. referencedClasses: []
  825. }),
  826. globals.IRInstruction);
  827. smalltalk.addMethod(
  828. smalltalk.method({
  829. selector: "add:",
  830. protocol: 'building',
  831. fn: function (anObject){
  832. var self=this;
  833. return smalltalk.withContext(function($ctx1) {
  834. var $1;
  835. _st(anObject)._parent_(self);
  836. $1=_st(self._instructions())._add_(anObject);
  837. return $1;
  838. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.IRInstruction)});
  839. },
  840. args: ["anObject"],
  841. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  842. messageSends: ["parent:", "add:", "instructions"],
  843. referencedClasses: []
  844. }),
  845. globals.IRInstruction);
  846. smalltalk.addMethod(
  847. smalltalk.method({
  848. selector: "canBeAssigned",
  849. protocol: 'testing',
  850. fn: function (){
  851. var self=this;
  852. return true;
  853. },
  854. args: [],
  855. source: "canBeAssigned\x0a\x09^ true",
  856. messageSends: [],
  857. referencedClasses: []
  858. }),
  859. globals.IRInstruction);
  860. smalltalk.addMethod(
  861. smalltalk.method({
  862. selector: "instructions",
  863. protocol: 'accessing',
  864. fn: function (){
  865. var self=this;
  866. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  867. return smalltalk.withContext(function($ctx1) {
  868. var $2,$1,$receiver;
  869. $2=self["@instructions"];
  870. if(($receiver = $2) == null || $receiver.isNil){
  871. self["@instructions"]=_st($OrderedCollection())._new();
  872. $1=self["@instructions"];
  873. } else {
  874. $1=$2;
  875. };
  876. return $1;
  877. }, function($ctx1) {$ctx1.fill(self,"instructions",{},globals.IRInstruction)});
  878. },
  879. args: [],
  880. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  881. messageSends: ["ifNil:", "new"],
  882. referencedClasses: ["OrderedCollection"]
  883. }),
  884. globals.IRInstruction);
  885. smalltalk.addMethod(
  886. smalltalk.method({
  887. selector: "isClosure",
  888. protocol: 'testing',
  889. fn: function (){
  890. var self=this;
  891. return false;
  892. },
  893. args: [],
  894. source: "isClosure\x0a\x09^ false",
  895. messageSends: [],
  896. referencedClasses: []
  897. }),
  898. globals.IRInstruction);
  899. smalltalk.addMethod(
  900. smalltalk.method({
  901. selector: "isInlined",
  902. protocol: 'testing',
  903. fn: function (){
  904. var self=this;
  905. return false;
  906. },
  907. args: [],
  908. source: "isInlined\x0a\x09^ false",
  909. messageSends: [],
  910. referencedClasses: []
  911. }),
  912. globals.IRInstruction);
  913. smalltalk.addMethod(
  914. smalltalk.method({
  915. selector: "isLocalReturn",
  916. protocol: 'testing',
  917. fn: function (){
  918. var self=this;
  919. return false;
  920. },
  921. args: [],
  922. source: "isLocalReturn\x0a\x09^ false",
  923. messageSends: [],
  924. referencedClasses: []
  925. }),
  926. globals.IRInstruction);
  927. smalltalk.addMethod(
  928. smalltalk.method({
  929. selector: "isMethod",
  930. protocol: 'testing',
  931. fn: function (){
  932. var self=this;
  933. return false;
  934. },
  935. args: [],
  936. source: "isMethod\x0a\x09^ false",
  937. messageSends: [],
  938. referencedClasses: []
  939. }),
  940. globals.IRInstruction);
  941. smalltalk.addMethod(
  942. smalltalk.method({
  943. selector: "isReturn",
  944. protocol: 'testing',
  945. fn: function (){
  946. var self=this;
  947. return false;
  948. },
  949. args: [],
  950. source: "isReturn\x0a\x09^ false",
  951. messageSends: [],
  952. referencedClasses: []
  953. }),
  954. globals.IRInstruction);
  955. smalltalk.addMethod(
  956. smalltalk.method({
  957. selector: "isSend",
  958. protocol: 'testing',
  959. fn: function (){
  960. var self=this;
  961. return false;
  962. },
  963. args: [],
  964. source: "isSend\x0a\x09^ false",
  965. messageSends: [],
  966. referencedClasses: []
  967. }),
  968. globals.IRInstruction);
  969. smalltalk.addMethod(
  970. smalltalk.method({
  971. selector: "isSequence",
  972. protocol: 'testing',
  973. fn: function (){
  974. var self=this;
  975. return false;
  976. },
  977. args: [],
  978. source: "isSequence\x0a\x09^ false",
  979. messageSends: [],
  980. referencedClasses: []
  981. }),
  982. globals.IRInstruction);
  983. smalltalk.addMethod(
  984. smalltalk.method({
  985. selector: "isTempDeclaration",
  986. protocol: 'testing',
  987. fn: function (){
  988. var self=this;
  989. return false;
  990. },
  991. args: [],
  992. source: "isTempDeclaration\x0a\x09^ false",
  993. messageSends: [],
  994. referencedClasses: []
  995. }),
  996. globals.IRInstruction);
  997. smalltalk.addMethod(
  998. smalltalk.method({
  999. selector: "isVariable",
  1000. protocol: 'testing',
  1001. fn: function (){
  1002. var self=this;
  1003. return false;
  1004. },
  1005. args: [],
  1006. source: "isVariable\x0a\x09^ false",
  1007. messageSends: [],
  1008. referencedClasses: []
  1009. }),
  1010. globals.IRInstruction);
  1011. smalltalk.addMethod(
  1012. smalltalk.method({
  1013. selector: "method",
  1014. protocol: 'accessing',
  1015. fn: function (){
  1016. var self=this;
  1017. return smalltalk.withContext(function($ctx1) {
  1018. var $1;
  1019. $1=_st(self._parent())._method();
  1020. return $1;
  1021. }, function($ctx1) {$ctx1.fill(self,"method",{},globals.IRInstruction)});
  1022. },
  1023. args: [],
  1024. source: "method\x0a\x09^ self parent method",
  1025. messageSends: ["method", "parent"],
  1026. referencedClasses: []
  1027. }),
  1028. globals.IRInstruction);
  1029. smalltalk.addMethod(
  1030. smalltalk.method({
  1031. selector: "needsBoxingAsReceiver",
  1032. protocol: 'testing',
  1033. fn: function (){
  1034. var self=this;
  1035. return true;
  1036. },
  1037. args: [],
  1038. source: "needsBoxingAsReceiver\x0a\x09^ true",
  1039. messageSends: [],
  1040. referencedClasses: []
  1041. }),
  1042. globals.IRInstruction);
  1043. smalltalk.addMethod(
  1044. smalltalk.method({
  1045. selector: "parent",
  1046. protocol: 'accessing',
  1047. fn: function (){
  1048. var self=this;
  1049. var $1;
  1050. $1=self["@parent"];
  1051. return $1;
  1052. },
  1053. args: [],
  1054. source: "parent\x0a\x09^ parent",
  1055. messageSends: [],
  1056. referencedClasses: []
  1057. }),
  1058. globals.IRInstruction);
  1059. smalltalk.addMethod(
  1060. smalltalk.method({
  1061. selector: "parent:",
  1062. protocol: 'accessing',
  1063. fn: function (anIRInstruction){
  1064. var self=this;
  1065. self["@parent"]=anIRInstruction;
  1066. return self
  1067. },
  1068. args: ["anIRInstruction"],
  1069. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  1070. messageSends: [],
  1071. referencedClasses: []
  1072. }),
  1073. globals.IRInstruction);
  1074. smalltalk.addMethod(
  1075. smalltalk.method({
  1076. selector: "remove",
  1077. protocol: 'building',
  1078. fn: function (){
  1079. var self=this;
  1080. return smalltalk.withContext(function($ctx1) {
  1081. _st(self._parent())._remove_(self);
  1082. return self}, function($ctx1) {$ctx1.fill(self,"remove",{},globals.IRInstruction)});
  1083. },
  1084. args: [],
  1085. source: "remove\x0a\x09self parent remove: self",
  1086. messageSends: ["remove:", "parent"],
  1087. referencedClasses: []
  1088. }),
  1089. globals.IRInstruction);
  1090. smalltalk.addMethod(
  1091. smalltalk.method({
  1092. selector: "remove:",
  1093. protocol: 'building',
  1094. fn: function (anIRInstruction){
  1095. var self=this;
  1096. return smalltalk.withContext(function($ctx1) {
  1097. _st(self._instructions())._remove_(anIRInstruction);
  1098. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},globals.IRInstruction)});
  1099. },
  1100. args: ["anIRInstruction"],
  1101. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  1102. messageSends: ["remove:", "instructions"],
  1103. referencedClasses: []
  1104. }),
  1105. globals.IRInstruction);
  1106. smalltalk.addMethod(
  1107. smalltalk.method({
  1108. selector: "replace:with:",
  1109. protocol: 'building',
  1110. fn: function (anIRInstruction,anotherIRInstruction){
  1111. var self=this;
  1112. return smalltalk.withContext(function($ctx1) {
  1113. var $1;
  1114. _st(anotherIRInstruction)._parent_(self);
  1115. $1=self._instructions();
  1116. $ctx1.sendIdx["instructions"]=1;
  1117. _st($1)._at_put_(_st(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  1118. return self}, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRInstruction)});
  1119. },
  1120. args: ["anIRInstruction", "anotherIRInstruction"],
  1121. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  1122. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"],
  1123. referencedClasses: []
  1124. }),
  1125. globals.IRInstruction);
  1126. smalltalk.addMethod(
  1127. smalltalk.method({
  1128. selector: "replaceWith:",
  1129. protocol: 'building',
  1130. fn: function (anIRInstruction){
  1131. var self=this;
  1132. return smalltalk.withContext(function($ctx1) {
  1133. _st(self._parent())._replace_with_(self,anIRInstruction);
  1134. return self}, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},globals.IRInstruction)});
  1135. },
  1136. args: ["anIRInstruction"],
  1137. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  1138. messageSends: ["replace:with:", "parent"],
  1139. referencedClasses: []
  1140. }),
  1141. globals.IRInstruction);
  1142. smalltalk.addMethod(
  1143. smalltalk.method({
  1144. selector: "scope",
  1145. protocol: 'accessing',
  1146. fn: function (){
  1147. var self=this;
  1148. return smalltalk.withContext(function($ctx1) {
  1149. var $2,$1,$receiver;
  1150. $2=self._parent();
  1151. if(($receiver = $2) == null || $receiver.isNil){
  1152. $1=$2;
  1153. } else {
  1154. var node;
  1155. node=$receiver;
  1156. $1=_st(node)._scope();
  1157. };
  1158. return $1;
  1159. }, function($ctx1) {$ctx1.fill(self,"scope",{},globals.IRInstruction)});
  1160. },
  1161. args: [],
  1162. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  1163. messageSends: ["ifNotNil:", "parent", "scope"],
  1164. referencedClasses: []
  1165. }),
  1166. globals.IRInstruction);
  1167. smalltalk.addMethod(
  1168. smalltalk.method({
  1169. selector: "on:",
  1170. protocol: 'instance creation',
  1171. fn: function (aBuilder){
  1172. var self=this;
  1173. return smalltalk.withContext(function($ctx1) {
  1174. var $2,$3,$1;
  1175. $2=self._new();
  1176. _st($2)._builder_(aBuilder);
  1177. $3=_st($2)._yourself();
  1178. $1=$3;
  1179. return $1;
  1180. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},globals.IRInstruction.klass)});
  1181. },
  1182. args: ["aBuilder"],
  1183. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  1184. messageSends: ["builder:", "new", "yourself"],
  1185. referencedClasses: []
  1186. }),
  1187. globals.IRInstruction.klass);
  1188. smalltalk.addClass('IRAssignment', globals.IRInstruction, [], 'Compiler-IR');
  1189. smalltalk.addMethod(
  1190. smalltalk.method({
  1191. selector: "accept:",
  1192. protocol: 'visiting',
  1193. fn: function (aVisitor){
  1194. var self=this;
  1195. return smalltalk.withContext(function($ctx1) {
  1196. var $1;
  1197. $1=_st(aVisitor)._visitIRAssignment_(self);
  1198. return $1;
  1199. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRAssignment)});
  1200. },
  1201. args: ["aVisitor"],
  1202. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  1203. messageSends: ["visitIRAssignment:"],
  1204. referencedClasses: []
  1205. }),
  1206. globals.IRAssignment);
  1207. smalltalk.addClass('IRDynamicArray', globals.IRInstruction, [], 'Compiler-IR');
  1208. smalltalk.addMethod(
  1209. smalltalk.method({
  1210. selector: "accept:",
  1211. protocol: 'visiting',
  1212. fn: function (aVisitor){
  1213. var self=this;
  1214. return smalltalk.withContext(function($ctx1) {
  1215. var $1;
  1216. $1=_st(aVisitor)._visitIRDynamicArray_(self);
  1217. return $1;
  1218. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRDynamicArray)});
  1219. },
  1220. args: ["aVisitor"],
  1221. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  1222. messageSends: ["visitIRDynamicArray:"],
  1223. referencedClasses: []
  1224. }),
  1225. globals.IRDynamicArray);
  1226. smalltalk.addClass('IRDynamicDictionary', globals.IRInstruction, [], 'Compiler-IR');
  1227. smalltalk.addMethod(
  1228. smalltalk.method({
  1229. selector: "accept:",
  1230. protocol: 'visiting',
  1231. fn: function (aVisitor){
  1232. var self=this;
  1233. return smalltalk.withContext(function($ctx1) {
  1234. var $1;
  1235. $1=_st(aVisitor)._visitIRDynamicDictionary_(self);
  1236. return $1;
  1237. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRDynamicDictionary)});
  1238. },
  1239. args: ["aVisitor"],
  1240. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  1241. messageSends: ["visitIRDynamicDictionary:"],
  1242. referencedClasses: []
  1243. }),
  1244. globals.IRDynamicDictionary);
  1245. smalltalk.addClass('IRScopedInstruction', globals.IRInstruction, ['scope'], 'Compiler-IR');
  1246. smalltalk.addMethod(
  1247. smalltalk.method({
  1248. selector: "scope",
  1249. protocol: 'accessing',
  1250. fn: function (){
  1251. var self=this;
  1252. var $1;
  1253. $1=self["@scope"];
  1254. return $1;
  1255. },
  1256. args: [],
  1257. source: "scope\x0a\x09^ scope",
  1258. messageSends: [],
  1259. referencedClasses: []
  1260. }),
  1261. globals.IRScopedInstruction);
  1262. smalltalk.addMethod(
  1263. smalltalk.method({
  1264. selector: "scope:",
  1265. protocol: 'accessing',
  1266. fn: function (aScope){
  1267. var self=this;
  1268. self["@scope"]=aScope;
  1269. return self
  1270. },
  1271. args: ["aScope"],
  1272. source: "scope: aScope\x0a\x09scope := aScope",
  1273. messageSends: [],
  1274. referencedClasses: []
  1275. }),
  1276. globals.IRScopedInstruction);
  1277. smalltalk.addClass('IRClosureInstruction', globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  1278. smalltalk.addMethod(
  1279. smalltalk.method({
  1280. selector: "arguments",
  1281. protocol: 'accessing',
  1282. fn: function (){
  1283. var self=this;
  1284. return smalltalk.withContext(function($ctx1) {
  1285. var $2,$1,$receiver;
  1286. $2=self["@arguments"];
  1287. if(($receiver = $2) == null || $receiver.isNil){
  1288. $1=[];
  1289. } else {
  1290. $1=$2;
  1291. };
  1292. return $1;
  1293. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.IRClosureInstruction)});
  1294. },
  1295. args: [],
  1296. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  1297. messageSends: ["ifNil:"],
  1298. referencedClasses: []
  1299. }),
  1300. globals.IRClosureInstruction);
  1301. smalltalk.addMethod(
  1302. smalltalk.method({
  1303. selector: "arguments:",
  1304. protocol: 'accessing',
  1305. fn: function (aCollection){
  1306. var self=this;
  1307. self["@arguments"]=aCollection;
  1308. return self
  1309. },
  1310. args: ["aCollection"],
  1311. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  1312. messageSends: [],
  1313. referencedClasses: []
  1314. }),
  1315. globals.IRClosureInstruction);
  1316. smalltalk.addMethod(
  1317. smalltalk.method({
  1318. selector: "locals",
  1319. protocol: 'accessing',
  1320. fn: function (){
  1321. var self=this;
  1322. return smalltalk.withContext(function($ctx1) {
  1323. var $2,$3,$1;
  1324. $2=_st(self._arguments())._copy();
  1325. _st($2)._addAll_(_st(self._tempDeclarations())._collect_((function(each){
  1326. return smalltalk.withContext(function($ctx2) {
  1327. return _st(each)._name();
  1328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1329. })));
  1330. $3=_st($2)._yourself();
  1331. $1=$3;
  1332. return $1;
  1333. }, function($ctx1) {$ctx1.fill(self,"locals",{},globals.IRClosureInstruction)});
  1334. },
  1335. args: [],
  1336. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  1337. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"],
  1338. referencedClasses: []
  1339. }),
  1340. globals.IRClosureInstruction);
  1341. smalltalk.addMethod(
  1342. smalltalk.method({
  1343. selector: "requiresSmalltalkContext",
  1344. protocol: 'accessing',
  1345. fn: function (){
  1346. var self=this;
  1347. return smalltalk.withContext(function($ctx1) {
  1348. var $2,$1,$receiver;
  1349. $2=self["@requiresSmalltalkContext"];
  1350. if(($receiver = $2) == null || $receiver.isNil){
  1351. $1=false;
  1352. } else {
  1353. $1=$2;
  1354. };
  1355. return $1;
  1356. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},globals.IRClosureInstruction)});
  1357. },
  1358. args: [],
  1359. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  1360. messageSends: ["ifNil:"],
  1361. referencedClasses: []
  1362. }),
  1363. globals.IRClosureInstruction);
  1364. smalltalk.addMethod(
  1365. smalltalk.method({
  1366. selector: "requiresSmalltalkContext:",
  1367. protocol: 'accessing',
  1368. fn: function (anObject){
  1369. var self=this;
  1370. self["@requiresSmalltalkContext"]=anObject;
  1371. return self
  1372. },
  1373. args: ["anObject"],
  1374. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  1375. messageSends: [],
  1376. referencedClasses: []
  1377. }),
  1378. globals.IRClosureInstruction);
  1379. smalltalk.addMethod(
  1380. smalltalk.method({
  1381. selector: "scope:",
  1382. protocol: 'accessing',
  1383. fn: function (aScope){
  1384. var self=this;
  1385. return smalltalk.withContext(function($ctx1) {
  1386. ($ctx1.supercall = true, globals.IRClosureInstruction.superclass.fn.prototype._scope_.apply(_st(self), [aScope]));
  1387. $ctx1.supercall = false;
  1388. _st(aScope)._instruction_(self);
  1389. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},globals.IRClosureInstruction)});
  1390. },
  1391. args: ["aScope"],
  1392. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  1393. messageSends: ["scope:", "instruction:"],
  1394. referencedClasses: []
  1395. }),
  1396. globals.IRClosureInstruction);
  1397. smalltalk.addMethod(
  1398. smalltalk.method({
  1399. selector: "tempDeclarations",
  1400. protocol: 'accessing',
  1401. fn: function (){
  1402. var self=this;
  1403. return smalltalk.withContext(function($ctx1) {
  1404. var $1;
  1405. $1=_st(self._instructions())._select_((function(each){
  1406. return smalltalk.withContext(function($ctx2) {
  1407. return _st(each)._isTempDeclaration();
  1408. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1409. }));
  1410. return $1;
  1411. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},globals.IRClosureInstruction)});
  1412. },
  1413. args: [],
  1414. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  1415. messageSends: ["select:", "instructions", "isTempDeclaration"],
  1416. referencedClasses: []
  1417. }),
  1418. globals.IRClosureInstruction);
  1419. smalltalk.addClass('IRClosure', globals.IRClosureInstruction, [], 'Compiler-IR');
  1420. smalltalk.addMethod(
  1421. smalltalk.method({
  1422. selector: "accept:",
  1423. protocol: 'visiting',
  1424. fn: function (aVisitor){
  1425. var self=this;
  1426. return smalltalk.withContext(function($ctx1) {
  1427. var $1;
  1428. $1=_st(aVisitor)._visitIRClosure_(self);
  1429. return $1;
  1430. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRClosure)});
  1431. },
  1432. args: ["aVisitor"],
  1433. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  1434. messageSends: ["visitIRClosure:"],
  1435. referencedClasses: []
  1436. }),
  1437. globals.IRClosure);
  1438. smalltalk.addMethod(
  1439. smalltalk.method({
  1440. selector: "isClosure",
  1441. protocol: 'testing',
  1442. fn: function (){
  1443. var self=this;
  1444. return true;
  1445. },
  1446. args: [],
  1447. source: "isClosure\x0a\x09^ true",
  1448. messageSends: [],
  1449. referencedClasses: []
  1450. }),
  1451. globals.IRClosure);
  1452. smalltalk.addMethod(
  1453. smalltalk.method({
  1454. selector: "sequence",
  1455. protocol: 'accessing',
  1456. fn: function (){
  1457. var self=this;
  1458. return smalltalk.withContext(function($ctx1) {
  1459. var $1;
  1460. $1=_st(self._instructions())._last();
  1461. return $1;
  1462. }, function($ctx1) {$ctx1.fill(self,"sequence",{},globals.IRClosure)});
  1463. },
  1464. args: [],
  1465. source: "sequence\x0a\x09^ self instructions last",
  1466. messageSends: ["last", "instructions"],
  1467. referencedClasses: []
  1468. }),
  1469. globals.IRClosure);
  1470. smalltalk.addClass('IRMethod', globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'superSends', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  1471. globals.IRMethod.comment="I am a method instruction";
  1472. smalltalk.addMethod(
  1473. smalltalk.method({
  1474. selector: "accept:",
  1475. protocol: 'visiting',
  1476. fn: function (aVisitor){
  1477. var self=this;
  1478. return smalltalk.withContext(function($ctx1) {
  1479. var $1;
  1480. $1=_st(aVisitor)._visitIRMethod_(self);
  1481. return $1;
  1482. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRMethod)});
  1483. },
  1484. args: ["aVisitor"],
  1485. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  1486. messageSends: ["visitIRMethod:"],
  1487. referencedClasses: []
  1488. }),
  1489. globals.IRMethod);
  1490. smalltalk.addMethod(
  1491. smalltalk.method({
  1492. selector: "classReferences",
  1493. protocol: 'accessing',
  1494. fn: function (){
  1495. var self=this;
  1496. var $1;
  1497. $1=self["@classReferences"];
  1498. return $1;
  1499. },
  1500. args: [],
  1501. source: "classReferences\x0a\x09^ classReferences",
  1502. messageSends: [],
  1503. referencedClasses: []
  1504. }),
  1505. globals.IRMethod);
  1506. smalltalk.addMethod(
  1507. smalltalk.method({
  1508. selector: "classReferences:",
  1509. protocol: 'accessing',
  1510. fn: function (aCollection){
  1511. var self=this;
  1512. self["@classReferences"]=aCollection;
  1513. return self
  1514. },
  1515. args: ["aCollection"],
  1516. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  1517. messageSends: [],
  1518. referencedClasses: []
  1519. }),
  1520. globals.IRMethod);
  1521. smalltalk.addMethod(
  1522. smalltalk.method({
  1523. selector: "internalVariables",
  1524. protocol: 'accessing',
  1525. fn: function (){
  1526. var self=this;
  1527. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  1528. return smalltalk.withContext(function($ctx1) {
  1529. var $2,$1,$receiver;
  1530. $2=self["@internalVariables"];
  1531. if(($receiver = $2) == null || $receiver.isNil){
  1532. self["@internalVariables"]=_st($Set())._new();
  1533. $1=self["@internalVariables"];
  1534. } else {
  1535. $1=$2;
  1536. };
  1537. return $1;
  1538. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},globals.IRMethod)});
  1539. },
  1540. args: [],
  1541. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  1542. messageSends: ["ifNil:", "new"],
  1543. referencedClasses: ["Set"]
  1544. }),
  1545. globals.IRMethod);
  1546. smalltalk.addMethod(
  1547. smalltalk.method({
  1548. selector: "isMethod",
  1549. protocol: 'accessing',
  1550. fn: function (){
  1551. var self=this;
  1552. return true;
  1553. },
  1554. args: [],
  1555. source: "isMethod\x0a\x09^ true",
  1556. messageSends: [],
  1557. referencedClasses: []
  1558. }),
  1559. globals.IRMethod);
  1560. smalltalk.addMethod(
  1561. smalltalk.method({
  1562. selector: "messageSends",
  1563. protocol: 'accessing',
  1564. fn: function (){
  1565. var self=this;
  1566. return smalltalk.withContext(function($ctx1) {
  1567. var $1;
  1568. $1=_st(self._sendIndexes())._keys();
  1569. return $1;
  1570. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.IRMethod)});
  1571. },
  1572. args: [],
  1573. source: "messageSends\x0a\x09^ self sendIndexes keys",
  1574. messageSends: ["keys", "sendIndexes"],
  1575. referencedClasses: []
  1576. }),
  1577. globals.IRMethod);
  1578. smalltalk.addMethod(
  1579. smalltalk.method({
  1580. selector: "method",
  1581. protocol: 'accessing',
  1582. fn: function (){
  1583. var self=this;
  1584. return self;
  1585. },
  1586. args: [],
  1587. source: "method\x0a\x09^ self",
  1588. messageSends: [],
  1589. referencedClasses: []
  1590. }),
  1591. globals.IRMethod);
  1592. smalltalk.addMethod(
  1593. smalltalk.method({
  1594. selector: "selector",
  1595. protocol: 'accessing',
  1596. fn: function (){
  1597. var self=this;
  1598. var $1;
  1599. $1=self["@selector"];
  1600. return $1;
  1601. },
  1602. args: [],
  1603. source: "selector\x0a\x09^ selector",
  1604. messageSends: [],
  1605. referencedClasses: []
  1606. }),
  1607. globals.IRMethod);
  1608. smalltalk.addMethod(
  1609. smalltalk.method({
  1610. selector: "selector:",
  1611. protocol: 'accessing',
  1612. fn: function (aString){
  1613. var self=this;
  1614. self["@selector"]=aString;
  1615. return self
  1616. },
  1617. args: ["aString"],
  1618. source: "selector: aString\x0a\x09selector := aString",
  1619. messageSends: [],
  1620. referencedClasses: []
  1621. }),
  1622. globals.IRMethod);
  1623. smalltalk.addMethod(
  1624. smalltalk.method({
  1625. selector: "sendIndexes",
  1626. protocol: 'accessing',
  1627. fn: function (){
  1628. var self=this;
  1629. var $1;
  1630. $1=self["@sendIndexes"];
  1631. return $1;
  1632. },
  1633. args: [],
  1634. source: "sendIndexes\x0a\x09^ sendIndexes",
  1635. messageSends: [],
  1636. referencedClasses: []
  1637. }),
  1638. globals.IRMethod);
  1639. smalltalk.addMethod(
  1640. smalltalk.method({
  1641. selector: "sendIndexes:",
  1642. protocol: 'accessing',
  1643. fn: function (aDictionary){
  1644. var self=this;
  1645. self["@sendIndexes"]=aDictionary;
  1646. return self
  1647. },
  1648. args: ["aDictionary"],
  1649. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  1650. messageSends: [],
  1651. referencedClasses: []
  1652. }),
  1653. globals.IRMethod);
  1654. smalltalk.addMethod(
  1655. smalltalk.method({
  1656. selector: "source",
  1657. protocol: 'accessing',
  1658. fn: function (){
  1659. var self=this;
  1660. var $1;
  1661. $1=self["@source"];
  1662. return $1;
  1663. },
  1664. args: [],
  1665. source: "source\x0a\x09^ source",
  1666. messageSends: [],
  1667. referencedClasses: []
  1668. }),
  1669. globals.IRMethod);
  1670. smalltalk.addMethod(
  1671. smalltalk.method({
  1672. selector: "source:",
  1673. protocol: 'accessing',
  1674. fn: function (aString){
  1675. var self=this;
  1676. self["@source"]=aString;
  1677. return self
  1678. },
  1679. args: ["aString"],
  1680. source: "source: aString\x0a\x09source := aString",
  1681. messageSends: [],
  1682. referencedClasses: []
  1683. }),
  1684. globals.IRMethod);
  1685. smalltalk.addMethod(
  1686. smalltalk.method({
  1687. selector: "superSends",
  1688. protocol: 'accessing',
  1689. fn: function (){
  1690. var self=this;
  1691. var $1;
  1692. $1=self["@superSends"];
  1693. return $1;
  1694. },
  1695. args: [],
  1696. source: "superSends\x0a\x09^ superSends",
  1697. messageSends: [],
  1698. referencedClasses: []
  1699. }),
  1700. globals.IRMethod);
  1701. smalltalk.addMethod(
  1702. smalltalk.method({
  1703. selector: "superSends:",
  1704. protocol: 'accessing',
  1705. fn: function (aCollection){
  1706. var self=this;
  1707. self["@superSends"]=aCollection;
  1708. return self
  1709. },
  1710. args: ["aCollection"],
  1711. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  1712. messageSends: [],
  1713. referencedClasses: []
  1714. }),
  1715. globals.IRMethod);
  1716. smalltalk.addMethod(
  1717. smalltalk.method({
  1718. selector: "theClass",
  1719. protocol: 'accessing',
  1720. fn: function (){
  1721. var self=this;
  1722. var $1;
  1723. $1=self["@theClass"];
  1724. return $1;
  1725. },
  1726. args: [],
  1727. source: "theClass\x0a\x09^ theClass",
  1728. messageSends: [],
  1729. referencedClasses: []
  1730. }),
  1731. globals.IRMethod);
  1732. smalltalk.addMethod(
  1733. smalltalk.method({
  1734. selector: "theClass:",
  1735. protocol: 'accessing',
  1736. fn: function (aClass){
  1737. var self=this;
  1738. self["@theClass"]=aClass;
  1739. return self
  1740. },
  1741. args: ["aClass"],
  1742. source: "theClass: aClass\x0a\x09theClass := aClass",
  1743. messageSends: [],
  1744. referencedClasses: []
  1745. }),
  1746. globals.IRMethod);
  1747. smalltalk.addClass('IRReturn', globals.IRScopedInstruction, [], 'Compiler-IR');
  1748. globals.IRReturn.comment="I am a local return instruction.";
  1749. smalltalk.addMethod(
  1750. smalltalk.method({
  1751. selector: "accept:",
  1752. protocol: 'visiting',
  1753. fn: function (aVisitor){
  1754. var self=this;
  1755. return smalltalk.withContext(function($ctx1) {
  1756. var $1;
  1757. $1=_st(aVisitor)._visitIRReturn_(self);
  1758. return $1;
  1759. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRReturn)});
  1760. },
  1761. args: ["aVisitor"],
  1762. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  1763. messageSends: ["visitIRReturn:"],
  1764. referencedClasses: []
  1765. }),
  1766. globals.IRReturn);
  1767. smalltalk.addMethod(
  1768. smalltalk.method({
  1769. selector: "canBeAssigned",
  1770. protocol: 'testing',
  1771. fn: function (){
  1772. var self=this;
  1773. return false;
  1774. },
  1775. args: [],
  1776. source: "canBeAssigned\x0a\x09^ false",
  1777. messageSends: [],
  1778. referencedClasses: []
  1779. }),
  1780. globals.IRReturn);
  1781. smalltalk.addMethod(
  1782. smalltalk.method({
  1783. selector: "isBlockReturn",
  1784. protocol: 'testing',
  1785. fn: function (){
  1786. var self=this;
  1787. return false;
  1788. },
  1789. args: [],
  1790. source: "isBlockReturn\x0a\x09^ false",
  1791. messageSends: [],
  1792. referencedClasses: []
  1793. }),
  1794. globals.IRReturn);
  1795. smalltalk.addMethod(
  1796. smalltalk.method({
  1797. selector: "isLocalReturn",
  1798. protocol: 'testing',
  1799. fn: function (){
  1800. var self=this;
  1801. return true;
  1802. },
  1803. args: [],
  1804. source: "isLocalReturn\x0a\x09^ true",
  1805. messageSends: [],
  1806. referencedClasses: []
  1807. }),
  1808. globals.IRReturn);
  1809. smalltalk.addMethod(
  1810. smalltalk.method({
  1811. selector: "isNonLocalReturn",
  1812. protocol: 'testing',
  1813. fn: function (){
  1814. var self=this;
  1815. return smalltalk.withContext(function($ctx1) {
  1816. var $1;
  1817. $1=_st(self._isLocalReturn())._not();
  1818. return $1;
  1819. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},globals.IRReturn)});
  1820. },
  1821. args: [],
  1822. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  1823. messageSends: ["not", "isLocalReturn"],
  1824. referencedClasses: []
  1825. }),
  1826. globals.IRReturn);
  1827. smalltalk.addMethod(
  1828. smalltalk.method({
  1829. selector: "isReturn",
  1830. protocol: 'testing',
  1831. fn: function (){
  1832. var self=this;
  1833. return true;
  1834. },
  1835. args: [],
  1836. source: "isReturn\x0a\x09^ true",
  1837. messageSends: [],
  1838. referencedClasses: []
  1839. }),
  1840. globals.IRReturn);
  1841. smalltalk.addMethod(
  1842. smalltalk.method({
  1843. selector: "scope",
  1844. protocol: 'accessing',
  1845. fn: function (){
  1846. var self=this;
  1847. return smalltalk.withContext(function($ctx1) {
  1848. var $2,$1,$receiver;
  1849. $2=self["@scope"];
  1850. if(($receiver = $2) == null || $receiver.isNil){
  1851. $1=_st(self._parent())._scope();
  1852. } else {
  1853. $1=$2;
  1854. };
  1855. return $1;
  1856. }, function($ctx1) {$ctx1.fill(self,"scope",{},globals.IRReturn)});
  1857. },
  1858. args: [],
  1859. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  1860. messageSends: ["ifNil:", "scope", "parent"],
  1861. referencedClasses: []
  1862. }),
  1863. globals.IRReturn);
  1864. smalltalk.addClass('IRBlockReturn', globals.IRReturn, [], 'Compiler-IR');
  1865. globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  1866. smalltalk.addMethod(
  1867. smalltalk.method({
  1868. selector: "accept:",
  1869. protocol: 'visiting',
  1870. fn: function (aVisitor){
  1871. var self=this;
  1872. return smalltalk.withContext(function($ctx1) {
  1873. var $1;
  1874. $1=_st(aVisitor)._visitIRBlockReturn_(self);
  1875. return $1;
  1876. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRBlockReturn)});
  1877. },
  1878. args: ["aVisitor"],
  1879. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  1880. messageSends: ["visitIRBlockReturn:"],
  1881. referencedClasses: []
  1882. }),
  1883. globals.IRBlockReturn);
  1884. smalltalk.addMethod(
  1885. smalltalk.method({
  1886. selector: "isBlockReturn",
  1887. protocol: 'testing',
  1888. fn: function (){
  1889. var self=this;
  1890. return true;
  1891. },
  1892. args: [],
  1893. source: "isBlockReturn\x0a\x09^ true",
  1894. messageSends: [],
  1895. referencedClasses: []
  1896. }),
  1897. globals.IRBlockReturn);
  1898. smalltalk.addClass('IRNonLocalReturn', globals.IRReturn, [], 'Compiler-IR');
  1899. globals.IRNonLocalReturn.comment="I am a non local return instruction.\x0aNon local returns are handled using a try/catch JavaScript statement.\x0a\x0aSee `IRNonLocalReturnHandling` class.";
  1900. smalltalk.addMethod(
  1901. smalltalk.method({
  1902. selector: "accept:",
  1903. protocol: 'visiting',
  1904. fn: function (aVisitor){
  1905. var self=this;
  1906. return smalltalk.withContext(function($ctx1) {
  1907. var $1;
  1908. $1=_st(aVisitor)._visitIRNonLocalReturn_(self);
  1909. return $1;
  1910. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRNonLocalReturn)});
  1911. },
  1912. args: ["aVisitor"],
  1913. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  1914. messageSends: ["visitIRNonLocalReturn:"],
  1915. referencedClasses: []
  1916. }),
  1917. globals.IRNonLocalReturn);
  1918. smalltalk.addMethod(
  1919. smalltalk.method({
  1920. selector: "isLocalReturn",
  1921. protocol: 'testing',
  1922. fn: function (){
  1923. var self=this;
  1924. return false;
  1925. },
  1926. args: [],
  1927. source: "isLocalReturn\x0a\x09^ false",
  1928. messageSends: [],
  1929. referencedClasses: []
  1930. }),
  1931. globals.IRNonLocalReturn);
  1932. smalltalk.addClass('IRTempDeclaration', globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  1933. smalltalk.addMethod(
  1934. smalltalk.method({
  1935. selector: "accept:",
  1936. protocol: 'visiting',
  1937. fn: function (aVisitor){
  1938. var self=this;
  1939. return smalltalk.withContext(function($ctx1) {
  1940. var $1;
  1941. $1=_st(aVisitor)._visitIRTempDeclaration_(self);
  1942. return $1;
  1943. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRTempDeclaration)});
  1944. },
  1945. args: ["aVisitor"],
  1946. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  1947. messageSends: ["visitIRTempDeclaration:"],
  1948. referencedClasses: []
  1949. }),
  1950. globals.IRTempDeclaration);
  1951. smalltalk.addMethod(
  1952. smalltalk.method({
  1953. selector: "isTempDeclaration",
  1954. protocol: 'testing',
  1955. fn: function (){
  1956. var self=this;
  1957. return true;
  1958. },
  1959. args: [],
  1960. source: "isTempDeclaration\x0a\x09^ true",
  1961. messageSends: [],
  1962. referencedClasses: []
  1963. }),
  1964. globals.IRTempDeclaration);
  1965. smalltalk.addMethod(
  1966. smalltalk.method({
  1967. selector: "name",
  1968. protocol: 'accessing',
  1969. fn: function (){
  1970. var self=this;
  1971. var $1;
  1972. $1=self["@name"];
  1973. return $1;
  1974. },
  1975. args: [],
  1976. source: "name\x0a\x09^ name",
  1977. messageSends: [],
  1978. referencedClasses: []
  1979. }),
  1980. globals.IRTempDeclaration);
  1981. smalltalk.addMethod(
  1982. smalltalk.method({
  1983. selector: "name:",
  1984. protocol: 'accessing',
  1985. fn: function (aString){
  1986. var self=this;
  1987. self["@name"]=aString;
  1988. return self
  1989. },
  1990. args: ["aString"],
  1991. source: "name: aString\x0a\x09name := aString",
  1992. messageSends: [],
  1993. referencedClasses: []
  1994. }),
  1995. globals.IRTempDeclaration);
  1996. smalltalk.addClass('IRSend', globals.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  1997. globals.IRSend.comment="I am a message send instruction.";
  1998. smalltalk.addMethod(
  1999. smalltalk.method({
  2000. selector: "accept:",
  2001. protocol: 'visiting',
  2002. fn: function (aVisitor){
  2003. var self=this;
  2004. return smalltalk.withContext(function($ctx1) {
  2005. var $1;
  2006. $1=_st(aVisitor)._visitIRSend_(self);
  2007. return $1;
  2008. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRSend)});
  2009. },
  2010. args: ["aVisitor"],
  2011. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  2012. messageSends: ["visitIRSend:"],
  2013. referencedClasses: []
  2014. }),
  2015. globals.IRSend);
  2016. smalltalk.addMethod(
  2017. smalltalk.method({
  2018. selector: "classSend",
  2019. protocol: 'accessing',
  2020. fn: function (){
  2021. var self=this;
  2022. var $1;
  2023. $1=self["@classSend"];
  2024. return $1;
  2025. },
  2026. args: [],
  2027. source: "classSend\x0a\x09^ classSend",
  2028. messageSends: [],
  2029. referencedClasses: []
  2030. }),
  2031. globals.IRSend);
  2032. smalltalk.addMethod(
  2033. smalltalk.method({
  2034. selector: "classSend:",
  2035. protocol: 'accessing',
  2036. fn: function (aClass){
  2037. var self=this;
  2038. self["@classSend"]=aClass;
  2039. return self
  2040. },
  2041. args: ["aClass"],
  2042. source: "classSend: aClass\x0a\x09classSend := aClass",
  2043. messageSends: [],
  2044. referencedClasses: []
  2045. }),
  2046. globals.IRSend);
  2047. smalltalk.addMethod(
  2048. smalltalk.method({
  2049. selector: "index",
  2050. protocol: 'accessing',
  2051. fn: function (){
  2052. var self=this;
  2053. var $1;
  2054. $1=self["@index"];
  2055. return $1;
  2056. },
  2057. args: [],
  2058. source: "index\x0a\x09^ index",
  2059. messageSends: [],
  2060. referencedClasses: []
  2061. }),
  2062. globals.IRSend);
  2063. smalltalk.addMethod(
  2064. smalltalk.method({
  2065. selector: "index:",
  2066. protocol: 'accessing',
  2067. fn: function (anInteger){
  2068. var self=this;
  2069. self["@index"]=anInteger;
  2070. return self
  2071. },
  2072. args: ["anInteger"],
  2073. source: "index: anInteger\x0a\x09index := anInteger",
  2074. messageSends: [],
  2075. referencedClasses: []
  2076. }),
  2077. globals.IRSend);
  2078. smalltalk.addMethod(
  2079. smalltalk.method({
  2080. selector: "isSend",
  2081. protocol: 'testing',
  2082. fn: function (){
  2083. var self=this;
  2084. return true;
  2085. },
  2086. args: [],
  2087. source: "isSend\x0a\x09^ true",
  2088. messageSends: [],
  2089. referencedClasses: []
  2090. }),
  2091. globals.IRSend);
  2092. smalltalk.addMethod(
  2093. smalltalk.method({
  2094. selector: "selector",
  2095. protocol: 'accessing',
  2096. fn: function (){
  2097. var self=this;
  2098. var $1;
  2099. $1=self["@selector"];
  2100. return $1;
  2101. },
  2102. args: [],
  2103. source: "selector\x0a\x09^ selector",
  2104. messageSends: [],
  2105. referencedClasses: []
  2106. }),
  2107. globals.IRSend);
  2108. smalltalk.addMethod(
  2109. smalltalk.method({
  2110. selector: "selector:",
  2111. protocol: 'accessing',
  2112. fn: function (aString){
  2113. var self=this;
  2114. self["@selector"]=aString;
  2115. return self
  2116. },
  2117. args: ["aString"],
  2118. source: "selector: aString\x0a\x09selector := aString",
  2119. messageSends: [],
  2120. referencedClasses: []
  2121. }),
  2122. globals.IRSend);
  2123. smalltalk.addClass('IRSequence', globals.IRInstruction, [], 'Compiler-IR');
  2124. smalltalk.addMethod(
  2125. smalltalk.method({
  2126. selector: "accept:",
  2127. protocol: 'visiting',
  2128. fn: function (aVisitor){
  2129. var self=this;
  2130. return smalltalk.withContext(function($ctx1) {
  2131. var $1;
  2132. $1=_st(aVisitor)._visitIRSequence_(self);
  2133. return $1;
  2134. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRSequence)});
  2135. },
  2136. args: ["aVisitor"],
  2137. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  2138. messageSends: ["visitIRSequence:"],
  2139. referencedClasses: []
  2140. }),
  2141. globals.IRSequence);
  2142. smalltalk.addMethod(
  2143. smalltalk.method({
  2144. selector: "isSequence",
  2145. protocol: 'testing',
  2146. fn: function (){
  2147. var self=this;
  2148. return true;
  2149. },
  2150. args: [],
  2151. source: "isSequence\x0a\x09^ true",
  2152. messageSends: [],
  2153. referencedClasses: []
  2154. }),
  2155. globals.IRSequence);
  2156. smalltalk.addClass('IRBlockSequence', globals.IRSequence, [], 'Compiler-IR');
  2157. smalltalk.addMethod(
  2158. smalltalk.method({
  2159. selector: "accept:",
  2160. protocol: 'visiting',
  2161. fn: function (aVisitor){
  2162. var self=this;
  2163. return smalltalk.withContext(function($ctx1) {
  2164. var $1;
  2165. $1=_st(aVisitor)._visitIRBlockSequence_(self);
  2166. return $1;
  2167. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRBlockSequence)});
  2168. },
  2169. args: ["aVisitor"],
  2170. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  2171. messageSends: ["visitIRBlockSequence:"],
  2172. referencedClasses: []
  2173. }),
  2174. globals.IRBlockSequence);
  2175. smalltalk.addClass('IRValue', globals.IRInstruction, ['value'], 'Compiler-IR');
  2176. globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  2177. smalltalk.addMethod(
  2178. smalltalk.method({
  2179. selector: "accept:",
  2180. protocol: 'visiting',
  2181. fn: function (aVisitor){
  2182. var self=this;
  2183. return smalltalk.withContext(function($ctx1) {
  2184. var $1;
  2185. $1=_st(aVisitor)._visitIRValue_(self);
  2186. return $1;
  2187. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRValue)});
  2188. },
  2189. args: ["aVisitor"],
  2190. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  2191. messageSends: ["visitIRValue:"],
  2192. referencedClasses: []
  2193. }),
  2194. globals.IRValue);
  2195. smalltalk.addMethod(
  2196. smalltalk.method({
  2197. selector: "needsBoxingAsReceiver",
  2198. protocol: 'testing',
  2199. fn: function (){
  2200. var self=this;
  2201. return false;
  2202. },
  2203. args: [],
  2204. source: "needsBoxingAsReceiver\x0a\x09^ false",
  2205. messageSends: [],
  2206. referencedClasses: []
  2207. }),
  2208. globals.IRValue);
  2209. smalltalk.addMethod(
  2210. smalltalk.method({
  2211. selector: "value",
  2212. protocol: 'accessing',
  2213. fn: function (){
  2214. var self=this;
  2215. var $1;
  2216. $1=self["@value"];
  2217. return $1;
  2218. },
  2219. args: [],
  2220. source: "value\x0a\x09^ value",
  2221. messageSends: [],
  2222. referencedClasses: []
  2223. }),
  2224. globals.IRValue);
  2225. smalltalk.addMethod(
  2226. smalltalk.method({
  2227. selector: "value:",
  2228. protocol: 'accessing',
  2229. fn: function (aString){
  2230. var self=this;
  2231. self["@value"]=aString;
  2232. return self
  2233. },
  2234. args: ["aString"],
  2235. source: "value: aString\x0a\x09value := aString",
  2236. messageSends: [],
  2237. referencedClasses: []
  2238. }),
  2239. globals.IRValue);
  2240. smalltalk.addClass('IRVariable', globals.IRInstruction, ['variable'], 'Compiler-IR');
  2241. globals.IRVariable.comment="I am a variable instruction.";
  2242. smalltalk.addMethod(
  2243. smalltalk.method({
  2244. selector: "accept:",
  2245. protocol: 'visiting',
  2246. fn: function (aVisitor){
  2247. var self=this;
  2248. return smalltalk.withContext(function($ctx1) {
  2249. var $1;
  2250. $1=_st(aVisitor)._visitIRVariable_(self);
  2251. return $1;
  2252. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRVariable)});
  2253. },
  2254. args: ["aVisitor"],
  2255. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  2256. messageSends: ["visitIRVariable:"],
  2257. referencedClasses: []
  2258. }),
  2259. globals.IRVariable);
  2260. smalltalk.addMethod(
  2261. smalltalk.method({
  2262. selector: "isVariable",
  2263. protocol: 'testing',
  2264. fn: function (){
  2265. var self=this;
  2266. return true;
  2267. },
  2268. args: [],
  2269. source: "isVariable\x0a\x09^ true",
  2270. messageSends: [],
  2271. referencedClasses: []
  2272. }),
  2273. globals.IRVariable);
  2274. smalltalk.addMethod(
  2275. smalltalk.method({
  2276. selector: "needsBoxingAsReceiver",
  2277. protocol: 'testing',
  2278. fn: function (){
  2279. var self=this;
  2280. return smalltalk.withContext(function($ctx1) {
  2281. var $1;
  2282. $1=_st(_st(self._variable())._isPseudoVar())._not();
  2283. return $1;
  2284. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},globals.IRVariable)});
  2285. },
  2286. args: [],
  2287. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  2288. messageSends: ["not", "isPseudoVar", "variable"],
  2289. referencedClasses: []
  2290. }),
  2291. globals.IRVariable);
  2292. smalltalk.addMethod(
  2293. smalltalk.method({
  2294. selector: "variable",
  2295. protocol: 'accessing',
  2296. fn: function (){
  2297. var self=this;
  2298. var $1;
  2299. $1=self["@variable"];
  2300. return $1;
  2301. },
  2302. args: [],
  2303. source: "variable\x0a\x09^ variable",
  2304. messageSends: [],
  2305. referencedClasses: []
  2306. }),
  2307. globals.IRVariable);
  2308. smalltalk.addMethod(
  2309. smalltalk.method({
  2310. selector: "variable:",
  2311. protocol: 'accessing',
  2312. fn: function (aScopeVariable){
  2313. var self=this;
  2314. self["@variable"]=aScopeVariable;
  2315. return self
  2316. },
  2317. args: ["aScopeVariable"],
  2318. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  2319. messageSends: [],
  2320. referencedClasses: []
  2321. }),
  2322. globals.IRVariable);
  2323. smalltalk.addClass('IRVerbatim', globals.IRInstruction, ['source'], 'Compiler-IR');
  2324. smalltalk.addMethod(
  2325. smalltalk.method({
  2326. selector: "accept:",
  2327. protocol: 'visiting',
  2328. fn: function (aVisitor){
  2329. var self=this;
  2330. return smalltalk.withContext(function($ctx1) {
  2331. var $1;
  2332. $1=_st(aVisitor)._visitIRVerbatim_(self);
  2333. return $1;
  2334. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRVerbatim)});
  2335. },
  2336. args: ["aVisitor"],
  2337. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  2338. messageSends: ["visitIRVerbatim:"],
  2339. referencedClasses: []
  2340. }),
  2341. globals.IRVerbatim);
  2342. smalltalk.addMethod(
  2343. smalltalk.method({
  2344. selector: "source",
  2345. protocol: 'accessing',
  2346. fn: function (){
  2347. var self=this;
  2348. var $1;
  2349. $1=self["@source"];
  2350. return $1;
  2351. },
  2352. args: [],
  2353. source: "source\x0a\x09^ source",
  2354. messageSends: [],
  2355. referencedClasses: []
  2356. }),
  2357. globals.IRVerbatim);
  2358. smalltalk.addMethod(
  2359. smalltalk.method({
  2360. selector: "source:",
  2361. protocol: 'accessing',
  2362. fn: function (aString){
  2363. var self=this;
  2364. self["@source"]=aString;
  2365. return self
  2366. },
  2367. args: ["aString"],
  2368. source: "source: aString\x0a\x09source := aString",
  2369. messageSends: [],
  2370. referencedClasses: []
  2371. }),
  2372. globals.IRVerbatim);
  2373. smalltalk.addClass('IRVisitor', globals.Object, [], 'Compiler-IR');
  2374. smalltalk.addMethod(
  2375. smalltalk.method({
  2376. selector: "visit:",
  2377. protocol: 'visiting',
  2378. fn: function (anIRInstruction){
  2379. var self=this;
  2380. return smalltalk.withContext(function($ctx1) {
  2381. var $1;
  2382. $1=_st(anIRInstruction)._accept_(self);
  2383. return $1;
  2384. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},globals.IRVisitor)});
  2385. },
  2386. args: ["anIRInstruction"],
  2387. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  2388. messageSends: ["accept:"],
  2389. referencedClasses: []
  2390. }),
  2391. globals.IRVisitor);
  2392. smalltalk.addMethod(
  2393. smalltalk.method({
  2394. selector: "visitIRAssignment:",
  2395. protocol: 'visiting',
  2396. fn: function (anIRAssignment){
  2397. var self=this;
  2398. return smalltalk.withContext(function($ctx1) {
  2399. var $1;
  2400. $1=self._visitIRInstruction_(anIRAssignment);
  2401. return $1;
  2402. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRVisitor)});
  2403. },
  2404. args: ["anIRAssignment"],
  2405. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  2406. messageSends: ["visitIRInstruction:"],
  2407. referencedClasses: []
  2408. }),
  2409. globals.IRVisitor);
  2410. smalltalk.addMethod(
  2411. smalltalk.method({
  2412. selector: "visitIRBlockReturn:",
  2413. protocol: 'visiting',
  2414. fn: function (anIRBlockReturn){
  2415. var self=this;
  2416. return smalltalk.withContext(function($ctx1) {
  2417. var $1;
  2418. $1=self._visitIRReturn_(anIRBlockReturn);
  2419. return $1;
  2420. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},globals.IRVisitor)});
  2421. },
  2422. args: ["anIRBlockReturn"],
  2423. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  2424. messageSends: ["visitIRReturn:"],
  2425. referencedClasses: []
  2426. }),
  2427. globals.IRVisitor);
  2428. smalltalk.addMethod(
  2429. smalltalk.method({
  2430. selector: "visitIRBlockSequence:",
  2431. protocol: 'visiting',
  2432. fn: function (anIRBlockSequence){
  2433. var self=this;
  2434. return smalltalk.withContext(function($ctx1) {
  2435. var $1;
  2436. $1=self._visitIRSequence_(anIRBlockSequence);
  2437. return $1;
  2438. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},globals.IRVisitor)});
  2439. },
  2440. args: ["anIRBlockSequence"],
  2441. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  2442. messageSends: ["visitIRSequence:"],
  2443. referencedClasses: []
  2444. }),
  2445. globals.IRVisitor);
  2446. smalltalk.addMethod(
  2447. smalltalk.method({
  2448. selector: "visitIRClosure:",
  2449. protocol: 'visiting',
  2450. fn: function (anIRClosure){
  2451. var self=this;
  2452. return smalltalk.withContext(function($ctx1) {
  2453. var $1;
  2454. $1=self._visitIRInstruction_(anIRClosure);
  2455. return $1;
  2456. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},globals.IRVisitor)});
  2457. },
  2458. args: ["anIRClosure"],
  2459. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  2460. messageSends: ["visitIRInstruction:"],
  2461. referencedClasses: []
  2462. }),
  2463. globals.IRVisitor);
  2464. smalltalk.addMethod(
  2465. smalltalk.method({
  2466. selector: "visitIRDynamicArray:",
  2467. protocol: 'visiting',
  2468. fn: function (anIRDynamicArray){
  2469. var self=this;
  2470. return smalltalk.withContext(function($ctx1) {
  2471. var $1;
  2472. $1=self._visitIRInstruction_(anIRDynamicArray);
  2473. return $1;
  2474. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},globals.IRVisitor)});
  2475. },
  2476. args: ["anIRDynamicArray"],
  2477. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  2478. messageSends: ["visitIRInstruction:"],
  2479. referencedClasses: []
  2480. }),
  2481. globals.IRVisitor);
  2482. smalltalk.addMethod(
  2483. smalltalk.method({
  2484. selector: "visitIRDynamicDictionary:",
  2485. protocol: 'visiting',
  2486. fn: function (anIRDynamicDictionary){
  2487. var self=this;
  2488. return smalltalk.withContext(function($ctx1) {
  2489. var $1;
  2490. $1=self._visitIRInstruction_(anIRDynamicDictionary);
  2491. return $1;
  2492. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},globals.IRVisitor)});
  2493. },
  2494. args: ["anIRDynamicDictionary"],
  2495. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  2496. messageSends: ["visitIRInstruction:"],
  2497. referencedClasses: []
  2498. }),
  2499. globals.IRVisitor);
  2500. smalltalk.addMethod(
  2501. smalltalk.method({
  2502. selector: "visitIRInlinedClosure:",
  2503. protocol: 'visiting',
  2504. fn: function (anIRInlinedClosure){
  2505. var self=this;
  2506. return smalltalk.withContext(function($ctx1) {
  2507. var $1;
  2508. $1=self._visitIRClosure_(anIRInlinedClosure);
  2509. return $1;
  2510. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},globals.IRVisitor)});
  2511. },
  2512. args: ["anIRInlinedClosure"],
  2513. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  2514. messageSends: ["visitIRClosure:"],
  2515. referencedClasses: []
  2516. }),
  2517. globals.IRVisitor);
  2518. smalltalk.addMethod(
  2519. smalltalk.method({
  2520. selector: "visitIRInlinedSequence:",
  2521. protocol: 'visiting',
  2522. fn: function (anIRInlinedSequence){
  2523. var self=this;
  2524. return smalltalk.withContext(function($ctx1) {
  2525. var $1;
  2526. $1=self._visitIRSequence_(anIRInlinedSequence);
  2527. return $1;
  2528. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},globals.IRVisitor)});
  2529. },
  2530. args: ["anIRInlinedSequence"],
  2531. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  2532. messageSends: ["visitIRSequence:"],
  2533. referencedClasses: []
  2534. }),
  2535. globals.IRVisitor);
  2536. smalltalk.addMethod(
  2537. smalltalk.method({
  2538. selector: "visitIRInstruction:",
  2539. protocol: 'visiting',
  2540. fn: function (anIRInstruction){
  2541. var self=this;
  2542. return smalltalk.withContext(function($ctx1) {
  2543. _st(_st(anIRInstruction)._instructions())._do_((function(each){
  2544. return smalltalk.withContext(function($ctx2) {
  2545. return self._visit_(each);
  2546. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2547. }));
  2548. return anIRInstruction;
  2549. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},globals.IRVisitor)});
  2550. },
  2551. args: ["anIRInstruction"],
  2552. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  2553. messageSends: ["do:", "instructions", "visit:"],
  2554. referencedClasses: []
  2555. }),
  2556. globals.IRVisitor);
  2557. smalltalk.addMethod(
  2558. smalltalk.method({
  2559. selector: "visitIRMethod:",
  2560. protocol: 'visiting',
  2561. fn: function (anIRMethod){
  2562. var self=this;
  2563. return smalltalk.withContext(function($ctx1) {
  2564. var $1;
  2565. $1=self._visitIRInstruction_(anIRMethod);
  2566. return $1;
  2567. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},globals.IRVisitor)});
  2568. },
  2569. args: ["anIRMethod"],
  2570. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  2571. messageSends: ["visitIRInstruction:"],
  2572. referencedClasses: []
  2573. }),
  2574. globals.IRVisitor);
  2575. smalltalk.addMethod(
  2576. smalltalk.method({
  2577. selector: "visitIRNonLocalReturn:",
  2578. protocol: 'visiting',
  2579. fn: function (anIRNonLocalReturn){
  2580. var self=this;
  2581. return smalltalk.withContext(function($ctx1) {
  2582. var $1;
  2583. $1=self._visitIRInstruction_(anIRNonLocalReturn);
  2584. return $1;
  2585. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRVisitor)});
  2586. },
  2587. args: ["anIRNonLocalReturn"],
  2588. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  2589. messageSends: ["visitIRInstruction:"],
  2590. referencedClasses: []
  2591. }),
  2592. globals.IRVisitor);
  2593. smalltalk.addMethod(
  2594. smalltalk.method({
  2595. selector: "visitIRNonLocalReturnHandling:",
  2596. protocol: 'visiting',
  2597. fn: function (anIRNonLocalReturnHandling){
  2598. var self=this;
  2599. return smalltalk.withContext(function($ctx1) {
  2600. var $1;
  2601. $1=self._visitIRInstruction_(anIRNonLocalReturnHandling);
  2602. return $1;
  2603. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},globals.IRVisitor)});
  2604. },
  2605. args: ["anIRNonLocalReturnHandling"],
  2606. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  2607. messageSends: ["visitIRInstruction:"],
  2608. referencedClasses: []
  2609. }),
  2610. globals.IRVisitor);
  2611. smalltalk.addMethod(
  2612. smalltalk.method({
  2613. selector: "visitIRReturn:",
  2614. protocol: 'visiting',
  2615. fn: function (anIRReturn){
  2616. var self=this;
  2617. return smalltalk.withContext(function($ctx1) {
  2618. var $1;
  2619. $1=self._visitIRInstruction_(anIRReturn);
  2620. return $1;
  2621. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRVisitor)});
  2622. },
  2623. args: ["anIRReturn"],
  2624. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  2625. messageSends: ["visitIRInstruction:"],
  2626. referencedClasses: []
  2627. }),
  2628. globals.IRVisitor);
  2629. smalltalk.addMethod(
  2630. smalltalk.method({
  2631. selector: "visitIRSend:",
  2632. protocol: 'visiting',
  2633. fn: function (anIRSend){
  2634. var self=this;
  2635. return smalltalk.withContext(function($ctx1) {
  2636. var $1;
  2637. $1=self._visitIRInstruction_(anIRSend);
  2638. return $1;
  2639. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},globals.IRVisitor)});
  2640. },
  2641. args: ["anIRSend"],
  2642. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  2643. messageSends: ["visitIRInstruction:"],
  2644. referencedClasses: []
  2645. }),
  2646. globals.IRVisitor);
  2647. smalltalk.addMethod(
  2648. smalltalk.method({
  2649. selector: "visitIRSequence:",
  2650. protocol: 'visiting',
  2651. fn: function (anIRSequence){
  2652. var self=this;
  2653. return smalltalk.withContext(function($ctx1) {
  2654. var $1;
  2655. $1=self._visitIRInstruction_(anIRSequence);
  2656. return $1;
  2657. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},globals.IRVisitor)});
  2658. },
  2659. args: ["anIRSequence"],
  2660. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  2661. messageSends: ["visitIRInstruction:"],
  2662. referencedClasses: []
  2663. }),
  2664. globals.IRVisitor);
  2665. smalltalk.addMethod(
  2666. smalltalk.method({
  2667. selector: "visitIRTempDeclaration:",
  2668. protocol: 'visiting',
  2669. fn: function (anIRTempDeclaration){
  2670. var self=this;
  2671. return smalltalk.withContext(function($ctx1) {
  2672. var $1;
  2673. $1=self._visitIRInstruction_(anIRTempDeclaration);
  2674. return $1;
  2675. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},globals.IRVisitor)});
  2676. },
  2677. args: ["anIRTempDeclaration"],
  2678. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  2679. messageSends: ["visitIRInstruction:"],
  2680. referencedClasses: []
  2681. }),
  2682. globals.IRVisitor);
  2683. smalltalk.addMethod(
  2684. smalltalk.method({
  2685. selector: "visitIRValue:",
  2686. protocol: 'visiting',
  2687. fn: function (anIRValue){
  2688. var self=this;
  2689. return smalltalk.withContext(function($ctx1) {
  2690. var $1;
  2691. $1=self._visitIRInstruction_(anIRValue);
  2692. return $1;
  2693. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},globals.IRVisitor)});
  2694. },
  2695. args: ["anIRValue"],
  2696. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  2697. messageSends: ["visitIRInstruction:"],
  2698. referencedClasses: []
  2699. }),
  2700. globals.IRVisitor);
  2701. smalltalk.addMethod(
  2702. smalltalk.method({
  2703. selector: "visitIRVariable:",
  2704. protocol: 'visiting',
  2705. fn: function (anIRVariable){
  2706. var self=this;
  2707. return smalltalk.withContext(function($ctx1) {
  2708. var $1;
  2709. $1=self._visitIRInstruction_(anIRVariable);
  2710. return $1;
  2711. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},globals.IRVisitor)});
  2712. },
  2713. args: ["anIRVariable"],
  2714. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  2715. messageSends: ["visitIRInstruction:"],
  2716. referencedClasses: []
  2717. }),
  2718. globals.IRVisitor);
  2719. smalltalk.addMethod(
  2720. smalltalk.method({
  2721. selector: "visitIRVerbatim:",
  2722. protocol: 'visiting',
  2723. fn: function (anIRVerbatim){
  2724. var self=this;
  2725. return smalltalk.withContext(function($ctx1) {
  2726. var $1;
  2727. $1=self._visitIRInstruction_(anIRVerbatim);
  2728. return $1;
  2729. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},globals.IRVisitor)});
  2730. },
  2731. args: ["anIRVerbatim"],
  2732. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  2733. messageSends: ["visitIRInstruction:"],
  2734. referencedClasses: []
  2735. }),
  2736. globals.IRVisitor);
  2737. smalltalk.addClass('IRJSTranslator', globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  2738. smalltalk.addMethod(
  2739. smalltalk.method({
  2740. selector: "contents",
  2741. protocol: 'accessing',
  2742. fn: function (){
  2743. var self=this;
  2744. return smalltalk.withContext(function($ctx1) {
  2745. var $1;
  2746. $1=_st(self._stream())._contents();
  2747. return $1;
  2748. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.IRJSTranslator)});
  2749. },
  2750. args: [],
  2751. source: "contents\x0a\x09^ self stream contents",
  2752. messageSends: ["contents", "stream"],
  2753. referencedClasses: []
  2754. }),
  2755. globals.IRJSTranslator);
  2756. smalltalk.addMethod(
  2757. smalltalk.method({
  2758. selector: "currentClass",
  2759. protocol: 'accessing',
  2760. fn: function (){
  2761. var self=this;
  2762. var $1;
  2763. $1=self["@currentClass"];
  2764. return $1;
  2765. },
  2766. args: [],
  2767. source: "currentClass\x0a\x09^ currentClass",
  2768. messageSends: [],
  2769. referencedClasses: []
  2770. }),
  2771. globals.IRJSTranslator);
  2772. smalltalk.addMethod(
  2773. smalltalk.method({
  2774. selector: "currentClass:",
  2775. protocol: 'accessing',
  2776. fn: function (aClass){
  2777. var self=this;
  2778. self["@currentClass"]=aClass;
  2779. return self
  2780. },
  2781. args: ["aClass"],
  2782. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  2783. messageSends: [],
  2784. referencedClasses: []
  2785. }),
  2786. globals.IRJSTranslator);
  2787. smalltalk.addMethod(
  2788. smalltalk.method({
  2789. selector: "initialize",
  2790. protocol: 'initialization',
  2791. fn: function (){
  2792. var self=this;
  2793. function $JSStream(){return globals.JSStream||(typeof JSStream=="undefined"?nil:JSStream)}
  2794. return smalltalk.withContext(function($ctx1) {
  2795. ($ctx1.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._initialize.apply(_st(self), []));
  2796. $ctx1.supercall = false;
  2797. self["@stream"]=_st($JSStream())._new();
  2798. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.IRJSTranslator)});
  2799. },
  2800. args: [],
  2801. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  2802. messageSends: ["initialize", "new"],
  2803. referencedClasses: ["JSStream"]
  2804. }),
  2805. globals.IRJSTranslator);
  2806. smalltalk.addMethod(
  2807. smalltalk.method({
  2808. selector: "stream",
  2809. protocol: 'accessing',
  2810. fn: function (){
  2811. var self=this;
  2812. var $1;
  2813. $1=self["@stream"];
  2814. return $1;
  2815. },
  2816. args: [],
  2817. source: "stream\x0a\x09^ stream",
  2818. messageSends: [],
  2819. referencedClasses: []
  2820. }),
  2821. globals.IRJSTranslator);
  2822. smalltalk.addMethod(
  2823. smalltalk.method({
  2824. selector: "stream:",
  2825. protocol: 'accessing',
  2826. fn: function (aStream){
  2827. var self=this;
  2828. self["@stream"]=aStream;
  2829. return self
  2830. },
  2831. args: ["aStream"],
  2832. source: "stream: aStream\x0a\x09stream := aStream",
  2833. messageSends: [],
  2834. referencedClasses: []
  2835. }),
  2836. globals.IRJSTranslator);
  2837. smalltalk.addMethod(
  2838. smalltalk.method({
  2839. selector: "visitIRAssignment:",
  2840. protocol: 'visiting',
  2841. fn: function (anIRAssignment){
  2842. var self=this;
  2843. return smalltalk.withContext(function($ctx1) {
  2844. var $2,$1;
  2845. $2=_st(anIRAssignment)._instructions();
  2846. $ctx1.sendIdx["instructions"]=1;
  2847. $1=_st($2)._first();
  2848. self._visit_($1);
  2849. $ctx1.sendIdx["visit:"]=1;
  2850. _st(self._stream())._nextPutAssignment();
  2851. self._visit_(_st(_st(anIRAssignment)._instructions())._last());
  2852. return self}, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRJSTranslator)});
  2853. },
  2854. args: ["anIRAssignment"],
  2855. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  2856. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"],
  2857. referencedClasses: []
  2858. }),
  2859. globals.IRJSTranslator);
  2860. smalltalk.addMethod(
  2861. smalltalk.method({
  2862. selector: "visitIRClosure:",
  2863. protocol: 'visiting',
  2864. fn: function (anIRClosure){
  2865. var self=this;
  2866. return smalltalk.withContext(function($ctx1) {
  2867. var $1,$2;
  2868. $1=self._stream();
  2869. $ctx1.sendIdx["stream"]=1;
  2870. _st($1)._nextPutClosureWith_arguments_((function(){
  2871. return smalltalk.withContext(function($ctx2) {
  2872. $2=self._stream();
  2873. $ctx2.sendIdx["stream"]=2;
  2874. _st($2)._nextPutVars_(_st(_st(anIRClosure)._tempDeclarations())._collect_((function(each){
  2875. return smalltalk.withContext(function($ctx3) {
  2876. return _st(_st(each)._name())._asVariableName();
  2877. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  2878. })));
  2879. return _st(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  2880. return smalltalk.withContext(function($ctx3) {
  2881. return ($ctx3.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRClosure_.apply(_st(self), [anIRClosure]));
  2882. $ctx3.supercall = false;
  2883. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  2884. }));
  2885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2886. }),_st(anIRClosure)._arguments());
  2887. return self}, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},globals.IRJSTranslator)});
  2888. },
  2889. args: ["anIRClosure"],
  2890. source: "visitIRClosure: anIRClosure\x0a\x09self stream\x0a\x09\x09nextPutClosureWith: [\x0a\x09\x09\x09self stream nextPutVars: (anIRClosure tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09self stream\x0a\x09\x09\x09\x09nextPutBlockContextFor: anIRClosure\x0a\x09\x09\x09\x09during: [ super visitIRClosure: anIRClosure ] ]\x0a\x09\x09arguments: anIRClosure arguments",
  2891. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"],
  2892. referencedClasses: []
  2893. }),
  2894. globals.IRJSTranslator);
  2895. smalltalk.addMethod(
  2896. smalltalk.method({
  2897. selector: "visitIRDynamicArray:",
  2898. protocol: 'visiting',
  2899. fn: function (anIRDynamicArray){
  2900. var self=this;
  2901. return smalltalk.withContext(function($ctx1) {
  2902. var $1;
  2903. $1=self._stream();
  2904. $ctx1.sendIdx["stream"]=1;
  2905. _st($1)._nextPutAll_("[");
  2906. $ctx1.sendIdx["nextPutAll:"]=1;
  2907. _st(_st(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){
  2908. return smalltalk.withContext(function($ctx2) {
  2909. return self._visit_(each);
  2910. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2911. }),(function(){
  2912. return smalltalk.withContext(function($ctx2) {
  2913. return _st(self._stream())._nextPutAll_(",");
  2914. $ctx2.sendIdx["nextPutAll:"]=2;
  2915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2916. }));
  2917. _st(self["@stream"])._nextPutAll_("]");
  2918. return self}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},globals.IRJSTranslator)});
  2919. },
  2920. args: ["anIRDynamicArray"],
  2921. 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: ']'",
  2922. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"],
  2923. referencedClasses: []
  2924. }),
  2925. globals.IRJSTranslator);
  2926. smalltalk.addMethod(
  2927. smalltalk.method({
  2928. selector: "visitIRDynamicDictionary:",
  2929. protocol: 'visiting',
  2930. fn: function (anIRDynamicDictionary){
  2931. var self=this;
  2932. return smalltalk.withContext(function($ctx1) {
  2933. var $1,$2;
  2934. $1=self._stream();
  2935. $ctx1.sendIdx["stream"]=1;
  2936. _st($1)._nextPutAll_("globals.HashedCollection._newFromPairs_([");
  2937. $ctx1.sendIdx["nextPutAll:"]=1;
  2938. _st(_st(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){
  2939. return smalltalk.withContext(function($ctx2) {
  2940. return self._visit_(each);
  2941. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2942. }),(function(){
  2943. return smalltalk.withContext(function($ctx2) {
  2944. $2=self._stream();
  2945. $ctx2.sendIdx["stream"]=2;
  2946. return _st($2)._nextPutAll_(",");
  2947. $ctx2.sendIdx["nextPutAll:"]=2;
  2948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2949. }));
  2950. _st(self._stream())._nextPutAll_("])");
  2951. return self}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},globals.IRJSTranslator)});
  2952. },
  2953. args: ["anIRDynamicDictionary"],
  2954. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self stream nextPutAll: 'globals.HashedCollection._newFromPairs_(['.\x0a\x09\x09anIRDynamicDictionary instructions\x0a\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
  2955. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"],
  2956. referencedClasses: []
  2957. }),
  2958. globals.IRJSTranslator);
  2959. smalltalk.addMethod(
  2960. smalltalk.method({
  2961. selector: "visitIRMethod:",
  2962. protocol: 'visiting',
  2963. fn: function (anIRMethod){
  2964. var self=this;
  2965. return smalltalk.withContext(function($ctx1) {
  2966. var $1,$2,$3,$4,$5,$6,$8,$7,$9,$10;
  2967. $1=self._stream();
  2968. $ctx1.sendIdx["stream"]=1;
  2969. _st($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  2970. return smalltalk.withContext(function($ctx2) {
  2971. $2=self._stream();
  2972. $ctx2.sendIdx["stream"]=2;
  2973. return _st($2)._nextPutFunctionWith_arguments_((function(){
  2974. return smalltalk.withContext(function($ctx3) {
  2975. $3=self._stream();
  2976. $ctx3.sendIdx["stream"]=3;
  2977. $4=_st(_st(anIRMethod)._tempDeclarations())._collect_((function(each){
  2978. return smalltalk.withContext(function($ctx4) {
  2979. return _st(_st(each)._name())._asVariableName();
  2980. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  2981. }));
  2982. $ctx3.sendIdx["collect:"]=1;
  2983. _st($3)._nextPutVars_($4);
  2984. $ctx3.sendIdx["nextPutVars:"]=1;
  2985. _st(_st(anIRMethod)._classReferences())._do_((function(each){
  2986. return smalltalk.withContext(function($ctx4) {
  2987. $5=self._stream();
  2988. $ctx4.sendIdx["stream"]=4;
  2989. return _st($5)._nextPutClassRefFunction_(each);
  2990. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)});
  2991. }));
  2992. $6=self._stream();
  2993. $ctx3.sendIdx["stream"]=5;
  2994. return _st($6)._nextPutContextFor_during_(anIRMethod,(function(){
  2995. return smalltalk.withContext(function($ctx4) {
  2996. $8=_st(anIRMethod)._internalVariables();
  2997. $ctx4.sendIdx["internalVariables"]=1;
  2998. $7=_st($8)._notEmpty();
  2999. if(smalltalk.assert($7)){
  3000. $9=self._stream();
  3001. $ctx4.sendIdx["stream"]=6;
  3002. _st($9)._nextPutVars_(_st(_st(_st(anIRMethod)._internalVariables())._asSet())._collect_((function(each){
  3003. return smalltalk.withContext(function($ctx5) {
  3004. return _st(_st(each)._variable())._alias();
  3005. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,7)});
  3006. })));
  3007. };
  3008. $10=_st(_st(anIRMethod)._scope())._hasNonLocalReturn();
  3009. if(smalltalk.assert($10)){
  3010. return _st(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  3011. return smalltalk.withContext(function($ctx5) {
  3012. return ($ctx5.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]));
  3013. $ctx5.supercall = false;
  3014. $ctx5.sendIdx["visitIRMethod:"]=1;
  3015. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)});
  3016. }));
  3017. } else {
  3018. return ($ctx4.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]));
  3019. $ctx4.supercall = false;
  3020. };
  3021. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  3022. }));
  3023. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  3024. }),_st(anIRMethod)._arguments());
  3025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3026. }));
  3027. return self}, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},globals.IRJSTranslator)});
  3028. },
  3029. args: ["anIRMethod"],
  3030. source: "visitIRMethod: anIRMethod\x0a\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod\x0a\x09\x09with: [ self stream\x0a\x09\x09\x09nextPutFunctionWith: [\x0a\x09\x09\x09\x09self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09\x09anIRMethod classReferences do: [ :each | self stream nextPutClassRefFunction: each ].\x0a\x09\x09\x09\x09self stream nextPutContextFor: anIRMethod during: [\x0a\x09\x09\x09\x09anIRMethod internalVariables notEmpty ifTrue: [\x0a\x09\x09\x09\x09\x09self stream nextPutVars: (anIRMethod internalVariables asSet 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 ]",
  3031. messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "classReferences", "nextPutClassRefFunction:", "nextPutContextFor:during:", "ifTrue:", "notEmpty", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"],
  3032. referencedClasses: []
  3033. }),
  3034. globals.IRJSTranslator);
  3035. smalltalk.addMethod(
  3036. smalltalk.method({
  3037. selector: "visitIRNonLocalReturn:",
  3038. protocol: 'visiting',
  3039. fn: function (anIRNonLocalReturn){
  3040. var self=this;
  3041. return smalltalk.withContext(function($ctx1) {
  3042. _st(self._stream())._nextPutNonLocalReturnWith_((function(){
  3043. return smalltalk.withContext(function($ctx2) {
  3044. return ($ctx2.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]));
  3045. $ctx2.supercall = false;
  3046. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3047. }));
  3048. return self}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRJSTranslator)});
  3049. },
  3050. args: ["anIRNonLocalReturn"],
  3051. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  3052. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"],
  3053. referencedClasses: []
  3054. }),
  3055. globals.IRJSTranslator);
  3056. smalltalk.addMethod(
  3057. smalltalk.method({
  3058. selector: "visitIRReturn:",
  3059. protocol: 'visiting',
  3060. fn: function (anIRReturn){
  3061. var self=this;
  3062. return smalltalk.withContext(function($ctx1) {
  3063. _st(self._stream())._nextPutReturnWith_((function(){
  3064. return smalltalk.withContext(function($ctx2) {
  3065. return ($ctx2.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]));
  3066. $ctx2.supercall = false;
  3067. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3068. }));
  3069. return self}, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRJSTranslator)});
  3070. },
  3071. args: ["anIRReturn"],
  3072. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  3073. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"],
  3074. referencedClasses: []
  3075. }),
  3076. globals.IRJSTranslator);
  3077. smalltalk.addMethod(
  3078. smalltalk.method({
  3079. selector: "visitIRSend:",
  3080. protocol: 'visiting',
  3081. fn: function (anIRSend){
  3082. var self=this;
  3083. var sends;
  3084. return smalltalk.withContext(function($ctx1) {
  3085. var $1,$2,$receiver;
  3086. sends=_st(_st(_st(_st(anIRSend)._method())._sendIndexes())._at_(_st(anIRSend)._selector()))._size();
  3087. $1=_st(anIRSend)._classSend();
  3088. if(($receiver = $1) == null || $receiver.isNil){
  3089. self._visitSend_(anIRSend);
  3090. } else {
  3091. self._visitSuperSend_(anIRSend);
  3092. };
  3093. $2=_st(_st(sends).__gt((1)))._and_((function(){
  3094. return smalltalk.withContext(function($ctx2) {
  3095. return _st(_st(anIRSend)._index()).__lt(sends);
  3096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  3097. }));
  3098. if(smalltalk.assert($2)){
  3099. _st(self._stream())._nextPutSendIndexFor_(anIRSend);
  3100. };
  3101. return self}, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends},globals.IRJSTranslator)});
  3102. },
  3103. args: ["anIRSend"],
  3104. source: "visitIRSend: anIRSend\x0a\x09| sends |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend classSend\x0a\x09\x09ifNil: [ self visitSend: anIRSend ]\x0a\x09\x09ifNotNil: [ self visitSuperSend: anIRSend ].\x0a\x09\x09\x0a\x09(sends > 1 and: [ anIRSend index < sends ])\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
  3105. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifNil:ifNotNil:", "classSend", "visitSend:", "visitSuperSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"],
  3106. referencedClasses: []
  3107. }),
  3108. globals.IRJSTranslator);
  3109. smalltalk.addMethod(
  3110. smalltalk.method({
  3111. selector: "visitIRSequence:",
  3112. protocol: 'visiting',
  3113. fn: function (anIRSequence){
  3114. var self=this;
  3115. return smalltalk.withContext(function($ctx1) {
  3116. var $1;
  3117. $1=self._stream();
  3118. $ctx1.sendIdx["stream"]=1;
  3119. _st($1)._nextPutSequenceWith_((function(){
  3120. return smalltalk.withContext(function($ctx2) {
  3121. return _st(_st(anIRSequence)._instructions())._do_((function(each){
  3122. return smalltalk.withContext(function($ctx3) {
  3123. return _st(self._stream())._nextPutStatementWith_(self._visit_(each));
  3124. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  3125. }));
  3126. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3127. }));
  3128. return self}, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},globals.IRJSTranslator)});
  3129. },
  3130. args: ["anIRSequence"],
  3131. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
  3132. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"],
  3133. referencedClasses: []
  3134. }),
  3135. globals.IRJSTranslator);
  3136. smalltalk.addMethod(
  3137. smalltalk.method({
  3138. selector: "visitIRTempDeclaration:",
  3139. protocol: 'visiting',
  3140. fn: function (anIRTempDeclaration){
  3141. var self=this;
  3142. return self
  3143. },
  3144. args: ["anIRTempDeclaration"],
  3145. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  3146. messageSends: [],
  3147. referencedClasses: []
  3148. }),
  3149. globals.IRJSTranslator);
  3150. smalltalk.addMethod(
  3151. smalltalk.method({
  3152. selector: "visitIRValue:",
  3153. protocol: 'visiting',
  3154. fn: function (anIRValue){
  3155. var self=this;
  3156. return smalltalk.withContext(function($ctx1) {
  3157. _st(self._stream())._nextPutAll_(_st(_st(anIRValue)._value())._asJavascript());
  3158. return self}, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},globals.IRJSTranslator)});
  3159. },
  3160. args: ["anIRValue"],
  3161. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  3162. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"],
  3163. referencedClasses: []
  3164. }),
  3165. globals.IRJSTranslator);
  3166. smalltalk.addMethod(
  3167. smalltalk.method({
  3168. selector: "visitIRVariable:",
  3169. protocol: 'visiting',
  3170. fn: function (anIRVariable){
  3171. var self=this;
  3172. return smalltalk.withContext(function($ctx1) {
  3173. var $3,$2,$1,$4;
  3174. $3=_st(anIRVariable)._variable();
  3175. $ctx1.sendIdx["variable"]=1;
  3176. $2=_st($3)._name();
  3177. $1=_st($2).__eq("thisContext");
  3178. if(smalltalk.assert($1)){
  3179. $4=self._stream();
  3180. $ctx1.sendIdx["stream"]=1;
  3181. _st($4)._nextPutAll_("smalltalk.getThisContext()");
  3182. $ctx1.sendIdx["nextPutAll:"]=1;
  3183. } else {
  3184. _st(self._stream())._nextPutAll_(_st(_st(anIRVariable)._variable())._alias());
  3185. };
  3186. return self}, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},globals.IRJSTranslator)});
  3187. },
  3188. args: ["anIRVariable"],
  3189. source: "visitIRVariable: anIRVariable\x0a\x09anIRVariable variable name = 'thisContext'\x0a\x09\x09ifTrue: [ self stream nextPutAll: 'smalltalk.getThisContext()' ]\x0a\x09\x09ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]",
  3190. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"],
  3191. referencedClasses: []
  3192. }),
  3193. globals.IRJSTranslator);
  3194. smalltalk.addMethod(
  3195. smalltalk.method({
  3196. selector: "visitIRVerbatim:",
  3197. protocol: 'visiting',
  3198. fn: function (anIRVerbatim){
  3199. var self=this;
  3200. return smalltalk.withContext(function($ctx1) {
  3201. var $1;
  3202. $1=self._stream();
  3203. $ctx1.sendIdx["stream"]=1;
  3204. _st($1)._nextPutStatementWith_((function(){
  3205. return smalltalk.withContext(function($ctx2) {
  3206. return _st(self._stream())._nextPutAll_(_st(anIRVerbatim)._source());
  3207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3208. }));
  3209. return self}, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},globals.IRJSTranslator)});
  3210. },
  3211. args: ["anIRVerbatim"],
  3212. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  3213. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"],
  3214. referencedClasses: []
  3215. }),
  3216. globals.IRJSTranslator);
  3217. smalltalk.addMethod(
  3218. smalltalk.method({
  3219. selector: "visitReceiver:",
  3220. protocol: 'visiting',
  3221. fn: function (anIRInstruction){
  3222. var self=this;
  3223. return smalltalk.withContext(function($ctx1) {
  3224. var $1,$2,$3;
  3225. $1=_st(anIRInstruction)._needsBoxingAsReceiver();
  3226. if(! smalltalk.assert($1)){
  3227. $2=self._visit_(anIRInstruction);
  3228. $ctx1.sendIdx["visit:"]=1;
  3229. return $2;
  3230. };
  3231. $3=self._stream();
  3232. $ctx1.sendIdx["stream"]=1;
  3233. _st($3)._nextPutAll_("_st(");
  3234. $ctx1.sendIdx["nextPutAll:"]=1;
  3235. self._visit_(anIRInstruction);
  3236. _st(self._stream())._nextPutAll_(")");
  3237. return self}, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},globals.IRJSTranslator)});
  3238. },
  3239. args: ["anIRInstruction"],
  3240. source: "visitReceiver: anIRInstruction\x0a\x09anIRInstruction needsBoxingAsReceiver ifFalse: [ ^ self visit: anIRInstruction ].\x0a\x09\x0a\x09self stream nextPutAll: '_st('.\x0a\x09self visit: anIRInstruction.\x0a\x09self stream nextPutAll: ')'",
  3241. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"],
  3242. referencedClasses: []
  3243. }),
  3244. globals.IRJSTranslator);
  3245. smalltalk.addMethod(
  3246. smalltalk.method({
  3247. selector: "visitSend:",
  3248. protocol: 'visiting',
  3249. fn: function (anIRSend){
  3250. var self=this;
  3251. return smalltalk.withContext(function($ctx1) {
  3252. var $2,$1,$3,$4,$5;
  3253. $2=_st(anIRSend)._instructions();
  3254. $ctx1.sendIdx["instructions"]=1;
  3255. $1=_st($2)._first();
  3256. self._visitReceiver_($1);
  3257. $3=self._stream();
  3258. $ctx1.sendIdx["stream"]=1;
  3259. $4=_st(".".__comma(_st(_st(anIRSend)._selector())._asJavaScriptMethodName())).__comma("(");
  3260. $ctx1.sendIdx[","]=1;
  3261. _st($3)._nextPutAll_($4);
  3262. $ctx1.sendIdx["nextPutAll:"]=1;
  3263. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  3264. return smalltalk.withContext(function($ctx2) {
  3265. return self._visit_(each);
  3266. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3267. }),(function(){
  3268. return smalltalk.withContext(function($ctx2) {
  3269. $5=self._stream();
  3270. $ctx2.sendIdx["stream"]=2;
  3271. return _st($5)._nextPutAll_(",");
  3272. $ctx2.sendIdx["nextPutAll:"]=2;
  3273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3274. }));
  3275. _st(self._stream())._nextPutAll_(")");
  3276. return self}, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},globals.IRJSTranslator)});
  3277. },
  3278. args: ["anIRSend"],
  3279. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName, '('.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ')'",
  3280. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "do:separatedBy:", "allButFirst", "visit:"],
  3281. referencedClasses: []
  3282. }),
  3283. globals.IRJSTranslator);
  3284. smalltalk.addMethod(
  3285. smalltalk.method({
  3286. selector: "visitSuperSend:",
  3287. protocol: 'visiting',
  3288. fn: function (anIRSend){
  3289. var self=this;
  3290. return smalltalk.withContext(function($ctx1) {
  3291. var $1,$2,$6,$5,$4,$3,$7,$8,$9,$11,$10,$12,$13,$14,$15;
  3292. $1=self._stream();
  3293. $ctx1.sendIdx["stream"]=1;
  3294. $2=$1;
  3295. $6=_st(anIRSend)._scope();
  3296. $ctx1.sendIdx["scope"]=1;
  3297. $5=_st($6)._alias();
  3298. $ctx1.sendIdx["alias"]=1;
  3299. $4="(".__comma($5);
  3300. $ctx1.sendIdx[","]=2;
  3301. $3=_st($4).__comma(".supercall = true, ");
  3302. $ctx1.sendIdx[","]=1;
  3303. _st($2)._nextPutAll_($3);
  3304. $ctx1.sendIdx["nextPutAll:"]=1;
  3305. _st($1)._nextPutAll_(_st(self._currentClass())._asJavascript());
  3306. $ctx1.sendIdx["nextPutAll:"]=2;
  3307. _st($1)._nextPutAll_(".superclass.fn.prototype.");
  3308. $ctx1.sendIdx["nextPutAll:"]=3;
  3309. $7=$1;
  3310. $8=_st(_st(_st(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  3311. $ctx1.sendIdx[","]=3;
  3312. _st($7)._nextPutAll_($8);
  3313. $ctx1.sendIdx["nextPutAll:"]=4;
  3314. $9=_st($1)._nextPutAll_("_st(");
  3315. $ctx1.sendIdx["nextPutAll:"]=5;
  3316. $11=_st(anIRSend)._instructions();
  3317. $ctx1.sendIdx["instructions"]=1;
  3318. $10=_st($11)._first();
  3319. self._visit_($10);
  3320. $ctx1.sendIdx["visit:"]=1;
  3321. $12=self._stream();
  3322. $ctx1.sendIdx["stream"]=2;
  3323. _st($12)._nextPutAll_("), [");
  3324. $ctx1.sendIdx["nextPutAll:"]=6;
  3325. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  3326. return smalltalk.withContext(function($ctx2) {
  3327. return self._visit_(each);
  3328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3329. }),(function(){
  3330. return smalltalk.withContext(function($ctx2) {
  3331. $13=self._stream();
  3332. $ctx2.sendIdx["stream"]=3;
  3333. return _st($13)._nextPutAll_(",");
  3334. $ctx2.sendIdx["nextPutAll:"]=7;
  3335. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3336. }));
  3337. $14=self._stream();
  3338. _st($14)._nextPutAll_("]));");
  3339. $ctx1.sendIdx["nextPutAll:"]=8;
  3340. _st($14)._lf();
  3341. $15=_st($14)._nextPutAll_(_st(_st(_st(anIRSend)._scope())._alias()).__comma(".supercall = false"));
  3342. return self}, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},globals.IRJSTranslator)});
  3343. },
  3344. args: ["anIRSend"],
  3345. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '(', anIRSend scope alias, '.supercall = true, ';\x0a\x09\x09nextPutAll: self currentClass asJavascript;\x0a\x09\x09nextPutAll: '.superclass.fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '_st('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll: '), ['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream \x0a\x09\x09nextPutAll: ']));'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false'",
  3346. messageSends: ["nextPutAll:", "stream", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst", "lf"],
  3347. referencedClasses: []
  3348. }),
  3349. globals.IRJSTranslator);
  3350. smalltalk.addClass('JSStream', globals.Object, ['stream'], 'Compiler-IR');
  3351. smalltalk.addMethod(
  3352. smalltalk.method({
  3353. selector: "contents",
  3354. protocol: 'accessing',
  3355. fn: function (){
  3356. var self=this;
  3357. return smalltalk.withContext(function($ctx1) {
  3358. var $1;
  3359. $1=_st(self["@stream"])._contents();
  3360. return $1;
  3361. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.JSStream)});
  3362. },
  3363. args: [],
  3364. source: "contents\x0a\x09^ stream contents",
  3365. messageSends: ["contents"],
  3366. referencedClasses: []
  3367. }),
  3368. globals.JSStream);
  3369. smalltalk.addMethod(
  3370. smalltalk.method({
  3371. selector: "initialize",
  3372. protocol: 'initialization',
  3373. fn: function (){
  3374. var self=this;
  3375. return smalltalk.withContext(function($ctx1) {
  3376. ($ctx1.supercall = true, globals.JSStream.superclass.fn.prototype._initialize.apply(_st(self), []));
  3377. $ctx1.supercall = false;
  3378. self["@stream"]=""._writeStream();
  3379. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.JSStream)});
  3380. },
  3381. args: [],
  3382. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  3383. messageSends: ["initialize", "writeStream"],
  3384. referencedClasses: []
  3385. }),
  3386. globals.JSStream);
  3387. smalltalk.addMethod(
  3388. smalltalk.method({
  3389. selector: "lf",
  3390. protocol: 'streaming',
  3391. fn: function (){
  3392. var self=this;
  3393. return smalltalk.withContext(function($ctx1) {
  3394. _st(self["@stream"])._lf();
  3395. return self}, function($ctx1) {$ctx1.fill(self,"lf",{},globals.JSStream)});
  3396. },
  3397. args: [],
  3398. source: "lf\x0a\x09stream lf",
  3399. messageSends: ["lf"],
  3400. referencedClasses: []
  3401. }),
  3402. globals.JSStream);
  3403. smalltalk.addMethod(
  3404. smalltalk.method({
  3405. selector: "nextPut:",
  3406. protocol: 'streaming',
  3407. fn: function (aString){
  3408. var self=this;
  3409. return smalltalk.withContext(function($ctx1) {
  3410. _st(self["@stream"])._nextPut_(aString);
  3411. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},globals.JSStream)});
  3412. },
  3413. args: ["aString"],
  3414. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  3415. messageSends: ["nextPut:"],
  3416. referencedClasses: []
  3417. }),
  3418. globals.JSStream);
  3419. smalltalk.addMethod(
  3420. smalltalk.method({
  3421. selector: "nextPutAll:",
  3422. protocol: 'streaming',
  3423. fn: function (aString){
  3424. var self=this;
  3425. return smalltalk.withContext(function($ctx1) {
  3426. _st(self["@stream"])._nextPutAll_(aString);
  3427. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},globals.JSStream)});
  3428. },
  3429. args: ["aString"],
  3430. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  3431. messageSends: ["nextPutAll:"],
  3432. referencedClasses: []
  3433. }),
  3434. globals.JSStream);
  3435. smalltalk.addMethod(
  3436. smalltalk.method({
  3437. selector: "nextPutAssignment",
  3438. protocol: 'streaming',
  3439. fn: function (){
  3440. var self=this;
  3441. return smalltalk.withContext(function($ctx1) {
  3442. _st(self["@stream"])._nextPutAll_("=");
  3443. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},globals.JSStream)});
  3444. },
  3445. args: [],
  3446. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  3447. messageSends: ["nextPutAll:"],
  3448. referencedClasses: []
  3449. }),
  3450. globals.JSStream);
  3451. smalltalk.addMethod(
  3452. smalltalk.method({
  3453. selector: "nextPutBlockContextFor:during:",
  3454. protocol: 'streaming',
  3455. fn: function (anIRClosure,aBlock){
  3456. var self=this;
  3457. return smalltalk.withContext(function($ctx1) {
  3458. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$24,$23,$22,$21,$20,$19,$18;
  3459. $1=_st(anIRClosure)._requiresSmalltalkContext();
  3460. if(! smalltalk.assert($1)){
  3461. $2=_st(aBlock)._value();
  3462. $ctx1.sendIdx["value"]=1;
  3463. return $2;
  3464. };
  3465. $6=_st(anIRClosure)._scope();
  3466. $ctx1.sendIdx["scope"]=1;
  3467. $5=_st($6)._alias();
  3468. $ctx1.sendIdx["alias"]=1;
  3469. $4="return smalltalk.withContext(function(".__comma($5);
  3470. $ctx1.sendIdx[","]=2;
  3471. $3=_st($4).__comma(") {");
  3472. $ctx1.sendIdx[","]=1;
  3473. self._nextPutAll_($3);
  3474. $ctx1.sendIdx["nextPutAll:"]=1;
  3475. $7=self._lf();
  3476. _st(aBlock)._value();
  3477. $11=_st(anIRClosure)._scope();
  3478. $ctx1.sendIdx["scope"]=2;
  3479. $10=_st($11)._alias();
  3480. $ctx1.sendIdx["alias"]=2;
  3481. $9="}, function(".__comma($10);
  3482. $ctx1.sendIdx[","]=4;
  3483. $8=_st($9).__comma(") {");
  3484. $ctx1.sendIdx[","]=3;
  3485. self._nextPutAll_($8);
  3486. $ctx1.sendIdx["nextPutAll:"]=2;
  3487. $15=_st(anIRClosure)._scope();
  3488. $ctx1.sendIdx["scope"]=3;
  3489. $14=_st($15)._alias();
  3490. $ctx1.sendIdx["alias"]=3;
  3491. $13=_st($14).__comma(".fillBlock({");
  3492. $ctx1.sendIdx[","]=5;
  3493. $12=self._nextPutAll_($13);
  3494. $ctx1.sendIdx["nextPutAll:"]=3;
  3495. _st(_st(anIRClosure)._locals())._do_separatedBy_((function(each){
  3496. return smalltalk.withContext(function($ctx2) {
  3497. $16=_st(each)._asVariableName();
  3498. $ctx2.sendIdx["asVariableName"]=1;
  3499. self._nextPutAll_($16);
  3500. $ctx2.sendIdx["nextPutAll:"]=4;
  3501. self._nextPutAll_(":");
  3502. $ctx2.sendIdx["nextPutAll:"]=5;
  3503. $17=self._nextPutAll_(_st(each)._asVariableName());
  3504. $ctx2.sendIdx["nextPutAll:"]=6;
  3505. return $17;
  3506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3507. }),(function(){
  3508. return smalltalk.withContext(function($ctx2) {
  3509. return self._nextPutAll_(",");
  3510. $ctx2.sendIdx["nextPutAll:"]=7;
  3511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  3512. }));
  3513. self._nextPutAll_("},");
  3514. $ctx1.sendIdx["nextPutAll:"]=8;
  3515. $24=_st(anIRClosure)._scope();
  3516. $ctx1.sendIdx["scope"]=4;
  3517. $23=_st($24)._outerScope();
  3518. $22=_st($23)._alias();
  3519. $21=_st($22).__comma(",");
  3520. $20=_st($21).__comma(_st(_st(_st(anIRClosure)._scope())._blockIndex())._asString());
  3521. $ctx1.sendIdx[","]=7;
  3522. $19=_st($20).__comma(")});");
  3523. $ctx1.sendIdx[","]=6;
  3524. $18=self._nextPutAll_($19);
  3525. return self}, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},globals.JSStream)});
  3526. },
  3527. args: ["anIRClosure", "aBlock"],
  3528. source: "nextPutBlockContextFor: anIRClosure during: aBlock\x0a\x09anIRClosure requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09self\x0a\x09\x09nextPutAll: 'return smalltalk.withContext(function(', anIRClosure scope alias, ') {'; lf.\x0a\x09\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '}, function(', anIRClosure scope alias, ') {';\x0a\x09\x09nextPutAll: anIRClosure scope alias, '.fillBlock({'.\x0a\x09\x0a\x09anIRClosure locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: anIRClosure scope outerScope alias, ',', anIRClosure scope blockIndex asString, ')});'",
  3529. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", ",", "alias", "scope", "lf", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"],
  3530. referencedClasses: []
  3531. }),
  3532. globals.JSStream);
  3533. smalltalk.addMethod(
  3534. smalltalk.method({
  3535. selector: "nextPutClassRefFunction:",
  3536. protocol: 'streaming',
  3537. fn: function (aString){
  3538. var self=this;
  3539. return smalltalk.withContext(function($ctx1) {
  3540. var $1,$2;
  3541. $1=self["@stream"];
  3542. _st($1)._nextPutAll_("function $");
  3543. $ctx1.sendIdx["nextPutAll:"]=1;
  3544. _st($1)._nextPutAll_(aString);
  3545. $ctx1.sendIdx["nextPutAll:"]=2;
  3546. _st($1)._nextPutAll_("(){return globals.");
  3547. $ctx1.sendIdx["nextPutAll:"]=3;
  3548. _st($1)._nextPutAll_(aString);
  3549. $ctx1.sendIdx["nextPutAll:"]=4;
  3550. _st($1)._nextPutAll_("||(typeof ");
  3551. $ctx1.sendIdx["nextPutAll:"]=5;
  3552. _st($1)._nextPutAll_(aString);
  3553. $ctx1.sendIdx["nextPutAll:"]=6;
  3554. _st($1)._nextPutAll_("==\x22undefined\x22?nil:");
  3555. $ctx1.sendIdx["nextPutAll:"]=7;
  3556. _st($1)._nextPutAll_(aString);
  3557. $ctx1.sendIdx["nextPutAll:"]=8;
  3558. _st($1)._nextPutAll_(")}");
  3559. $2=_st($1)._lf();
  3560. return self}, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},globals.JSStream)});
  3561. },
  3562. args: ["aString"],
  3563. source: "nextPutClassRefFunction: aString\x0a\x09\x22Creates an inner function $aString into method and called as `$Foo()`whenever the global is accessed.\x0a\x09This ensures that undefined global access will answer `nil`\x22\x0a\x09\x0a\x09stream\x0a\x09\x09nextPutAll: 'function $';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '(){return globals.';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '||(typeof ';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '==\x22undefined\x22?nil:';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: ')}';\x0a\x09\x09lf",
  3564. messageSends: ["nextPutAll:", "lf"],
  3565. referencedClasses: []
  3566. }),
  3567. globals.JSStream);
  3568. smalltalk.addMethod(
  3569. smalltalk.method({
  3570. selector: "nextPutClosureWith:arguments:",
  3571. protocol: 'streaming',
  3572. fn: function (aBlock,anArray){
  3573. var self=this;
  3574. return smalltalk.withContext(function($ctx1) {
  3575. var $1,$2,$3,$4;
  3576. _st(self["@stream"])._nextPutAll_("(function(");
  3577. $ctx1.sendIdx["nextPutAll:"]=1;
  3578. _st(anArray)._do_separatedBy_((function(each){
  3579. return smalltalk.withContext(function($ctx2) {
  3580. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  3581. $ctx2.sendIdx["nextPutAll:"]=2;
  3582. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3583. }),(function(){
  3584. return smalltalk.withContext(function($ctx2) {
  3585. return _st(self["@stream"])._nextPut_(",");
  3586. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3587. }));
  3588. $1=self["@stream"];
  3589. _st($1)._nextPutAll_("){");
  3590. $ctx1.sendIdx["nextPutAll:"]=3;
  3591. $2=_st($1)._lf();
  3592. $ctx1.sendIdx["lf"]=1;
  3593. _st(aBlock)._value();
  3594. $3=self["@stream"];
  3595. _st($3)._lf();
  3596. $4=_st($3)._nextPutAll_("})");
  3597. return self}, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},globals.JSStream)});
  3598. },
  3599. args: ["aBlock", "anArray"],
  3600. 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 lf; nextPutAll: '})'",
  3601. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  3602. referencedClasses: []
  3603. }),
  3604. globals.JSStream);
  3605. smalltalk.addMethod(
  3606. smalltalk.method({
  3607. selector: "nextPutContextFor:during:",
  3608. protocol: 'streaming',
  3609. fn: function (aMethod,aBlock){
  3610. var self=this;
  3611. return smalltalk.withContext(function($ctx1) {
  3612. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18,$19;
  3613. $1=_st(aMethod)._requiresSmalltalkContext();
  3614. if(! smalltalk.assert($1)){
  3615. $2=_st(aBlock)._value();
  3616. $ctx1.sendIdx["value"]=1;
  3617. return $2;
  3618. };
  3619. $6=_st(aMethod)._scope();
  3620. $ctx1.sendIdx["scope"]=1;
  3621. $5=_st($6)._alias();
  3622. $ctx1.sendIdx["alias"]=1;
  3623. $4="return smalltalk.withContext(function(".__comma($5);
  3624. $ctx1.sendIdx[","]=2;
  3625. $3=_st($4).__comma(") { ");
  3626. $ctx1.sendIdx[","]=1;
  3627. self._nextPutAll_($3);
  3628. $ctx1.sendIdx["nextPutAll:"]=1;
  3629. $7=self._lf();
  3630. _st(aBlock)._value();
  3631. $12=_st(aMethod)._scope();
  3632. $ctx1.sendIdx["scope"]=2;
  3633. $11=_st($12)._alias();
  3634. $ctx1.sendIdx["alias"]=2;
  3635. $10="}, function(".__comma($11);
  3636. $ctx1.sendIdx[","]=5;
  3637. $9=_st($10).__comma(") {");
  3638. $ctx1.sendIdx[","]=4;
  3639. $8=_st($9).__comma(_st(_st(aMethod)._scope())._alias());
  3640. $ctx1.sendIdx[","]=3;
  3641. self._nextPutAll_($8);
  3642. $ctx1.sendIdx["nextPutAll:"]=2;
  3643. $16=_st(_st(aMethod)._selector())._asJavascript();
  3644. $ctx1.sendIdx["asJavascript"]=1;
  3645. $15=".fill(self,".__comma($16);
  3646. $14=_st($15).__comma(",{");
  3647. $ctx1.sendIdx[","]=6;
  3648. $13=self._nextPutAll_($14);
  3649. $ctx1.sendIdx["nextPutAll:"]=3;
  3650. _st(_st(aMethod)._locals())._do_separatedBy_((function(each){
  3651. return smalltalk.withContext(function($ctx2) {
  3652. $17=_st(each)._asVariableName();
  3653. $ctx2.sendIdx["asVariableName"]=1;
  3654. self._nextPutAll_($17);
  3655. $ctx2.sendIdx["nextPutAll:"]=4;
  3656. self._nextPutAll_(":");
  3657. $ctx2.sendIdx["nextPutAll:"]=5;
  3658. $18=self._nextPutAll_(_st(each)._asVariableName());
  3659. $ctx2.sendIdx["nextPutAll:"]=6;
  3660. return $18;
  3661. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3662. }),(function(){
  3663. return smalltalk.withContext(function($ctx2) {
  3664. return self._nextPutAll_(",");
  3665. $ctx2.sendIdx["nextPutAll:"]=7;
  3666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  3667. }));
  3668. self._nextPutAll_("},");
  3669. $ctx1.sendIdx["nextPutAll:"]=8;
  3670. self._nextPutAll_(_st(_st(aMethod)._theClass())._asJavascript());
  3671. $ctx1.sendIdx["nextPutAll:"]=9;
  3672. $19=self._nextPutAll_(")});");
  3673. return self}, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},globals.JSStream)});
  3674. },
  3675. args: ["aMethod", "aBlock"],
  3676. source: "nextPutContextFor: aMethod during: aBlock\x0a\x09aMethod requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: 'return smalltalk.withContext(function(', aMethod scope alias, ') { '; lf.\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '}, function(', aMethod scope alias, ') {', aMethod scope alias;\x0a\x09\x09nextPutAll: '.fill(self,', aMethod selector asJavascript, ',{'.\x0a\x0a\x09aMethod locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: aMethod theClass asJavascript;\x0a\x09\x09nextPutAll: ')});'",
  3677. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", ",", "alias", "scope", "lf", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"],
  3678. referencedClasses: []
  3679. }),
  3680. globals.JSStream);
  3681. smalltalk.addMethod(
  3682. smalltalk.method({
  3683. selector: "nextPutFunctionWith:arguments:",
  3684. protocol: 'streaming',
  3685. fn: function (aBlock,anArray){
  3686. var self=this;
  3687. return smalltalk.withContext(function($ctx1) {
  3688. var $1,$2,$3,$4,$5,$6;
  3689. _st(self["@stream"])._nextPutAll_("fn: function(");
  3690. $ctx1.sendIdx["nextPutAll:"]=1;
  3691. _st(anArray)._do_separatedBy_((function(each){
  3692. return smalltalk.withContext(function($ctx2) {
  3693. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  3694. $ctx2.sendIdx["nextPutAll:"]=2;
  3695. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3696. }),(function(){
  3697. return smalltalk.withContext(function($ctx2) {
  3698. return _st(self["@stream"])._nextPut_(",");
  3699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3700. }));
  3701. $1=self["@stream"];
  3702. _st($1)._nextPutAll_("){");
  3703. $ctx1.sendIdx["nextPutAll:"]=3;
  3704. $2=_st($1)._lf();
  3705. $ctx1.sendIdx["lf"]=1;
  3706. $3=self["@stream"];
  3707. _st($3)._nextPutAll_("var self=this;");
  3708. $ctx1.sendIdx["nextPutAll:"]=4;
  3709. $4=_st($3)._lf();
  3710. $ctx1.sendIdx["lf"]=2;
  3711. _st(aBlock)._value();
  3712. $5=self["@stream"];
  3713. _st($5)._lf();
  3714. $6=_st($5)._nextPutAll_("}");
  3715. return self}, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},globals.JSStream)});
  3716. },
  3717. args: ["aBlock", "anArray"],
  3718. 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 lf; nextPutAll: '}'",
  3719. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  3720. referencedClasses: []
  3721. }),
  3722. globals.JSStream);
  3723. smalltalk.addMethod(
  3724. smalltalk.method({
  3725. selector: "nextPutIf:with:",
  3726. protocol: 'streaming',
  3727. fn: function (aBlock,anotherBlock){
  3728. var self=this;
  3729. return smalltalk.withContext(function($ctx1) {
  3730. var $1,$2;
  3731. _st(self["@stream"])._nextPutAll_("if(");
  3732. $ctx1.sendIdx["nextPutAll:"]=1;
  3733. _st(aBlock)._value();
  3734. $ctx1.sendIdx["value"]=1;
  3735. $1=self["@stream"];
  3736. _st($1)._nextPutAll_("){");
  3737. $ctx1.sendIdx["nextPutAll:"]=2;
  3738. $2=_st($1)._lf();
  3739. _st(anotherBlock)._value();
  3740. _st(self["@stream"])._nextPutAll_("}");
  3741. return self}, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.JSStream)});
  3742. },
  3743. args: ["aBlock", "anotherBlock"],
  3744. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  3745. messageSends: ["nextPutAll:", "value", "lf"],
  3746. referencedClasses: []
  3747. }),
  3748. globals.JSStream);
  3749. smalltalk.addMethod(
  3750. smalltalk.method({
  3751. selector: "nextPutIfElse:with:with:",
  3752. protocol: 'streaming',
  3753. fn: function (aBlock,ifBlock,elseBlock){
  3754. var self=this;
  3755. return smalltalk.withContext(function($ctx1) {
  3756. var $1,$2,$3,$4;
  3757. _st(self["@stream"])._nextPutAll_("if(");
  3758. $ctx1.sendIdx["nextPutAll:"]=1;
  3759. _st(aBlock)._value();
  3760. $ctx1.sendIdx["value"]=1;
  3761. $1=self["@stream"];
  3762. _st($1)._nextPutAll_("){");
  3763. $ctx1.sendIdx["nextPutAll:"]=2;
  3764. $2=_st($1)._lf();
  3765. $ctx1.sendIdx["lf"]=1;
  3766. _st(ifBlock)._value();
  3767. $ctx1.sendIdx["value"]=2;
  3768. $3=self["@stream"];
  3769. _st($3)._nextPutAll_("} else {");
  3770. $ctx1.sendIdx["nextPutAll:"]=3;
  3771. $4=_st($3)._lf();
  3772. _st(elseBlock)._value();
  3773. _st(self["@stream"])._nextPutAll_("}");
  3774. return self}, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},globals.JSStream)});
  3775. },
  3776. args: ["aBlock", "ifBlock", "elseBlock"],
  3777. 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: '}'",
  3778. messageSends: ["nextPutAll:", "value", "lf"],
  3779. referencedClasses: []
  3780. }),
  3781. globals.JSStream);
  3782. smalltalk.addMethod(
  3783. smalltalk.method({
  3784. selector: "nextPutMethodDeclaration:with:",
  3785. protocol: 'streaming',
  3786. fn: function (aMethod,aBlock){
  3787. var self=this;
  3788. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  3789. return smalltalk.withContext(function($ctx1) {
  3790. var $1,$2,$5,$4,$3,$6,$9,$8,$7,$10,$11,$12,$15,$14,$13,$16,$19,$18,$17,$20,$23,$22,$21,$24,$25,$26;
  3791. $1=self["@stream"];
  3792. _st($1)._nextPutAll_("smalltalk.method({");
  3793. $ctx1.sendIdx["nextPutAll:"]=1;
  3794. _st($1)._lf();
  3795. $ctx1.sendIdx["lf"]=1;
  3796. $2=$1;
  3797. $5=_st(_st(aMethod)._selector())._asJavascript();
  3798. $ctx1.sendIdx["asJavascript"]=1;
  3799. $4="selector: ".__comma($5);
  3800. $ctx1.sendIdx[","]=2;
  3801. $3=_st($4).__comma(",");
  3802. $ctx1.sendIdx[","]=1;
  3803. _st($2)._nextPutAll_($3);
  3804. $ctx1.sendIdx["nextPutAll:"]=2;
  3805. _st($1)._lf();
  3806. $ctx1.sendIdx["lf"]=2;
  3807. $6=$1;
  3808. $9=_st(_st(aMethod)._source())._asJavascript();
  3809. $ctx1.sendIdx["asJavascript"]=2;
  3810. $8="source: ".__comma($9);
  3811. $ctx1.sendIdx[","]=4;
  3812. $7=_st($8).__comma(",");
  3813. $ctx1.sendIdx[","]=3;
  3814. _st($6)._nextPutAll_($7);
  3815. $ctx1.sendIdx["nextPutAll:"]=3;
  3816. $10=_st($1)._lf();
  3817. $ctx1.sendIdx["lf"]=3;
  3818. _st(aBlock)._value();
  3819. $ctx1.sendIdx["value"]=1;
  3820. $11=self["@stream"];
  3821. $12=$11;
  3822. $15=_st($String())._lf();
  3823. $ctx1.sendIdx["lf"]=4;
  3824. $14=",".__comma($15);
  3825. $ctx1.sendIdx[","]=6;
  3826. $13=_st($14).__comma("messageSends: ");
  3827. $ctx1.sendIdx[","]=5;
  3828. _st($12)._nextPutAll_($13);
  3829. $ctx1.sendIdx["nextPutAll:"]=4;
  3830. $16=$11;
  3831. $19=_st(_st(aMethod)._messageSends())._asArray();
  3832. $ctx1.sendIdx["asArray"]=1;
  3833. $18=_st($19)._asJavascript();
  3834. $ctx1.sendIdx["asJavascript"]=3;
  3835. $17=_st($18).__comma(",");
  3836. $ctx1.sendIdx[","]=7;
  3837. _st($16)._nextPutAll_($17);
  3838. $ctx1.sendIdx["nextPutAll:"]=5;
  3839. _st($11)._lf();
  3840. $ctx1.sendIdx["lf"]=5;
  3841. $20=$11;
  3842. $23=_st(_st(_st(_st(aMethod)._arguments())._collect_((function(each){
  3843. return smalltalk.withContext(function($ctx2) {
  3844. return _st(each)._value();
  3845. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3846. })))._asArray())._asJavascript();
  3847. $ctx1.sendIdx["asJavascript"]=4;
  3848. $22="args: ".__comma($23);
  3849. $21=_st($22).__comma(",");
  3850. $ctx1.sendIdx[","]=8;
  3851. _st($20)._nextPutAll_($21);
  3852. $ctx1.sendIdx["nextPutAll:"]=6;
  3853. _st($11)._lf();
  3854. $24=_st($11)._nextPutAll_("referencedClasses: [");
  3855. $ctx1.sendIdx["nextPutAll:"]=7;
  3856. _st(_st(aMethod)._classReferences())._do_separatedBy_((function(each){
  3857. return smalltalk.withContext(function($ctx2) {
  3858. return _st(self["@stream"])._nextPutAll_(_st(each)._asJavascript());
  3859. $ctx2.sendIdx["nextPutAll:"]=8;
  3860. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3861. }),(function(){
  3862. return smalltalk.withContext(function($ctx2) {
  3863. return _st(self["@stream"])._nextPutAll_(",");
  3864. $ctx2.sendIdx["nextPutAll:"]=9;
  3865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  3866. }));
  3867. $25=self["@stream"];
  3868. _st($25)._nextPutAll_("]");
  3869. $ctx1.sendIdx["nextPutAll:"]=10;
  3870. $26=_st($25)._nextPutAll_("})");
  3871. return self}, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},globals.JSStream)});
  3872. },
  3873. args: ["aMethod", "aBlock"],
  3874. source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: 'smalltalk.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: '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: '})'",
  3875. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"],
  3876. referencedClasses: ["String"]
  3877. }),
  3878. globals.JSStream);
  3879. smalltalk.addMethod(
  3880. smalltalk.method({
  3881. selector: "nextPutNonLocalReturnHandlingWith:",
  3882. protocol: 'streaming',
  3883. fn: function (aBlock){
  3884. var self=this;
  3885. return smalltalk.withContext(function($ctx1) {
  3886. var $1,$2,$3,$4;
  3887. $1=self["@stream"];
  3888. _st($1)._nextPutAll_("var $early={};");
  3889. $ctx1.sendIdx["nextPutAll:"]=1;
  3890. _st($1)._lf();
  3891. $ctx1.sendIdx["lf"]=1;
  3892. _st($1)._nextPutAll_("try {");
  3893. $ctx1.sendIdx["nextPutAll:"]=2;
  3894. $2=_st($1)._lf();
  3895. $ctx1.sendIdx["lf"]=2;
  3896. _st(aBlock)._value();
  3897. $3=self["@stream"];
  3898. _st($3)._nextPutAll_("}");
  3899. $ctx1.sendIdx["nextPutAll:"]=3;
  3900. _st($3)._lf();
  3901. $ctx1.sendIdx["lf"]=3;
  3902. _st($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  3903. $4=_st($3)._lf();
  3904. return self}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},globals.JSStream)});
  3905. },
  3906. args: ["aBlock"],
  3907. 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",
  3908. messageSends: ["nextPutAll:", "lf", "value"],
  3909. referencedClasses: []
  3910. }),
  3911. globals.JSStream);
  3912. smalltalk.addMethod(
  3913. smalltalk.method({
  3914. selector: "nextPutNonLocalReturnWith:",
  3915. protocol: 'streaming',
  3916. fn: function (aBlock){
  3917. var self=this;
  3918. return smalltalk.withContext(function($ctx1) {
  3919. _st(self["@stream"])._nextPutAll_("throw $early=[");
  3920. $ctx1.sendIdx["nextPutAll:"]=1;
  3921. _st(aBlock)._value();
  3922. _st(self["@stream"])._nextPutAll_("]");
  3923. return self}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},globals.JSStream)});
  3924. },
  3925. args: ["aBlock"],
  3926. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  3927. messageSends: ["nextPutAll:", "value"],
  3928. referencedClasses: []
  3929. }),
  3930. globals.JSStream);
  3931. smalltalk.addMethod(
  3932. smalltalk.method({
  3933. selector: "nextPutReturn",
  3934. protocol: 'streaming',
  3935. fn: function (){
  3936. var self=this;
  3937. return smalltalk.withContext(function($ctx1) {
  3938. _st(self["@stream"])._nextPutAll_("return ");
  3939. return self}, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},globals.JSStream)});
  3940. },
  3941. args: [],
  3942. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  3943. messageSends: ["nextPutAll:"],
  3944. referencedClasses: []
  3945. }),
  3946. globals.JSStream);
  3947. smalltalk.addMethod(
  3948. smalltalk.method({
  3949. selector: "nextPutReturnWith:",
  3950. protocol: 'streaming',
  3951. fn: function (aBlock){
  3952. var self=this;
  3953. return smalltalk.withContext(function($ctx1) {
  3954. self._nextPutReturn();
  3955. _st(aBlock)._value();
  3956. return self}, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},globals.JSStream)});
  3957. },
  3958. args: ["aBlock"],
  3959. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  3960. messageSends: ["nextPutReturn", "value"],
  3961. referencedClasses: []
  3962. }),
  3963. globals.JSStream);
  3964. smalltalk.addMethod(
  3965. smalltalk.method({
  3966. selector: "nextPutSendIndexFor:",
  3967. protocol: 'streaming',
  3968. fn: function (anIRSend){
  3969. var self=this;
  3970. return smalltalk.withContext(function($ctx1) {
  3971. var $1;
  3972. self._nextPutAll_(";");
  3973. $ctx1.sendIdx["nextPutAll:"]=1;
  3974. self._lf();
  3975. self._nextPutAll_(_st(_st(anIRSend)._scope())._alias());
  3976. $ctx1.sendIdx["nextPutAll:"]=2;
  3977. self._nextPutAll_(".sendIdx[");
  3978. $ctx1.sendIdx["nextPutAll:"]=3;
  3979. self._nextPutAll_(_st(_st(anIRSend)._selector())._asJavascript());
  3980. $ctx1.sendIdx["nextPutAll:"]=4;
  3981. self._nextPutAll_("]=");
  3982. $ctx1.sendIdx["nextPutAll:"]=5;
  3983. $1=self._nextPutAll_(_st(_st(anIRSend)._index())._asString());
  3984. return self}, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},globals.JSStream)});
  3985. },
  3986. args: ["anIRSend"],
  3987. source: "nextPutSendIndexFor: anIRSend\x0a\x09self \x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias;\x0a\x09\x09nextPutAll: '.sendIdx[';\x0a\x09\x09nextPutAll: anIRSend selector asJavascript;\x0a\x09\x09nextPutAll: ']=';\x0a\x09\x09nextPutAll: anIRSend index asString",
  3988. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"],
  3989. referencedClasses: []
  3990. }),
  3991. globals.JSStream);
  3992. smalltalk.addMethod(
  3993. smalltalk.method({
  3994. selector: "nextPutSequenceWith:",
  3995. protocol: 'streaming',
  3996. fn: function (aBlock){
  3997. var self=this;
  3998. return smalltalk.withContext(function($ctx1) {
  3999. _st(aBlock)._value();
  4000. return self}, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},globals.JSStream)});
  4001. },
  4002. args: ["aBlock"],
  4003. 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",
  4004. messageSends: ["value"],
  4005. referencedClasses: []
  4006. }),
  4007. globals.JSStream);
  4008. smalltalk.addMethod(
  4009. smalltalk.method({
  4010. selector: "nextPutStatementWith:",
  4011. protocol: 'streaming',
  4012. fn: function (aBlock){
  4013. var self=this;
  4014. return smalltalk.withContext(function($ctx1) {
  4015. var $1,$2;
  4016. _st(aBlock)._value();
  4017. $1=self["@stream"];
  4018. _st($1)._nextPutAll_(";");
  4019. $2=_st($1)._lf();
  4020. return self}, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},globals.JSStream)});
  4021. },
  4022. args: ["aBlock"],
  4023. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  4024. messageSends: ["value", "nextPutAll:", "lf"],
  4025. referencedClasses: []
  4026. }),
  4027. globals.JSStream);
  4028. smalltalk.addMethod(
  4029. smalltalk.method({
  4030. selector: "nextPutVars:",
  4031. protocol: 'streaming',
  4032. fn: function (aCollection){
  4033. var self=this;
  4034. return smalltalk.withContext(function($ctx1) {
  4035. var $1,$2;
  4036. var $early={};
  4037. try {
  4038. _st(aCollection)._ifEmpty_((function(){
  4039. throw $early=[self];
  4040. }));
  4041. _st(self["@stream"])._nextPutAll_("var ");
  4042. $ctx1.sendIdx["nextPutAll:"]=1;
  4043. _st(aCollection)._do_separatedBy_((function(each){
  4044. return smalltalk.withContext(function($ctx2) {
  4045. return _st(self["@stream"])._nextPutAll_(each);
  4046. $ctx2.sendIdx["nextPutAll:"]=2;
  4047. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  4048. }),(function(){
  4049. return smalltalk.withContext(function($ctx2) {
  4050. return _st(self["@stream"])._nextPutAll_(",");
  4051. $ctx2.sendIdx["nextPutAll:"]=3;
  4052. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4053. }));
  4054. $1=self["@stream"];
  4055. _st($1)._nextPutAll_(";");
  4056. $2=_st($1)._lf();
  4057. return self}
  4058. catch(e) {if(e===$early)return e[0]; throw e}
  4059. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},globals.JSStream)});
  4060. },
  4061. args: ["aCollection"],
  4062. source: "nextPutVars: aCollection\x0a\x09aCollection ifEmpty: [ ^ self ].\x0a\x09\x0a\x09stream nextPutAll: 'var '.\x0a\x09aCollection\x0a\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ';'; lf",
  4063. messageSends: ["ifEmpty:", "nextPutAll:", "do:separatedBy:", "lf"],
  4064. referencedClasses: []
  4065. }),
  4066. globals.JSStream);
  4067. smalltalk.addMethod(
  4068. smalltalk.method({
  4069. selector: "appendToInstruction:",
  4070. protocol: '*Compiler-IR',
  4071. fn: function (anIRInstruction){
  4072. var self=this;
  4073. return smalltalk.withContext(function($ctx1) {
  4074. _st(anIRInstruction)._appendBlock_(self);
  4075. return self}, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},globals.BlockClosure)});
  4076. },
  4077. args: ["anIRInstruction"],
  4078. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  4079. messageSends: ["appendBlock:"],
  4080. referencedClasses: []
  4081. }),
  4082. globals.BlockClosure);
  4083. });