Compiler-IR.js 132 KB

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