1
0

Compiler-IR.js 125 KB

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