2
0

Compiler-IR.js 131 KB

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