Compiler-IR.js 125 KB

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