Compiler-IR.js 132 KB

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