1
0

Compiler-IR.js 131 KB

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