Compiler-IR.js 137 KB

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