1
0

Compiler-IR.js 95 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649
  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=nil;
  12. (variable=(function($rec){smalltalk.send($rec, "_variable_", [smalltalk.send(smalltalk.send((smalltalk.AliasVar || AliasVar), "_new", []), "_name_", [smalltalk.send("$", "__comma", [smalltalk.send(self, "_nextAlias", [])])])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRVariable || IRVariable), "_new", [])));
  13. smalltalk.send(smalltalk.send(self, "_sequence", []), "_add_", [(function($rec){smalltalk.send($rec, "_add_", [variable]);smalltalk.send($rec, "_add_", [smalltalk.send(self, "_visit_", [aNode])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRAssignment || IRAssignment), "_new", []))]);
  14. smalltalk.send(smalltalk.send(smalltalk.send(self, "_method", []), "_internalVariables", []), "_add_", [variable]);
  15. return variable;
  16. return self;},
  17. args: ["aNode"],
  18. source: "alias: aNode\x0a\x09| variable |\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",
  19. messageSends: ["variable:", "name:", "new", ",", "nextAlias", "yourself", "add:", "sequence", "visit:", "internalVariables", "method"],
  20. referencedClasses: ["AliasVar", "IRVariable", "IRAssignment"]
  21. }),
  22. smalltalk.IRASTTranslator);
  23. smalltalk.addMethod(
  24. "_method",
  25. smalltalk.method({
  26. selector: "method",
  27. category: 'accessing',
  28. fn: function () {
  29. var self=this;
  30. return self['@method'];
  31. return self;},
  32. args: [],
  33. source: "method\x0a\x09^ method",
  34. messageSends: [],
  35. referencedClasses: []
  36. }),
  37. smalltalk.IRASTTranslator);
  38. smalltalk.addMethod(
  39. "_method_",
  40. smalltalk.method({
  41. selector: "method:",
  42. category: 'accessing',
  43. fn: function (anIRMethod) {
  44. var self=this;
  45. (self['@method']=anIRMethod);
  46. return self;},
  47. args: ["anIRMethod"],
  48. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  49. messageSends: [],
  50. referencedClasses: []
  51. }),
  52. smalltalk.IRASTTranslator);
  53. smalltalk.addMethod(
  54. "_nextAlias",
  55. smalltalk.method({
  56. selector: "nextAlias",
  57. category: 'accessing',
  58. fn: function () {
  59. var self=this;
  60. (($receiver = self['@nextAlias']) == nil || $receiver == undefined) ? (function(){return (self['@nextAlias']=(0));})() : $receiver;
  61. (self['@nextAlias']=((($receiver = self['@nextAlias']).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));
  62. return smalltalk.send(self['@nextAlias'], "_asString", []);
  63. return self;},
  64. args: [],
  65. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  66. messageSends: ["ifNil:", "+", "asString"],
  67. referencedClasses: []
  68. }),
  69. smalltalk.IRASTTranslator);
  70. smalltalk.addMethod(
  71. "_sequence",
  72. smalltalk.method({
  73. selector: "sequence",
  74. category: 'accessing',
  75. fn: function () {
  76. var self=this;
  77. return self['@sequence'];
  78. return self;},
  79. args: [],
  80. source: "sequence\x0a\x09^ sequence",
  81. messageSends: [],
  82. referencedClasses: []
  83. }),
  84. smalltalk.IRASTTranslator);
  85. smalltalk.addMethod(
  86. "_sequence_",
  87. smalltalk.method({
  88. selector: "sequence:",
  89. category: 'accessing',
  90. fn: function (anIRSequence) {
  91. var self=this;
  92. (self['@sequence']=anIRSequence);
  93. return self;},
  94. args: ["anIRSequence"],
  95. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  96. messageSends: [],
  97. referencedClasses: []
  98. }),
  99. smalltalk.IRASTTranslator);
  100. smalltalk.addMethod(
  101. "_source",
  102. smalltalk.method({
  103. selector: "source",
  104. category: 'accessing',
  105. fn: function () {
  106. var self=this;
  107. return self['@source'];
  108. return self;},
  109. args: [],
  110. source: "source\x0a\x09^ source",
  111. messageSends: [],
  112. referencedClasses: []
  113. }),
  114. smalltalk.IRASTTranslator);
  115. smalltalk.addMethod(
  116. "_source_",
  117. smalltalk.method({
  118. selector: "source:",
  119. category: 'accessing',
  120. fn: function (aString) {
  121. var self=this;
  122. (self['@source']=aString);
  123. return self;},
  124. args: ["aString"],
  125. source: "source: aString\x0a\x09source := aString",
  126. messageSends: [],
  127. referencedClasses: []
  128. }),
  129. smalltalk.IRASTTranslator);
  130. smalltalk.addMethod(
  131. "_theClass",
  132. smalltalk.method({
  133. selector: "theClass",
  134. category: 'accessing',
  135. fn: function () {
  136. var self=this;
  137. return self['@theClass'];
  138. return self;},
  139. args: [],
  140. source: "theClass\x0a\x09^ theClass",
  141. messageSends: [],
  142. referencedClasses: []
  143. }),
  144. smalltalk.IRASTTranslator);
  145. smalltalk.addMethod(
  146. "_theClass_",
  147. smalltalk.method({
  148. selector: "theClass:",
  149. category: 'accessing',
  150. fn: function (aClass) {
  151. var self=this;
  152. (self['@theClass']=aClass);
  153. return self;},
  154. args: ["aClass"],
  155. source: "theClass: aClass\x0a\x09theClass := aClass",
  156. messageSends: [],
  157. referencedClasses: []
  158. }),
  159. smalltalk.IRASTTranslator);
  160. smalltalk.addMethod(
  161. "_visitAssignmentNode_",
  162. smalltalk.method({
  163. selector: "visitAssignmentNode:",
  164. category: 'visiting',
  165. fn: function (aNode) {
  166. var self=this;
  167. var left=nil;
  168. var right=nil;
  169. var assignment=nil;
  170. (right=smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_right", [])]));
  171. (left=smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_left", [])]));
  172. smalltalk.send(smalltalk.send(self, "_sequence", []), "_add_", [(function($rec){smalltalk.send($rec, "_add_", [left]);smalltalk.send($rec, "_add_", [right]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRAssignment || IRAssignment), "_new", []))]);
  173. return left;
  174. return self;},
  175. args: ["aNode"],
  176. 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",
  177. messageSends: ["visit:", "right", "left", "add:", "sequence", "yourself", "new"],
  178. referencedClasses: ["IRAssignment"]
  179. }),
  180. smalltalk.IRASTTranslator);
  181. smalltalk.addMethod(
  182. "_visitBlockNode_",
  183. smalltalk.method({
  184. selector: "visitBlockNode:",
  185. category: 'visiting',
  186. fn: function (aNode) {
  187. var self=this;
  188. var closure=nil;
  189. (closure=(function($rec){smalltalk.send($rec, "_arguments_", [smalltalk.send(aNode, "_parameters", [])]);smalltalk.send($rec, "_scope_", [smalltalk.send(aNode, "_scope", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRClosure || IRClosure), "_new", [])));
  190. smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_scope", []), "_temps", []), "_do_", [(function(each){return smalltalk.send(closure, "_add_", [(function($rec){smalltalk.send($rec, "_name_", [smalltalk.send(each, "_name", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRTempDeclaration || IRTempDeclaration), "_new", []))]);})]);
  191. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(closure, "_add_", [smalltalk.send(self, "_visit_", [each])]);})]);
  192. return closure;
  193. return self;},
  194. args: ["aNode"],
  195. 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\x09yourself) ].\x0a\x09aNode nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
  196. messageSends: ["arguments:", "parameters", "scope:", "scope", "yourself", "new", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"],
  197. referencedClasses: ["IRClosure", "IRTempDeclaration"]
  198. }),
  199. smalltalk.IRASTTranslator);
  200. smalltalk.addMethod(
  201. "_visitBlockSequenceNode_",
  202. smalltalk.method({
  203. selector: "visitBlockSequenceNode:",
  204. category: 'visiting',
  205. fn: function (aNode) {
  206. var self=this;
  207. return smalltalk.send(self, "_withSequence_do_", [smalltalk.send((smalltalk.IRBlockSequence || IRBlockSequence), "_new", []), (function(){return smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_ifNotEmpty_", [(function(){smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_allButLast", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(self, "_sequence", []), "_add_", [smalltalk.send(self, "_visit_", [each])]);})]);return ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_last", []), "_isReturnNode", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_sequence", []), "_add_", [(function($rec){smalltalk.send($rec, "_add_", [smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_last", [])])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRReturn || IRReturn), "_new", []))]);})() : (function(){return smalltalk.send(smalltalk.send(self, "_sequence", []), "_add_", [smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_last", [])])]);})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return smalltalk.send(smalltalk.send(self, "_sequence", []), "_add_", [(function($rec){smalltalk.send($rec, "_add_", [smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_last", [])])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRReturn || IRReturn), "_new", []))]);}), (function(){return smalltalk.send(smalltalk.send(self, "_sequence", []), "_add_", [smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_last", [])])]);})]));})]);})]);
  208. return self;},
  209. args: ["aNode"],
  210. 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: (IRReturn new add: (self visit: aNode nodes last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visit: aNode nodes last) ]]]",
  211. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visit:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"],
  212. referencedClasses: ["IRBlockSequence", "IRReturn"]
  213. }),
  214. smalltalk.IRASTTranslator);
  215. smalltalk.addMethod(
  216. "_visitCascadeNode_",
  217. smalltalk.method({
  218. selector: "visitCascadeNode:",
  219. category: 'visiting',
  220. fn: function (aNode) {
  221. var self=this;
  222. var alias=nil;
  223. ((($receiver = smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_isValueNode", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){(alias=smalltalk.send(self, "_alias_", [smalltalk.send(aNode, "_receiver", [])]));return smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(each, "_receiver_", [smalltalk.send(smalltalk.send((smalltalk.VariableNode || VariableNode), "_new", []), "_binding_", [smalltalk.send(alias, "_variable", [])])]);})]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){(alias=smalltalk.send(self, "_alias_", [smalltalk.send(aNode, "_receiver", [])]));return smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(each, "_receiver_", [smalltalk.send(smalltalk.send((smalltalk.VariableNode || VariableNode), "_new", []), "_binding_", [smalltalk.send(alias, "_variable", [])])]);})]);})]));
  224. smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_allButLast", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(self, "_sequence", []), "_add_", [smalltalk.send(self, "_visit_", [each])]);})]);
  225. return smalltalk.send(self, "_alias_", [smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_last", [])]);
  226. return self;},
  227. args: ["aNode"],
  228. source: "visitCascadeNode: aNode\x0a\x09| alias |\x0a\x0a\x09aNode receiver isValueNode 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",
  229. messageSends: ["ifFalse:", "isValueNode", "receiver", "alias:", "do:", "nodes", "receiver:", "binding:", "new", "variable", "allButLast", "add:", "sequence", "visit:", "last"],
  230. referencedClasses: ["VariableNode"]
  231. }),
  232. smalltalk.IRASTTranslator);
  233. smalltalk.addMethod(
  234. "_visitDynamicArrayNode_",
  235. smalltalk.method({
  236. selector: "visitDynamicArrayNode:",
  237. category: 'visiting',
  238. fn: function (aNode) {
  239. var self=this;
  240. var array=nil;
  241. (array=smalltalk.send((smalltalk.IRDynamicArray || IRDynamicArray), "_new", []));
  242. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(array, "_add_", [smalltalk.send(self, "_visit_", [each])]);})]);
  243. return array;
  244. return self;},
  245. args: ["aNode"],
  246. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09aNode nodes do: [ :each | array add: (self visit: each) ].\x0a\x09^ array",
  247. messageSends: ["new", "do:", "nodes", "add:", "visit:"],
  248. referencedClasses: ["IRDynamicArray"]
  249. }),
  250. smalltalk.IRASTTranslator);
  251. smalltalk.addMethod(
  252. "_visitDynamicDictionaryNode_",
  253. smalltalk.method({
  254. selector: "visitDynamicDictionaryNode:",
  255. category: 'visiting',
  256. fn: function (aNode) {
  257. var self=this;
  258. var dictionary=nil;
  259. (dictionary=smalltalk.send((smalltalk.IRDynamicDictionary || IRDynamicDictionary), "_new", []));
  260. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(dictionary, "_add_", [smalltalk.send(self, "_visit_", [each])]);})]);
  261. return dictionary;
  262. return self;},
  263. args: ["aNode"],
  264. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09aNode nodes do: [ :each | dictionary add: (self visit: each) ].\x0a\x09^ dictionary",
  265. messageSends: ["new", "do:", "nodes", "add:", "visit:"],
  266. referencedClasses: ["IRDynamicDictionary"]
  267. }),
  268. smalltalk.IRASTTranslator);
  269. smalltalk.addMethod(
  270. "_visitJSStatementNode_",
  271. smalltalk.method({
  272. selector: "visitJSStatementNode:",
  273. category: 'visiting',
  274. fn: function (aNode) {
  275. var self=this;
  276. return (function($rec){smalltalk.send($rec, "_source_", [smalltalk.send(aNode, "_source", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRVerbatim || IRVerbatim), "_new", []));
  277. return self;},
  278. args: ["aNode"],
  279. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source;\x0a\x09\x09yourself",
  280. messageSends: ["source:", "source", "yourself", "new"],
  281. referencedClasses: ["IRVerbatim"]
  282. }),
  283. smalltalk.IRASTTranslator);
  284. smalltalk.addMethod(
  285. "_visitMethodNode_",
  286. smalltalk.method({
  287. selector: "visitMethodNode:",
  288. category: 'visiting',
  289. fn: function (aNode) {
  290. var self=this;
  291. smalltalk.send(self, "_method_", [(function($rec){smalltalk.send($rec, "_source_", [smalltalk.send(self, "_source", [])]);smalltalk.send($rec, "_arguments_", [smalltalk.send(aNode, "_arguments", [])]);smalltalk.send($rec, "_selector_", [smalltalk.send(aNode, "_selector", [])]);smalltalk.send($rec, "_messageSends_", [smalltalk.send(aNode, "_messageSends", [])]);smalltalk.send($rec, "_classReferences_", [smalltalk.send(aNode, "_classReferences", [])]);smalltalk.send($rec, "_scope_", [smalltalk.send(aNode, "_scope", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRMethod || IRMethod), "_new", []))]);
  292. smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_scope", []), "_temps", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(self, "_method", []), "_add_", [(function($rec){smalltalk.send($rec, "_name_", [smalltalk.send(each, "_name", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRTempDeclaration || IRTempDeclaration), "_new", []))]);})]);
  293. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(self, "_method", []), "_add_", [smalltalk.send(self, "_visit_", [each])]);})]);
  294. ((($receiver = smalltalk.send(smalltalk.send(aNode, "_scope", []), "_hasLocalReturn", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_method", []), "_add_", [smalltalk.send((smalltalk.IRReturn || IRReturn), "_new", [])]), "_add_", [(function($rec){smalltalk.send($rec, "_variable_", [smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_scope", []), "_pseudoVars", []), "_at_", ["self"])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRVariable || IRVariable), "_new", []))]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_method", []), "_add_", [smalltalk.send((smalltalk.IRReturn || IRReturn), "_new", [])]), "_add_", [(function($rec){smalltalk.send($rec, "_variable_", [smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_scope", []), "_pseudoVars", []), "_at_", ["self"])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRVariable || IRVariable), "_new", []))]);})]));
  295. return smalltalk.send(self, "_method", []);
  296. return self;},
  297. args: ["aNode"],
  298. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09messageSends: aNode messageSends;\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\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",
  299. messageSends: ["method:", "source:", "source", "arguments:", "arguments", "selector:", "selector", "messageSends:", "messageSends", "classReferences:", "classReferences", "scope:", "scope", "yourself", "new", "do:", "temps", "add:", "method", "name:", "name", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"],
  300. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable"]
  301. }),
  302. smalltalk.IRASTTranslator);
  303. smalltalk.addMethod(
  304. "_visitReturnNode_",
  305. smalltalk.method({
  306. selector: "visitReturnNode:",
  307. category: 'visiting',
  308. fn: function (aNode) {
  309. var self=this;
  310. var return_=nil;
  311. (return_=((($receiver = smalltalk.send(aNode, "_nonLocalReturn", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send((smalltalk.IRNonLocalReturn || IRNonLocalReturn), "_new", []);})() : (function(){return smalltalk.send((smalltalk.IRReturn || IRReturn), "_new", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send((smalltalk.IRNonLocalReturn || IRNonLocalReturn), "_new", []);}), (function(){return smalltalk.send((smalltalk.IRReturn || IRReturn), "_new", []);})])));
  312. smalltalk.send(return_, "_scope_", [smalltalk.send(aNode, "_scope", [])]);
  313. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(return_, "_add_", [smalltalk.send(self, "_visit_", [each])]);})]);
  314. return return_;
  315. return self;},
  316. args: ["aNode"],
  317. 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 visit: each) ].\x0a\x09^ return",
  318. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "visit:"],
  319. referencedClasses: ["IRNonLocalReturn", "IRReturn"]
  320. }),
  321. smalltalk.IRASTTranslator);
  322. smalltalk.addMethod(
  323. "_visitSendNode_",
  324. smalltalk.method({
  325. selector: "visitSendNode:",
  326. category: 'visiting',
  327. fn: function (aNode) {
  328. var self=this;
  329. var send=nil;
  330. var receiver=nil;
  331. var arguments=nil;
  332. (send=smalltalk.send((smalltalk.IRSend || IRSend), "_new", []));
  333. (function($rec){smalltalk.send($rec, "_selector_", [smalltalk.send(aNode, "_selector", [])]);return smalltalk.send($rec, "_index_", [smalltalk.send(aNode, "_index", [])]);})(send);
  334. ((($receiver = smalltalk.send(aNode, "_superSend", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(send, "_classSend_", [smalltalk.send(smalltalk.send(self, "_theClass", []), "_superclass", [])]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(send, "_classSend_", [smalltalk.send(smalltalk.send(self, "_theClass", []), "_superclass", [])]);})]));
  335. (receiver=((($receiver = smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_shouldBeInlined", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_alias_", [smalltalk.send(aNode, "_receiver", [])]);})() : (function(){return smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_receiver", [])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self, "_alias_", [smalltalk.send(aNode, "_receiver", [])]);}), (function(){return smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_receiver", [])]);})])));
  336. (arguments=smalltalk.send(smalltalk.send(aNode, "_arguments", []), "_collect_", [(function(each){return ((($receiver = smalltalk.send(each, "_shouldBeInlined", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_alias_", [each]);})() : (function(){return smalltalk.send(self, "_visit_", [each]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self, "_alias_", [each]);}), (function(){return smalltalk.send(self, "_visit_", [each]);})]));})]));
  337. smalltalk.send(send, "_add_", [receiver]);
  338. smalltalk.send(arguments, "_do_", [(function(each){return smalltalk.send(send, "_add_", [each]);})]);
  339. return send;
  340. return self;},
  341. args: ["aNode"],
  342. source: "visitSendNode: aNode\x0a\x09| send 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\x0a\x09receiver := aNode receiver shouldBeInlined \x0a\x09\x09ifTrue: [ self alias: aNode receiver ]\x0a\x09\x09ifFalse: [ self visit: aNode receiver ].\x0a\x0a\x09arguments := aNode arguments collect: [ :each | \x0a\x09\x09each shouldBeInlined\x0a\x09\x09\x09ifTrue: [ self alias: each ]\x0a\x09\x09\x09ifFalse: [ self visit: each ]].\x0a\x0a\x09send add: receiver.\x0a\x09arguments do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  343. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "ifTrue:ifFalse:", "shouldBeInlined", "receiver", "alias:", "visit:", "collect:", "arguments", "add:", "do:"],
  344. referencedClasses: ["IRSend"]
  345. }),
  346. smalltalk.IRASTTranslator);
  347. smalltalk.addMethod(
  348. "_visitSequenceNode_",
  349. smalltalk.method({
  350. selector: "visitSequenceNode:",
  351. category: 'visiting',
  352. fn: function (aNode) {
  353. var self=this;
  354. return smalltalk.send(self, "_withSequence_do_", [smalltalk.send((smalltalk.IRSequence || IRSequence), "_new", []), (function(){return smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){var instruction=nil;
  355. (instruction=smalltalk.send(self, "_visit_", [each]));return ((($receiver = smalltalk.send(instruction, "_isVariable", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_sequence", []), "_add_", [instruction]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_sequence", []), "_add_", [instruction]);})]));})]);})]);
  356. return self;},
  357. args: ["aNode"],
  358. source: "visitSequenceNode: aNode\x0a\x09^ self \x0a\x09\x09withSequence: IRSequence new \x09\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 ]]]",
  359. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visit:", "ifFalse:", "isVariable", "add:", "sequence"],
  360. referencedClasses: ["IRSequence"]
  361. }),
  362. smalltalk.IRASTTranslator);
  363. smalltalk.addMethod(
  364. "_visitValueNode_",
  365. smalltalk.method({
  366. selector: "visitValueNode:",
  367. category: 'visiting',
  368. fn: function (aNode) {
  369. var self=this;
  370. return (function($rec){smalltalk.send($rec, "_value_", [smalltalk.send(aNode, "_value", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRValue || IRValue), "_new", []));
  371. return self;},
  372. args: ["aNode"],
  373. source: "visitValueNode: aNode\x0a\x09^ IRValue new \x0a\x09\x09value: aNode value; \x0a\x09\x09yourself",
  374. messageSends: ["value:", "value", "yourself", "new"],
  375. referencedClasses: ["IRValue"]
  376. }),
  377. smalltalk.IRASTTranslator);
  378. smalltalk.addMethod(
  379. "_visitVariableNode_",
  380. smalltalk.method({
  381. selector: "visitVariableNode:",
  382. category: 'visiting',
  383. fn: function (aNode) {
  384. var self=this;
  385. return (function($rec){smalltalk.send($rec, "_variable_", [smalltalk.send(aNode, "_binding", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRVariable || IRVariable), "_new", []));
  386. return self;},
  387. args: ["aNode"],
  388. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new \x0a\x09\x09variable: aNode binding; \x0a\x09\x09yourself",
  389. messageSends: ["variable:", "binding", "yourself", "new"],
  390. referencedClasses: ["IRVariable"]
  391. }),
  392. smalltalk.IRASTTranslator);
  393. smalltalk.addMethod(
  394. "_withSequence_do_",
  395. smalltalk.method({
  396. selector: "withSequence:do:",
  397. category: 'accessing',
  398. fn: function (aSequence, aBlock) {
  399. var self=this;
  400. var outerSequence=nil;
  401. (outerSequence=smalltalk.send(self, "_sequence", []));
  402. smalltalk.send(self, "_sequence_", [aSequence]);
  403. smalltalk.send(aBlock, "_value", []);
  404. smalltalk.send(self, "_sequence_", [outerSequence]);
  405. return aSequence;
  406. return self;},
  407. args: ["aSequence", "aBlock"],
  408. 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",
  409. messageSends: ["sequence", "sequence:", "value"],
  410. referencedClasses: []
  411. }),
  412. smalltalk.IRASTTranslator);
  413. smalltalk.addClass('IRInstruction', smalltalk.Object, ['parent', 'instructions'], 'Compiler-IR');
  414. 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. "
  415. smalltalk.addMethod(
  416. "_accept_",
  417. smalltalk.method({
  418. selector: "accept:",
  419. category: 'visiting',
  420. fn: function (aVisitor) {
  421. var self=this;
  422. return smalltalk.send(aVisitor, "_visitIRInstruction_", [self]);
  423. return self;},
  424. args: ["aVisitor"],
  425. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  426. messageSends: ["visitIRInstruction:"],
  427. referencedClasses: []
  428. }),
  429. smalltalk.IRInstruction);
  430. smalltalk.addMethod(
  431. "_add_",
  432. smalltalk.method({
  433. selector: "add:",
  434. category: 'building',
  435. fn: function (anObject) {
  436. var self=this;
  437. smalltalk.send(anObject, "_parent_", [self]);
  438. return smalltalk.send(smalltalk.send(self, "_instructions", []), "_add_", [anObject]);
  439. return self;},
  440. args: ["anObject"],
  441. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  442. messageSends: ["parent:", "add:", "instructions"],
  443. referencedClasses: []
  444. }),
  445. smalltalk.IRInstruction);
  446. smalltalk.addMethod(
  447. "_canBeAssigned",
  448. smalltalk.method({
  449. selector: "canBeAssigned",
  450. category: 'testing',
  451. fn: function () {
  452. var self=this;
  453. return true;
  454. return self;},
  455. args: [],
  456. source: "canBeAssigned\x0a\x09^ true",
  457. messageSends: [],
  458. referencedClasses: []
  459. }),
  460. smalltalk.IRInstruction);
  461. smalltalk.addMethod(
  462. "_instructions",
  463. smalltalk.method({
  464. selector: "instructions",
  465. category: 'accessing',
  466. fn: function () {
  467. var self=this;
  468. return (($receiver = self['@instructions']) == nil || $receiver == undefined) ? (function(){return (self['@instructions']=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection), "_new", []));})() : $receiver;
  469. return self;},
  470. args: [],
  471. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  472. messageSends: ["ifNil:", "new"],
  473. referencedClasses: ["OrderedCollection"]
  474. }),
  475. smalltalk.IRInstruction);
  476. smalltalk.addMethod(
  477. "_isClosure",
  478. smalltalk.method({
  479. selector: "isClosure",
  480. category: 'testing',
  481. fn: function () {
  482. var self=this;
  483. return false;
  484. return self;},
  485. args: [],
  486. source: "isClosure\x0a\x09^ false",
  487. messageSends: [],
  488. referencedClasses: []
  489. }),
  490. smalltalk.IRInstruction);
  491. smalltalk.addMethod(
  492. "_isInlined",
  493. smalltalk.method({
  494. selector: "isInlined",
  495. category: 'testing',
  496. fn: function () {
  497. var self=this;
  498. return false;
  499. return self;},
  500. args: [],
  501. source: "isInlined\x0a\x09^ false",
  502. messageSends: [],
  503. referencedClasses: []
  504. }),
  505. smalltalk.IRInstruction);
  506. smalltalk.addMethod(
  507. "_isLocalReturn",
  508. smalltalk.method({
  509. selector: "isLocalReturn",
  510. category: 'testing',
  511. fn: function () {
  512. var self=this;
  513. return false;
  514. return self;},
  515. args: [],
  516. source: "isLocalReturn\x0a\x09^ false",
  517. messageSends: [],
  518. referencedClasses: []
  519. }),
  520. smalltalk.IRInstruction);
  521. smalltalk.addMethod(
  522. "_isReturn",
  523. smalltalk.method({
  524. selector: "isReturn",
  525. category: 'testing',
  526. fn: function () {
  527. var self=this;
  528. return false;
  529. return self;},
  530. args: [],
  531. source: "isReturn\x0a\x09^ false",
  532. messageSends: [],
  533. referencedClasses: []
  534. }),
  535. smalltalk.IRInstruction);
  536. smalltalk.addMethod(
  537. "_isSend",
  538. smalltalk.method({
  539. selector: "isSend",
  540. category: 'testing',
  541. fn: function () {
  542. var self=this;
  543. return false;
  544. return self;},
  545. args: [],
  546. source: "isSend\x0a\x09^ false",
  547. messageSends: [],
  548. referencedClasses: []
  549. }),
  550. smalltalk.IRInstruction);
  551. smalltalk.addMethod(
  552. "_isSequence",
  553. smalltalk.method({
  554. selector: "isSequence",
  555. category: 'testing',
  556. fn: function () {
  557. var self=this;
  558. return false;
  559. return self;},
  560. args: [],
  561. source: "isSequence\x0a\x09^ false",
  562. messageSends: [],
  563. referencedClasses: []
  564. }),
  565. smalltalk.IRInstruction);
  566. smalltalk.addMethod(
  567. "_isTempDeclaration",
  568. smalltalk.method({
  569. selector: "isTempDeclaration",
  570. category: 'testing',
  571. fn: function () {
  572. var self=this;
  573. return false;
  574. return self;},
  575. args: [],
  576. source: "isTempDeclaration\x0a\x09^ false",
  577. messageSends: [],
  578. referencedClasses: []
  579. }),
  580. smalltalk.IRInstruction);
  581. smalltalk.addMethod(
  582. "_isVariable",
  583. smalltalk.method({
  584. selector: "isVariable",
  585. category: 'testing',
  586. fn: function () {
  587. var self=this;
  588. return false;
  589. return self;},
  590. args: [],
  591. source: "isVariable\x0a\x09^ false",
  592. messageSends: [],
  593. referencedClasses: []
  594. }),
  595. smalltalk.IRInstruction);
  596. smalltalk.addMethod(
  597. "_parent",
  598. smalltalk.method({
  599. selector: "parent",
  600. category: 'accessing',
  601. fn: function () {
  602. var self=this;
  603. return self['@parent'];
  604. return self;},
  605. args: [],
  606. source: "parent\x0a\x09^ parent",
  607. messageSends: [],
  608. referencedClasses: []
  609. }),
  610. smalltalk.IRInstruction);
  611. smalltalk.addMethod(
  612. "_parent_",
  613. smalltalk.method({
  614. selector: "parent:",
  615. category: 'accessing',
  616. fn: function (anIRInstruction) {
  617. var self=this;
  618. (self['@parent']=anIRInstruction);
  619. return self;},
  620. args: ["anIRInstruction"],
  621. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  622. messageSends: [],
  623. referencedClasses: []
  624. }),
  625. smalltalk.IRInstruction);
  626. smalltalk.addMethod(
  627. "_remove",
  628. smalltalk.method({
  629. selector: "remove",
  630. category: 'building',
  631. fn: function () {
  632. var self=this;
  633. smalltalk.send(smalltalk.send(self, "_parent", []), "_remove_", [self]);
  634. return self;},
  635. args: [],
  636. source: "remove\x0a\x09self parent remove: self",
  637. messageSends: ["remove:", "parent"],
  638. referencedClasses: []
  639. }),
  640. smalltalk.IRInstruction);
  641. smalltalk.addMethod(
  642. "_remove_",
  643. smalltalk.method({
  644. selector: "remove:",
  645. category: 'building',
  646. fn: function (anIRInstruction) {
  647. var self=this;
  648. smalltalk.send(smalltalk.send(self, "_instructions", []), "_remove_", [anIRInstruction]);
  649. return self;},
  650. args: ["anIRInstruction"],
  651. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  652. messageSends: ["remove:", "instructions"],
  653. referencedClasses: []
  654. }),
  655. smalltalk.IRInstruction);
  656. smalltalk.addMethod(
  657. "_replace_with_",
  658. smalltalk.method({
  659. selector: "replace:with:",
  660. category: 'building',
  661. fn: function (anIRInstruction, anotherIRInstruction) {
  662. var self=this;
  663. smalltalk.send(anotherIRInstruction, "_parent_", [self]);
  664. smalltalk.send(smalltalk.send(self, "_instructions", []), "_at_put_", [smalltalk.send(smalltalk.send(self, "_instructions", []), "_indexOf_", [anIRInstruction]), anotherIRInstruction]);
  665. return self;},
  666. args: ["anIRInstruction", "anotherIRInstruction"],
  667. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions \x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  668. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"],
  669. referencedClasses: []
  670. }),
  671. smalltalk.IRInstruction);
  672. smalltalk.addMethod(
  673. "_replaceWith_",
  674. smalltalk.method({
  675. selector: "replaceWith:",
  676. category: 'building',
  677. fn: function (anIRInstruction) {
  678. var self=this;
  679. smalltalk.send(smalltalk.send(self, "_parent", []), "_replace_with_", [self, anIRInstruction]);
  680. return self;},
  681. args: ["anIRInstruction"],
  682. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  683. messageSends: ["replace:with:", "parent"],
  684. referencedClasses: []
  685. }),
  686. smalltalk.IRInstruction);
  687. smalltalk.addMethod(
  688. "_on_",
  689. smalltalk.method({
  690. selector: "on:",
  691. category: 'instance creation',
  692. fn: function (aBuilder) {
  693. var self=this;
  694. return (function($rec){smalltalk.send($rec, "_builder_", [aBuilder]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  695. return self;},
  696. args: ["aBuilder"],
  697. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  698. messageSends: ["builder:", "yourself", "new"],
  699. referencedClasses: []
  700. }),
  701. smalltalk.IRInstruction.klass);
  702. smalltalk.addClass('IRAssignment', smalltalk.IRInstruction, [], 'Compiler-IR');
  703. smalltalk.addMethod(
  704. "_accept_",
  705. smalltalk.method({
  706. selector: "accept:",
  707. category: 'visiting',
  708. fn: function (aVisitor) {
  709. var self=this;
  710. return smalltalk.send(aVisitor, "_visitIRAssignment_", [self]);
  711. return self;},
  712. args: ["aVisitor"],
  713. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  714. messageSends: ["visitIRAssignment:"],
  715. referencedClasses: []
  716. }),
  717. smalltalk.IRAssignment);
  718. smalltalk.addClass('IRDynamicArray', smalltalk.IRInstruction, [], 'Compiler-IR');
  719. smalltalk.addMethod(
  720. "_accept_",
  721. smalltalk.method({
  722. selector: "accept:",
  723. category: 'visiting',
  724. fn: function (aVisitor) {
  725. var self=this;
  726. return smalltalk.send(aVisitor, "_visitIRDynamicArray_", [self]);
  727. return self;},
  728. args: ["aVisitor"],
  729. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  730. messageSends: ["visitIRDynamicArray:"],
  731. referencedClasses: []
  732. }),
  733. smalltalk.IRDynamicArray);
  734. smalltalk.addClass('IRDynamicDictionary', smalltalk.IRInstruction, [], 'Compiler-IR');
  735. smalltalk.addMethod(
  736. "_accept_",
  737. smalltalk.method({
  738. selector: "accept:",
  739. category: 'visiting',
  740. fn: function (aVisitor) {
  741. var self=this;
  742. return smalltalk.send(aVisitor, "_visitIRDynamicDictionary_", [self]);
  743. return self;},
  744. args: ["aVisitor"],
  745. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  746. messageSends: ["visitIRDynamicDictionary:"],
  747. referencedClasses: []
  748. }),
  749. smalltalk.IRDynamicDictionary);
  750. smalltalk.addClass('IRScopedInstruction', smalltalk.IRInstruction, ['scope'], 'Compiler-IR');
  751. smalltalk.addMethod(
  752. "_scope",
  753. smalltalk.method({
  754. selector: "scope",
  755. category: 'accessing',
  756. fn: function () {
  757. var self=this;
  758. return self['@scope'];
  759. return self;},
  760. args: [],
  761. source: "scope\x0a\x09^ scope",
  762. messageSends: [],
  763. referencedClasses: []
  764. }),
  765. smalltalk.IRScopedInstruction);
  766. smalltalk.addMethod(
  767. "_scope_",
  768. smalltalk.method({
  769. selector: "scope:",
  770. category: 'accessing',
  771. fn: function (aScope) {
  772. var self=this;
  773. (self['@scope']=aScope);
  774. return self;},
  775. args: ["aScope"],
  776. source: "scope: aScope\x0a\x09scope := aScope",
  777. messageSends: [],
  778. referencedClasses: []
  779. }),
  780. smalltalk.IRScopedInstruction);
  781. smalltalk.addClass('IRClosure', smalltalk.IRScopedInstruction, ['arguments'], 'Compiler-IR');
  782. smalltalk.addMethod(
  783. "_accept_",
  784. smalltalk.method({
  785. selector: "accept:",
  786. category: 'visiting',
  787. fn: function (aVisitor) {
  788. var self=this;
  789. return smalltalk.send(aVisitor, "_visitIRClosure_", [self]);
  790. return self;},
  791. args: ["aVisitor"],
  792. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  793. messageSends: ["visitIRClosure:"],
  794. referencedClasses: []
  795. }),
  796. smalltalk.IRClosure);
  797. smalltalk.addMethod(
  798. "_arguments",
  799. smalltalk.method({
  800. selector: "arguments",
  801. category: 'accessing',
  802. fn: function () {
  803. var self=this;
  804. return (($receiver = self['@arguments']) == nil || $receiver == undefined) ? (function(){return [];})() : $receiver;
  805. return self;},
  806. args: [],
  807. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  808. messageSends: ["ifNil:"],
  809. referencedClasses: []
  810. }),
  811. smalltalk.IRClosure);
  812. smalltalk.addMethod(
  813. "_arguments_",
  814. smalltalk.method({
  815. selector: "arguments:",
  816. category: 'accessing',
  817. fn: function (aCollection) {
  818. var self=this;
  819. (self['@arguments']=aCollection);
  820. return self;},
  821. args: ["aCollection"],
  822. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  823. messageSends: [],
  824. referencedClasses: []
  825. }),
  826. smalltalk.IRClosure);
  827. smalltalk.addMethod(
  828. "_isClosure",
  829. smalltalk.method({
  830. selector: "isClosure",
  831. category: 'testing',
  832. fn: function () {
  833. var self=this;
  834. return true;
  835. return self;},
  836. args: [],
  837. source: "isClosure\x0a\x09^ true",
  838. messageSends: [],
  839. referencedClasses: []
  840. }),
  841. smalltalk.IRClosure);
  842. smalltalk.addMethod(
  843. "_scope_",
  844. smalltalk.method({
  845. selector: "scope:",
  846. category: 'accessing',
  847. fn: function (aScope) {
  848. var self=this;
  849. smalltalk.send(self, "_scope_", [aScope], smalltalk.IRClosure.superclass || nil);
  850. smalltalk.send(aScope, "_instruction_", [self]);
  851. return self;},
  852. args: ["aScope"],
  853. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  854. messageSends: ["scope:", "instruction:"],
  855. referencedClasses: []
  856. }),
  857. smalltalk.IRClosure);
  858. smalltalk.addMethod(
  859. "_sequence",
  860. smalltalk.method({
  861. selector: "sequence",
  862. category: 'accessing',
  863. fn: function () {
  864. var self=this;
  865. return smalltalk.send(smalltalk.send(self, "_instructions", []), "_last", []);
  866. return self;},
  867. args: [],
  868. source: "sequence\x0a\x09^ self instructions last",
  869. messageSends: ["last", "instructions"],
  870. referencedClasses: []
  871. }),
  872. smalltalk.IRClosure);
  873. smalltalk.addClass('IRMethod', smalltalk.IRScopedInstruction, ['source', 'selector', 'classReferences', 'messageSends', 'arguments', 'internalVariables'], 'Compiler-IR');
  874. smalltalk.IRMethod.comment="I am a method instruction"
  875. smalltalk.addMethod(
  876. "_accept_",
  877. smalltalk.method({
  878. selector: "accept:",
  879. category: 'visiting',
  880. fn: function (aVisitor) {
  881. var self=this;
  882. return smalltalk.send(aVisitor, "_visitIRMethod_", [self]);
  883. return self;},
  884. args: ["aVisitor"],
  885. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  886. messageSends: ["visitIRMethod:"],
  887. referencedClasses: []
  888. }),
  889. smalltalk.IRMethod);
  890. smalltalk.addMethod(
  891. "_arguments",
  892. smalltalk.method({
  893. selector: "arguments",
  894. category: 'accessing',
  895. fn: function () {
  896. var self=this;
  897. return self['@arguments'];
  898. return self;},
  899. args: [],
  900. source: "arguments\x0a\x09^ arguments",
  901. messageSends: [],
  902. referencedClasses: []
  903. }),
  904. smalltalk.IRMethod);
  905. smalltalk.addMethod(
  906. "_arguments_",
  907. smalltalk.method({
  908. selector: "arguments:",
  909. category: 'accessing',
  910. fn: function (aCollection) {
  911. var self=this;
  912. (self['@arguments']=aCollection);
  913. return self;},
  914. args: ["aCollection"],
  915. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  916. messageSends: [],
  917. referencedClasses: []
  918. }),
  919. smalltalk.IRMethod);
  920. smalltalk.addMethod(
  921. "_classReferences",
  922. smalltalk.method({
  923. selector: "classReferences",
  924. category: 'accessing',
  925. fn: function () {
  926. var self=this;
  927. return self['@classReferences'];
  928. return self;},
  929. args: [],
  930. source: "classReferences\x0a\x09^ classReferences",
  931. messageSends: [],
  932. referencedClasses: []
  933. }),
  934. smalltalk.IRMethod);
  935. smalltalk.addMethod(
  936. "_classReferences_",
  937. smalltalk.method({
  938. selector: "classReferences:",
  939. category: 'accessing',
  940. fn: function (aCollection) {
  941. var self=this;
  942. (self['@classReferences']=aCollection);
  943. return self;},
  944. args: ["aCollection"],
  945. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  946. messageSends: [],
  947. referencedClasses: []
  948. }),
  949. smalltalk.IRMethod);
  950. smalltalk.addMethod(
  951. "_internalVariables",
  952. smalltalk.method({
  953. selector: "internalVariables",
  954. category: 'accessing',
  955. fn: function () {
  956. var self=this;
  957. return (($receiver = self['@internalVariables']) == nil || $receiver == undefined) ? (function(){return (self['@internalVariables']=smalltalk.send((smalltalk.Set || Set), "_new", []));})() : $receiver;
  958. return self;},
  959. args: [],
  960. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  961. messageSends: ["ifNil:", "new"],
  962. referencedClasses: ["Set"]
  963. }),
  964. smalltalk.IRMethod);
  965. smalltalk.addMethod(
  966. "_messageSends",
  967. smalltalk.method({
  968. selector: "messageSends",
  969. category: 'accessing',
  970. fn: function () {
  971. var self=this;
  972. return self['@messageSends'];
  973. return self;},
  974. args: [],
  975. source: "messageSends\x0a\x09^ messageSends",
  976. messageSends: [],
  977. referencedClasses: []
  978. }),
  979. smalltalk.IRMethod);
  980. smalltalk.addMethod(
  981. "_messageSends_",
  982. smalltalk.method({
  983. selector: "messageSends:",
  984. category: 'accessing',
  985. fn: function (aCollection) {
  986. var self=this;
  987. (self['@messageSends']=aCollection);
  988. return self;},
  989. args: ["aCollection"],
  990. source: "messageSends: aCollection\x0a\x09messageSends := aCollection",
  991. messageSends: [],
  992. referencedClasses: []
  993. }),
  994. smalltalk.IRMethod);
  995. smalltalk.addMethod(
  996. "_scope_",
  997. smalltalk.method({
  998. selector: "scope:",
  999. category: 'accessing',
  1000. fn: function (aScope) {
  1001. var self=this;
  1002. smalltalk.send(self, "_scope_", [aScope], smalltalk.IRMethod.superclass || nil);
  1003. smalltalk.send(aScope, "_instruction_", [self]);
  1004. return self;},
  1005. args: ["aScope"],
  1006. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  1007. messageSends: ["scope:", "instruction:"],
  1008. referencedClasses: []
  1009. }),
  1010. smalltalk.IRMethod);
  1011. smalltalk.addMethod(
  1012. "_selector",
  1013. smalltalk.method({
  1014. selector: "selector",
  1015. category: 'accessing',
  1016. fn: function () {
  1017. var self=this;
  1018. return self['@selector'];
  1019. return self;},
  1020. args: [],
  1021. source: "selector\x0a\x09^ selector",
  1022. messageSends: [],
  1023. referencedClasses: []
  1024. }),
  1025. smalltalk.IRMethod);
  1026. smalltalk.addMethod(
  1027. "_selector_",
  1028. smalltalk.method({
  1029. selector: "selector:",
  1030. category: 'accessing',
  1031. fn: function (aString) {
  1032. var self=this;
  1033. (self['@selector']=aString);
  1034. return self;},
  1035. args: ["aString"],
  1036. source: "selector: aString\x0a\x09selector := aString",
  1037. messageSends: [],
  1038. referencedClasses: []
  1039. }),
  1040. smalltalk.IRMethod);
  1041. smalltalk.addMethod(
  1042. "_source",
  1043. smalltalk.method({
  1044. selector: "source",
  1045. category: 'accessing',
  1046. fn: function () {
  1047. var self=this;
  1048. return self['@source'];
  1049. return self;},
  1050. args: [],
  1051. source: "source\x0a\x09^ source",
  1052. messageSends: [],
  1053. referencedClasses: []
  1054. }),
  1055. smalltalk.IRMethod);
  1056. smalltalk.addMethod(
  1057. "_source_",
  1058. smalltalk.method({
  1059. selector: "source:",
  1060. category: 'accessing',
  1061. fn: function (aString) {
  1062. var self=this;
  1063. (self['@source']=aString);
  1064. return self;},
  1065. args: ["aString"],
  1066. source: "source: aString\x0a\x09source := aString",
  1067. messageSends: [],
  1068. referencedClasses: []
  1069. }),
  1070. smalltalk.IRMethod);
  1071. smalltalk.addClass('IRReturn', smalltalk.IRScopedInstruction, [], 'Compiler-IR');
  1072. smalltalk.IRReturn.comment="I am a local return instruction."
  1073. smalltalk.addMethod(
  1074. "_accept_",
  1075. smalltalk.method({
  1076. selector: "accept:",
  1077. category: 'visiting',
  1078. fn: function (aVisitor) {
  1079. var self=this;
  1080. return smalltalk.send(aVisitor, "_visitIRReturn_", [self]);
  1081. return self;},
  1082. args: ["aVisitor"],
  1083. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  1084. messageSends: ["visitIRReturn:"],
  1085. referencedClasses: []
  1086. }),
  1087. smalltalk.IRReturn);
  1088. smalltalk.addMethod(
  1089. "_canBeAssigned",
  1090. smalltalk.method({
  1091. selector: "canBeAssigned",
  1092. category: 'testing',
  1093. fn: function () {
  1094. var self=this;
  1095. return false;
  1096. return self;},
  1097. args: [],
  1098. source: "canBeAssigned\x0a\x09^ false",
  1099. messageSends: [],
  1100. referencedClasses: []
  1101. }),
  1102. smalltalk.IRReturn);
  1103. smalltalk.addMethod(
  1104. "_isLocalReturn",
  1105. smalltalk.method({
  1106. selector: "isLocalReturn",
  1107. category: 'testing',
  1108. fn: function () {
  1109. var self=this;
  1110. return smalltalk.send(self, "_isReturn", []);
  1111. return self;},
  1112. args: [],
  1113. source: "isLocalReturn\x0a\x09^ self isReturn",
  1114. messageSends: ["isReturn"],
  1115. referencedClasses: []
  1116. }),
  1117. smalltalk.IRReturn);
  1118. smalltalk.addMethod(
  1119. "_isNonLocalReturn",
  1120. smalltalk.method({
  1121. selector: "isNonLocalReturn",
  1122. category: 'testing',
  1123. fn: function () {
  1124. var self=this;
  1125. return smalltalk.send(smalltalk.send(self, "_isLocalReturn", []), "_not", []);
  1126. return self;},
  1127. args: [],
  1128. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  1129. messageSends: ["not", "isLocalReturn"],
  1130. referencedClasses: []
  1131. }),
  1132. smalltalk.IRReturn);
  1133. smalltalk.addMethod(
  1134. "_isReturn",
  1135. smalltalk.method({
  1136. selector: "isReturn",
  1137. category: 'testing',
  1138. fn: function () {
  1139. var self=this;
  1140. return true;
  1141. return self;},
  1142. args: [],
  1143. source: "isReturn\x0a\x09^ true",
  1144. messageSends: [],
  1145. referencedClasses: []
  1146. }),
  1147. smalltalk.IRReturn);
  1148. smalltalk.addClass('IRNonLocalReturn', smalltalk.IRReturn, [], 'Compiler-IR');
  1149. 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"
  1150. smalltalk.addMethod(
  1151. "_accept_",
  1152. smalltalk.method({
  1153. selector: "accept:",
  1154. category: 'visiting',
  1155. fn: function (aVisitor) {
  1156. var self=this;
  1157. return smalltalk.send(aVisitor, "_visitIRNonLocalReturn_", [self]);
  1158. return self;},
  1159. args: ["aVisitor"],
  1160. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  1161. messageSends: ["visitIRNonLocalReturn:"],
  1162. referencedClasses: []
  1163. }),
  1164. smalltalk.IRNonLocalReturn);
  1165. smalltalk.addMethod(
  1166. "_isLocalReturn",
  1167. smalltalk.method({
  1168. selector: "isLocalReturn",
  1169. category: 'testing',
  1170. fn: function () {
  1171. var self=this;
  1172. return false;
  1173. return self;},
  1174. args: [],
  1175. source: "isLocalReturn\x0a\x09^ false",
  1176. messageSends: [],
  1177. referencedClasses: []
  1178. }),
  1179. smalltalk.IRNonLocalReturn);
  1180. smalltalk.addClass('IRSend', smalltalk.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  1181. smalltalk.IRSend.comment="I am a message send instruction. "
  1182. smalltalk.addMethod(
  1183. "_accept_",
  1184. smalltalk.method({
  1185. selector: "accept:",
  1186. category: 'visiting',
  1187. fn: function (aVisitor) {
  1188. var self=this;
  1189. return smalltalk.send(aVisitor, "_visitIRSend_", [self]);
  1190. return self;},
  1191. args: ["aVisitor"],
  1192. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  1193. messageSends: ["visitIRSend:"],
  1194. referencedClasses: []
  1195. }),
  1196. smalltalk.IRSend);
  1197. smalltalk.addMethod(
  1198. "_classSend",
  1199. smalltalk.method({
  1200. selector: "classSend",
  1201. category: 'accessing',
  1202. fn: function () {
  1203. var self=this;
  1204. return self['@classSend'];
  1205. return self;},
  1206. args: [],
  1207. source: "classSend\x0a\x09^ classSend",
  1208. messageSends: [],
  1209. referencedClasses: []
  1210. }),
  1211. smalltalk.IRSend);
  1212. smalltalk.addMethod(
  1213. "_classSend_",
  1214. smalltalk.method({
  1215. selector: "classSend:",
  1216. category: 'accessing',
  1217. fn: function (aClass) {
  1218. var self=this;
  1219. (self['@classSend']=aClass);
  1220. return self;},
  1221. args: ["aClass"],
  1222. source: "classSend: aClass\x0a\x09classSend := aClass",
  1223. messageSends: [],
  1224. referencedClasses: []
  1225. }),
  1226. smalltalk.IRSend);
  1227. smalltalk.addMethod(
  1228. "_index",
  1229. smalltalk.method({
  1230. selector: "index",
  1231. category: 'accessing',
  1232. fn: function () {
  1233. var self=this;
  1234. return self['@index'];
  1235. return self;},
  1236. args: [],
  1237. source: "index\x0a\x09^ index",
  1238. messageSends: [],
  1239. referencedClasses: []
  1240. }),
  1241. smalltalk.IRSend);
  1242. smalltalk.addMethod(
  1243. "_index_",
  1244. smalltalk.method({
  1245. selector: "index:",
  1246. category: 'accessing',
  1247. fn: function (anInteger) {
  1248. var self=this;
  1249. (self['@index']=anInteger);
  1250. return self;},
  1251. args: ["anInteger"],
  1252. source: "index: anInteger\x0a\x09index := anInteger",
  1253. messageSends: [],
  1254. referencedClasses: []
  1255. }),
  1256. smalltalk.IRSend);
  1257. smalltalk.addMethod(
  1258. "_isSend",
  1259. smalltalk.method({
  1260. selector: "isSend",
  1261. category: 'testing',
  1262. fn: function () {
  1263. var self=this;
  1264. return true;
  1265. return self;},
  1266. args: [],
  1267. source: "isSend\x0a\x09^ true",
  1268. messageSends: [],
  1269. referencedClasses: []
  1270. }),
  1271. smalltalk.IRSend);
  1272. smalltalk.addMethod(
  1273. "_selector",
  1274. smalltalk.method({
  1275. selector: "selector",
  1276. category: 'accessing',
  1277. fn: function () {
  1278. var self=this;
  1279. return self['@selector'];
  1280. return self;},
  1281. args: [],
  1282. source: "selector\x0a\x09^ selector",
  1283. messageSends: [],
  1284. referencedClasses: []
  1285. }),
  1286. smalltalk.IRSend);
  1287. smalltalk.addMethod(
  1288. "_selector_",
  1289. smalltalk.method({
  1290. selector: "selector:",
  1291. category: 'accessing',
  1292. fn: function (aString) {
  1293. var self=this;
  1294. (self['@selector']=aString);
  1295. return self;},
  1296. args: ["aString"],
  1297. source: "selector: aString\x0a\x09selector := aString",
  1298. messageSends: [],
  1299. referencedClasses: []
  1300. }),
  1301. smalltalk.IRSend);
  1302. smalltalk.addClass('IRSequence', smalltalk.IRInstruction, [], 'Compiler-IR');
  1303. smalltalk.addMethod(
  1304. "_accept_",
  1305. smalltalk.method({
  1306. selector: "accept:",
  1307. category: 'visiting',
  1308. fn: function (aVisitor) {
  1309. var self=this;
  1310. return smalltalk.send(aVisitor, "_visitIRSequence_", [self]);
  1311. return self;},
  1312. args: ["aVisitor"],
  1313. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  1314. messageSends: ["visitIRSequence:"],
  1315. referencedClasses: []
  1316. }),
  1317. smalltalk.IRSequence);
  1318. smalltalk.addMethod(
  1319. "_isSequence",
  1320. smalltalk.method({
  1321. selector: "isSequence",
  1322. category: 'testing',
  1323. fn: function () {
  1324. var self=this;
  1325. return true;
  1326. return self;},
  1327. args: [],
  1328. source: "isSequence\x0a\x09^ true",
  1329. messageSends: [],
  1330. referencedClasses: []
  1331. }),
  1332. smalltalk.IRSequence);
  1333. smalltalk.addClass('IRBlockSequence', smalltalk.IRSequence, [], 'Compiler-IR');
  1334. smalltalk.addMethod(
  1335. "_accept_",
  1336. smalltalk.method({
  1337. selector: "accept:",
  1338. category: 'visiting',
  1339. fn: function (aVisitor) {
  1340. var self=this;
  1341. return smalltalk.send(aVisitor, "_visitIRBlockSequence_", [self]);
  1342. return self;},
  1343. args: ["aVisitor"],
  1344. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  1345. messageSends: ["visitIRBlockSequence:"],
  1346. referencedClasses: []
  1347. }),
  1348. smalltalk.IRBlockSequence);
  1349. smalltalk.addClass('IRTempDeclaration', smalltalk.IRInstruction, ['name'], 'Compiler-IR');
  1350. smalltalk.IRTempDeclaration.comment="I am a temporary variable declaration instruction"
  1351. smalltalk.addMethod(
  1352. "_accept_",
  1353. smalltalk.method({
  1354. selector: "accept:",
  1355. category: 'visiting',
  1356. fn: function (aVisitor) {
  1357. var self=this;
  1358. return smalltalk.send(aVisitor, "_visitIRTempDeclaration_", [self]);
  1359. return self;},
  1360. args: ["aVisitor"],
  1361. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  1362. messageSends: ["visitIRTempDeclaration:"],
  1363. referencedClasses: []
  1364. }),
  1365. smalltalk.IRTempDeclaration);
  1366. smalltalk.addMethod(
  1367. "_isTempDeclaration",
  1368. smalltalk.method({
  1369. selector: "isTempDeclaration",
  1370. category: 'visiting',
  1371. fn: function () {
  1372. var self=this;
  1373. return true;
  1374. return self;},
  1375. args: [],
  1376. source: "isTempDeclaration\x0a\x09^ true",
  1377. messageSends: [],
  1378. referencedClasses: []
  1379. }),
  1380. smalltalk.IRTempDeclaration);
  1381. smalltalk.addMethod(
  1382. "_name",
  1383. smalltalk.method({
  1384. selector: "name",
  1385. category: 'accessing',
  1386. fn: function () {
  1387. var self=this;
  1388. return self['@name'];
  1389. return self;},
  1390. args: [],
  1391. source: "name\x0a\x09^ name",
  1392. messageSends: [],
  1393. referencedClasses: []
  1394. }),
  1395. smalltalk.IRTempDeclaration);
  1396. smalltalk.addMethod(
  1397. "_name_",
  1398. smalltalk.method({
  1399. selector: "name:",
  1400. category: 'accessing',
  1401. fn: function (aString) {
  1402. var self=this;
  1403. (self['@name']=aString);
  1404. return self;},
  1405. args: ["aString"],
  1406. source: "name: aString\x0a\x09name := aString",
  1407. messageSends: [],
  1408. referencedClasses: []
  1409. }),
  1410. smalltalk.IRTempDeclaration);
  1411. smalltalk.addClass('IRValue', smalltalk.IRInstruction, ['value'], 'Compiler-IR');
  1412. smalltalk.IRValue.comment="I am the simplest possible instruction. I represent a value."
  1413. smalltalk.addMethod(
  1414. "_accept_",
  1415. smalltalk.method({
  1416. selector: "accept:",
  1417. category: 'visiting',
  1418. fn: function (aVisitor) {
  1419. var self=this;
  1420. return smalltalk.send(aVisitor, "_visitIRValue_", [self]);
  1421. return self;},
  1422. args: ["aVisitor"],
  1423. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  1424. messageSends: ["visitIRValue:"],
  1425. referencedClasses: []
  1426. }),
  1427. smalltalk.IRValue);
  1428. smalltalk.addMethod(
  1429. "_value",
  1430. smalltalk.method({
  1431. selector: "value",
  1432. category: 'accessing',
  1433. fn: function () {
  1434. var self=this;
  1435. return self['@value'];
  1436. return self;},
  1437. args: [],
  1438. source: "value\x0a\x09^value",
  1439. messageSends: [],
  1440. referencedClasses: []
  1441. }),
  1442. smalltalk.IRValue);
  1443. smalltalk.addMethod(
  1444. "_value_",
  1445. smalltalk.method({
  1446. selector: "value:",
  1447. category: 'accessing',
  1448. fn: function (aString) {
  1449. var self=this;
  1450. (self['@value']=aString);
  1451. return self;},
  1452. args: ["aString"],
  1453. source: "value: aString\x0a\x09value := aString",
  1454. messageSends: [],
  1455. referencedClasses: []
  1456. }),
  1457. smalltalk.IRValue);
  1458. smalltalk.addClass('IRVariable', smalltalk.IRInstruction, ['variable'], 'Compiler-IR');
  1459. smalltalk.IRVariable.comment="I am a variable instruction."
  1460. smalltalk.addMethod(
  1461. "_accept_",
  1462. smalltalk.method({
  1463. selector: "accept:",
  1464. category: 'visiting',
  1465. fn: function (aVisitor) {
  1466. var self=this;
  1467. return smalltalk.send(aVisitor, "_visitIRVariable_", [self]);
  1468. return self;},
  1469. args: ["aVisitor"],
  1470. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  1471. messageSends: ["visitIRVariable:"],
  1472. referencedClasses: []
  1473. }),
  1474. smalltalk.IRVariable);
  1475. smalltalk.addMethod(
  1476. "_isVariable",
  1477. smalltalk.method({
  1478. selector: "isVariable",
  1479. category: 'testing',
  1480. fn: function () {
  1481. var self=this;
  1482. return true;
  1483. return self;},
  1484. args: [],
  1485. source: "isVariable\x0a\x09^ true",
  1486. messageSends: [],
  1487. referencedClasses: []
  1488. }),
  1489. smalltalk.IRVariable);
  1490. smalltalk.addMethod(
  1491. "_variable",
  1492. smalltalk.method({
  1493. selector: "variable",
  1494. category: 'accessing',
  1495. fn: function () {
  1496. var self=this;
  1497. return self['@variable'];
  1498. return self;},
  1499. args: [],
  1500. source: "variable\x0a\x09^ variable",
  1501. messageSends: [],
  1502. referencedClasses: []
  1503. }),
  1504. smalltalk.IRVariable);
  1505. smalltalk.addMethod(
  1506. "_variable_",
  1507. smalltalk.method({
  1508. selector: "variable:",
  1509. category: 'accessing',
  1510. fn: function (aScopeVariable) {
  1511. var self=this;
  1512. (self['@variable']=aScopeVariable);
  1513. return self;},
  1514. args: ["aScopeVariable"],
  1515. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  1516. messageSends: [],
  1517. referencedClasses: []
  1518. }),
  1519. smalltalk.IRVariable);
  1520. smalltalk.addClass('IRVerbatim', smalltalk.IRInstruction, ['source'], 'Compiler-IR');
  1521. smalltalk.addMethod(
  1522. "_accept_",
  1523. smalltalk.method({
  1524. selector: "accept:",
  1525. category: 'visiting',
  1526. fn: function (aVisitor) {
  1527. var self=this;
  1528. return smalltalk.send(aVisitor, "_visitIRVerbatim_", [self]);
  1529. return self;},
  1530. args: ["aVisitor"],
  1531. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  1532. messageSends: ["visitIRVerbatim:"],
  1533. referencedClasses: []
  1534. }),
  1535. smalltalk.IRVerbatim);
  1536. smalltalk.addMethod(
  1537. "_source",
  1538. smalltalk.method({
  1539. selector: "source",
  1540. category: 'accessing',
  1541. fn: function () {
  1542. var self=this;
  1543. return self['@source'];
  1544. return self;},
  1545. args: [],
  1546. source: "source\x0a\x09^ source",
  1547. messageSends: [],
  1548. referencedClasses: []
  1549. }),
  1550. smalltalk.IRVerbatim);
  1551. smalltalk.addMethod(
  1552. "_source_",
  1553. smalltalk.method({
  1554. selector: "source:",
  1555. category: 'accessing',
  1556. fn: function (aString) {
  1557. var self=this;
  1558. (self['@source']=aString);
  1559. return self;},
  1560. args: ["aString"],
  1561. source: "source: aString\x0a\x09source := aString",
  1562. messageSends: [],
  1563. referencedClasses: []
  1564. }),
  1565. smalltalk.IRVerbatim);
  1566. smalltalk.addClass('IRVisitor', smalltalk.Object, [], 'Compiler-IR');
  1567. smalltalk.addMethod(
  1568. "_visit_",
  1569. smalltalk.method({
  1570. selector: "visit:",
  1571. category: 'visiting',
  1572. fn: function (anIRInstruction) {
  1573. var self=this;
  1574. return smalltalk.send(anIRInstruction, "_accept_", [self]);
  1575. return self;},
  1576. args: ["anIRInstruction"],
  1577. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  1578. messageSends: ["accept:"],
  1579. referencedClasses: []
  1580. }),
  1581. smalltalk.IRVisitor);
  1582. smalltalk.addMethod(
  1583. "_visitIRAssignment_",
  1584. smalltalk.method({
  1585. selector: "visitIRAssignment:",
  1586. category: 'visiting',
  1587. fn: function (anIRAssignment) {
  1588. var self=this;
  1589. return smalltalk.send(self, "_visitIRInstruction_", [anIRAssignment]);
  1590. return self;},
  1591. args: ["anIRAssignment"],
  1592. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  1593. messageSends: ["visitIRInstruction:"],
  1594. referencedClasses: []
  1595. }),
  1596. smalltalk.IRVisitor);
  1597. smalltalk.addMethod(
  1598. "_visitIRBlockSequence_",
  1599. smalltalk.method({
  1600. selector: "visitIRBlockSequence:",
  1601. category: 'visiting',
  1602. fn: function (anIRBlockSequence) {
  1603. var self=this;
  1604. return smalltalk.send(self, "_visitIRSequence_", [anIRBlockSequence]);
  1605. return self;},
  1606. args: ["anIRBlockSequence"],
  1607. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  1608. messageSends: ["visitIRSequence:"],
  1609. referencedClasses: []
  1610. }),
  1611. smalltalk.IRVisitor);
  1612. smalltalk.addMethod(
  1613. "_visitIRClosure_",
  1614. smalltalk.method({
  1615. selector: "visitIRClosure:",
  1616. category: 'visiting',
  1617. fn: function (anIRClosure) {
  1618. var self=this;
  1619. return smalltalk.send(self, "_visitIRInstruction_", [anIRClosure]);
  1620. return self;},
  1621. args: ["anIRClosure"],
  1622. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  1623. messageSends: ["visitIRInstruction:"],
  1624. referencedClasses: []
  1625. }),
  1626. smalltalk.IRVisitor);
  1627. smalltalk.addMethod(
  1628. "_visitIRDynamicArray_",
  1629. smalltalk.method({
  1630. selector: "visitIRDynamicArray:",
  1631. category: 'visiting',
  1632. fn: function (anIRDynamicArray) {
  1633. var self=this;
  1634. return smalltalk.send(self, "_visitIRInstruction_", [anIRDynamicArray]);
  1635. return self;},
  1636. args: ["anIRDynamicArray"],
  1637. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  1638. messageSends: ["visitIRInstruction:"],
  1639. referencedClasses: []
  1640. }),
  1641. smalltalk.IRVisitor);
  1642. smalltalk.addMethod(
  1643. "_visitIRDynamicDictionary_",
  1644. smalltalk.method({
  1645. selector: "visitIRDynamicDictionary:",
  1646. category: 'visiting',
  1647. fn: function (anIRDynamicDictionary) {
  1648. var self=this;
  1649. return smalltalk.send(self, "_visitIRInstruction_", [anIRDynamicDictionary]);
  1650. return self;},
  1651. args: ["anIRDynamicDictionary"],
  1652. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  1653. messageSends: ["visitIRInstruction:"],
  1654. referencedClasses: []
  1655. }),
  1656. smalltalk.IRVisitor);
  1657. smalltalk.addMethod(
  1658. "_visitIRInstruction_",
  1659. smalltalk.method({
  1660. selector: "visitIRInstruction:",
  1661. category: 'visiting',
  1662. fn: function (anIRInstruction) {
  1663. var self=this;
  1664. smalltalk.send(smalltalk.send(anIRInstruction, "_instructions", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);
  1665. return anIRInstruction;
  1666. return self;},
  1667. args: ["anIRInstruction"],
  1668. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  1669. messageSends: ["do:", "instructions", "visit:"],
  1670. referencedClasses: []
  1671. }),
  1672. smalltalk.IRVisitor);
  1673. smalltalk.addMethod(
  1674. "_visitIRMethod_",
  1675. smalltalk.method({
  1676. selector: "visitIRMethod:",
  1677. category: 'visiting',
  1678. fn: function (anIRMethod) {
  1679. var self=this;
  1680. return smalltalk.send(self, "_visitIRInstruction_", [anIRMethod]);
  1681. return self;},
  1682. args: ["anIRMethod"],
  1683. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  1684. messageSends: ["visitIRInstruction:"],
  1685. referencedClasses: []
  1686. }),
  1687. smalltalk.IRVisitor);
  1688. smalltalk.addMethod(
  1689. "_visitIRNonLocalReturn_",
  1690. smalltalk.method({
  1691. selector: "visitIRNonLocalReturn:",
  1692. category: 'visiting',
  1693. fn: function (anIRNonLocalReturn) {
  1694. var self=this;
  1695. return smalltalk.send(self, "_visitIRInstruction_", [anIRNonLocalReturn]);
  1696. return self;},
  1697. args: ["anIRNonLocalReturn"],
  1698. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  1699. messageSends: ["visitIRInstruction:"],
  1700. referencedClasses: []
  1701. }),
  1702. smalltalk.IRVisitor);
  1703. smalltalk.addMethod(
  1704. "_visitIRNonLocalReturnHandling_",
  1705. smalltalk.method({
  1706. selector: "visitIRNonLocalReturnHandling:",
  1707. category: 'visiting',
  1708. fn: function (anIRNonLocalReturnHandling) {
  1709. var self=this;
  1710. return smalltalk.send(self, "_visitIRInstruction_", [anIRNonLocalReturnHandling]);
  1711. return self;},
  1712. args: ["anIRNonLocalReturnHandling"],
  1713. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  1714. messageSends: ["visitIRInstruction:"],
  1715. referencedClasses: []
  1716. }),
  1717. smalltalk.IRVisitor);
  1718. smalltalk.addMethod(
  1719. "_visitIRReturn_",
  1720. smalltalk.method({
  1721. selector: "visitIRReturn:",
  1722. category: 'visiting',
  1723. fn: function (anIRReturn) {
  1724. var self=this;
  1725. return smalltalk.send(self, "_visitIRInstruction_", [anIRReturn]);
  1726. return self;},
  1727. args: ["anIRReturn"],
  1728. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  1729. messageSends: ["visitIRInstruction:"],
  1730. referencedClasses: []
  1731. }),
  1732. smalltalk.IRVisitor);
  1733. smalltalk.addMethod(
  1734. "_visitIRSend_",
  1735. smalltalk.method({
  1736. selector: "visitIRSend:",
  1737. category: 'visiting',
  1738. fn: function (anIRSend) {
  1739. var self=this;
  1740. return smalltalk.send(self, "_visitIRInstruction_", [anIRSend]);
  1741. return self;},
  1742. args: ["anIRSend"],
  1743. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  1744. messageSends: ["visitIRInstruction:"],
  1745. referencedClasses: []
  1746. }),
  1747. smalltalk.IRVisitor);
  1748. smalltalk.addMethod(
  1749. "_visitIRSequence_",
  1750. smalltalk.method({
  1751. selector: "visitIRSequence:",
  1752. category: 'visiting',
  1753. fn: function (anIRSequence) {
  1754. var self=this;
  1755. return smalltalk.send(self, "_visitIRInstruction_", [anIRSequence]);
  1756. return self;},
  1757. args: ["anIRSequence"],
  1758. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  1759. messageSends: ["visitIRInstruction:"],
  1760. referencedClasses: []
  1761. }),
  1762. smalltalk.IRVisitor);
  1763. smalltalk.addMethod(
  1764. "_visitIRTempDeclaration_",
  1765. smalltalk.method({
  1766. selector: "visitIRTempDeclaration:",
  1767. category: 'visiting',
  1768. fn: function (anIRTempDeclaration) {
  1769. var self=this;
  1770. return smalltalk.send(self, "_visitIRInstruction_", [anIRTempDeclaration]);
  1771. return self;},
  1772. args: ["anIRTempDeclaration"],
  1773. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  1774. messageSends: ["visitIRInstruction:"],
  1775. referencedClasses: []
  1776. }),
  1777. smalltalk.IRVisitor);
  1778. smalltalk.addMethod(
  1779. "_visitIRValue_",
  1780. smalltalk.method({
  1781. selector: "visitIRValue:",
  1782. category: 'visiting',
  1783. fn: function (anIRValue) {
  1784. var self=this;
  1785. return smalltalk.send(self, "_visitIRInstruction_", [anIRValue]);
  1786. return self;},
  1787. args: ["anIRValue"],
  1788. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  1789. messageSends: ["visitIRInstruction:"],
  1790. referencedClasses: []
  1791. }),
  1792. smalltalk.IRVisitor);
  1793. smalltalk.addMethod(
  1794. "_visitIRVariable_",
  1795. smalltalk.method({
  1796. selector: "visitIRVariable:",
  1797. category: 'visiting',
  1798. fn: function (anIRVariable) {
  1799. var self=this;
  1800. return smalltalk.send(self, "_visitIRInstruction_", [anIRVariable]);
  1801. return self;},
  1802. args: ["anIRVariable"],
  1803. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  1804. messageSends: ["visitIRInstruction:"],
  1805. referencedClasses: []
  1806. }),
  1807. smalltalk.IRVisitor);
  1808. smalltalk.addMethod(
  1809. "_visitIRVerbatim_",
  1810. smalltalk.method({
  1811. selector: "visitIRVerbatim:",
  1812. category: 'visiting',
  1813. fn: function (anIRVerbatim) {
  1814. var self=this;
  1815. return smalltalk.send(self, "_visitIRInstruction_", [anIRVerbatim]);
  1816. return self;},
  1817. args: ["anIRVerbatim"],
  1818. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  1819. messageSends: ["visitIRInstruction:"],
  1820. referencedClasses: []
  1821. }),
  1822. smalltalk.IRVisitor);
  1823. smalltalk.addClass('IRJSTranslator', smalltalk.IRVisitor, ['stream'], 'Compiler-IR');
  1824. smalltalk.addMethod(
  1825. "_contents",
  1826. smalltalk.method({
  1827. selector: "contents",
  1828. category: 'accessing',
  1829. fn: function () {
  1830. var self=this;
  1831. return smalltalk.send(smalltalk.send(self, "_stream", []), "_contents", []);
  1832. return self;},
  1833. args: [],
  1834. source: "contents\x0a\x09^ self stream contents",
  1835. messageSends: ["contents", "stream"],
  1836. referencedClasses: []
  1837. }),
  1838. smalltalk.IRJSTranslator);
  1839. smalltalk.addMethod(
  1840. "_initialize",
  1841. smalltalk.method({
  1842. selector: "initialize",
  1843. category: 'initialization',
  1844. fn: function () {
  1845. var self=this;
  1846. smalltalk.send(self, "_initialize", [], smalltalk.IRJSTranslator.superclass || nil);
  1847. (self['@stream']=smalltalk.send((smalltalk.JSStream || JSStream), "_new", []));
  1848. return self;},
  1849. args: [],
  1850. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  1851. messageSends: ["initialize", "new"],
  1852. referencedClasses: ["JSStream"]
  1853. }),
  1854. smalltalk.IRJSTranslator);
  1855. smalltalk.addMethod(
  1856. "_stream",
  1857. smalltalk.method({
  1858. selector: "stream",
  1859. category: 'accessing',
  1860. fn: function () {
  1861. var self=this;
  1862. return self['@stream'];
  1863. return self;},
  1864. args: [],
  1865. source: "stream\x0a\x09^ stream",
  1866. messageSends: [],
  1867. referencedClasses: []
  1868. }),
  1869. smalltalk.IRJSTranslator);
  1870. smalltalk.addMethod(
  1871. "_stream_",
  1872. smalltalk.method({
  1873. selector: "stream:",
  1874. category: 'accessing',
  1875. fn: function (aStream) {
  1876. var self=this;
  1877. (self['@stream']=aStream);
  1878. return self;},
  1879. args: ["aStream"],
  1880. source: "stream: aStream\x0a\x09stream := aStream",
  1881. messageSends: [],
  1882. referencedClasses: []
  1883. }),
  1884. smalltalk.IRJSTranslator);
  1885. smalltalk.addMethod(
  1886. "_visitIRAssignment_",
  1887. smalltalk.method({
  1888. selector: "visitIRAssignment:",
  1889. category: 'visiting',
  1890. fn: function (anIRAssignment) {
  1891. var self=this;
  1892. smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRAssignment, "_instructions", []), "_first", [])]);
  1893. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAssignment", []);
  1894. smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRAssignment, "_instructions", []), "_last", [])]);
  1895. return self;},
  1896. args: ["anIRAssignment"],
  1897. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  1898. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"],
  1899. referencedClasses: []
  1900. }),
  1901. smalltalk.IRJSTranslator);
  1902. smalltalk.addMethod(
  1903. "_visitIRClosure_",
  1904. smalltalk.method({
  1905. selector: "visitIRClosure:",
  1906. category: 'visiting',
  1907. fn: function (anIRClosure) {
  1908. var self=this;
  1909. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutClosureWith_arguments_", [(function(){return smalltalk.send(self, "_visitIRClosure_", [anIRClosure], smalltalk.IRJSTranslator.superclass || nil);}), smalltalk.send(anIRClosure, "_arguments", [])]);
  1910. return self;},
  1911. args: ["anIRClosure"],
  1912. source: "visitIRClosure: anIRClosure\x0a\x09self stream \x0a\x09\x09nextPutClosureWith: [ super visitIRClosure: anIRClosure ] \x0a\x09\x09arguments: anIRClosure arguments",
  1913. messageSends: ["nextPutClosureWith:arguments:", "stream", "visitIRClosure:", "arguments"],
  1914. referencedClasses: []
  1915. }),
  1916. smalltalk.IRJSTranslator);
  1917. smalltalk.addMethod(
  1918. "_visitIRDynamicArray_",
  1919. smalltalk.method({
  1920. selector: "visitIRDynamicArray:",
  1921. category: 'visiting',
  1922. fn: function (anIRDynamicArray) {
  1923. var self=this;
  1924. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", ["["]);
  1925. smalltalk.send(smalltalk.send(anIRDynamicArray, "_instructions", []), "_do_separatedBy_", [(function(each){return smalltalk.send(self, "_visit_", [each]);}), (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [","]);})]);
  1926. smalltalk.send(self['@stream'], "_nextPutAll_", ["]"]);
  1927. return self;},
  1928. args: ["anIRDynamicArray"],
  1929. 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: ']'",
  1930. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"],
  1931. referencedClasses: []
  1932. }),
  1933. smalltalk.IRJSTranslator);
  1934. smalltalk.addMethod(
  1935. "_visitIRDynamicDictionary_",
  1936. smalltalk.method({
  1937. selector: "visitIRDynamicDictionary:",
  1938. category: 'visiting',
  1939. fn: function (anIRDynamicDictionary) {
  1940. var self=this;
  1941. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", ["smalltalk.HashedCollection._fromPairs_(["]);
  1942. smalltalk.send(smalltalk.send(anIRDynamicDictionary, "_instructions", []), "_do_separatedBy_", [(function(each){return smalltalk.send(self, "_visit_", [each]);}), (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [","]);})]);
  1943. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", ["])"]);
  1944. return self;},
  1945. args: ["anIRDynamicDictionary"],
  1946. 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: '])'",
  1947. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"],
  1948. referencedClasses: []
  1949. }),
  1950. smalltalk.IRJSTranslator);
  1951. smalltalk.addMethod(
  1952. "_visitIRMethod_",
  1953. smalltalk.method({
  1954. selector: "visitIRMethod:",
  1955. category: 'visiting',
  1956. fn: function (anIRMethod) {
  1957. var self=this;
  1958. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutMethodDeclaration_with_", [anIRMethod, (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutFunctionWith_arguments_", [(function(){((($receiver = smalltalk.send(smalltalk.send(anIRMethod, "_internalVariables", []), "_notEmpty", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutVars_", [smalltalk.send(smalltalk.send(smalltalk.send(anIRMethod, "_internalVariables", []), "_asArray", []), "_collect_", [(function(each){return smalltalk.send(smalltalk.send(each, "_variable", []), "_alias", []);})])]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutVars_", [smalltalk.send(smalltalk.send(smalltalk.send(anIRMethod, "_internalVariables", []), "_asArray", []), "_collect_", [(function(each){return smalltalk.send(smalltalk.send(each, "_variable", []), "_alias", []);})])]);})]));return ((($receiver = smalltalk.send(smalltalk.send(anIRMethod, "_scope", []), "_hasNonLocalReturn", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutNonLocalReturnHandlingWith_", [(function(){return smalltalk.send(self, "_visitIRMethod_", [anIRMethod], smalltalk.IRJSTranslator.superclass || nil);})]);})() : (function(){return smalltalk.send(self, "_visitIRMethod_", [anIRMethod], smalltalk.IRJSTranslator.superclass || nil);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutNonLocalReturnHandlingWith_", [(function(){return smalltalk.send(self, "_visitIRMethod_", [anIRMethod], smalltalk.IRJSTranslator.superclass || nil);})]);}), (function(){return smalltalk.send(self, "_visitIRMethod_", [anIRMethod], smalltalk.IRJSTranslator.superclass || nil);})]));}), smalltalk.send(anIRMethod, "_arguments", [])]);})]);
  1959. return self;},
  1960. args: ["anIRMethod"],
  1961. source: "visitIRMethod: anIRMethod\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod \x0a\x09\x09with: [ self stream \x0a\x09\x09\x09nextPutFunctionWith: [ \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 ]",
  1962. messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "ifTrue:", "notEmpty", "internalVariables", "nextPutVars:", "collect:", "asArray", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"],
  1963. referencedClasses: []
  1964. }),
  1965. smalltalk.IRJSTranslator);
  1966. smalltalk.addMethod(
  1967. "_visitIRNonLocalReturn_",
  1968. smalltalk.method({
  1969. selector: "visitIRNonLocalReturn:",
  1970. category: 'visiting',
  1971. fn: function (anIRNonLocalReturn) {
  1972. var self=this;
  1973. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutNonLocalReturnWith_", [(function(){return smalltalk.send(self, "_visitIRNonLocalReturn_", [anIRNonLocalReturn], smalltalk.IRJSTranslator.superclass || nil);})]);
  1974. return self;},
  1975. args: ["anIRNonLocalReturn"],
  1976. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  1977. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"],
  1978. referencedClasses: []
  1979. }),
  1980. smalltalk.IRJSTranslator);
  1981. smalltalk.addMethod(
  1982. "_visitIRReturn_",
  1983. smalltalk.method({
  1984. selector: "visitIRReturn:",
  1985. category: 'visiting',
  1986. fn: function (anIRReturn) {
  1987. var self=this;
  1988. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutReturnWith_", [(function(){return smalltalk.send(self, "_visitIRReturn_", [anIRReturn], smalltalk.IRJSTranslator.superclass || nil);})]);
  1989. return self;},
  1990. args: ["anIRReturn"],
  1991. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  1992. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"],
  1993. referencedClasses: []
  1994. }),
  1995. smalltalk.IRJSTranslator);
  1996. smalltalk.addMethod(
  1997. "_visitIRSend_",
  1998. smalltalk.method({
  1999. selector: "visitIRSend:",
  2000. category: 'visiting',
  2001. fn: function (anIRSend) {
  2002. var self=this;
  2003. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", ["smalltalk.send("]);
  2004. smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRSend, "_instructions", []), "_first", [])]);
  2005. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(smalltalk.send(",\x22", "__comma", [smalltalk.send(smalltalk.send(anIRSend, "_selector", []), "_asSelector", [])]), "__comma", ["\x22,["])]);
  2006. smalltalk.send(smalltalk.send(smalltalk.send(anIRSend, "_instructions", []), "_allButFirst", []), "_do_separatedBy_", [(function(each){return smalltalk.send(self, "_visit_", [each]);}), (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [","]);})]);
  2007. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", ["]"]);
  2008. (($receiver = smalltalk.send(anIRSend, "_classSend", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(",", "__comma", [smalltalk.send(smalltalk.send(anIRSend, "_classSend", []), "_asJavascript", [])])]);})() : nil;
  2009. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [")"]);
  2010. return self;},
  2011. args: ["anIRSend"],
  2012. source: "visitIRSend: anIRSend\x0a\x09self stream nextPutAll: 'smalltalk.send('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll: ',\x22', anIRSend selector asSelector, '\x22,['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ']'.\x0a\x09\x22anIRSend index > 1 \x0a\x09\x09ifTrue: [\x0a\x09\x09\x09anIRSend classSend \x0a\x09\x09\x09\x09ifNil: [ self stream nextPutAll: ',undefined' ]\x0a\x09\x09\x09\x09ifNotNil: [ self stream nextPutAll: ',', anIRSend classSend asJavascript ].\x0a\x09\x09\x09self stream nextPutAll: ',', anIRSend index asString ]\x0a\x09\x09ifFalse: [\x22\x0a\x09\x09\x09anIRSend classSend ifNotNil: [ \x0a\x09\x09\x09\x09self stream nextPutAll: ',', anIRSend classSend asJavascript ]\x22]\x22.\x0a\x09self stream nextPutAll: ')'",
  2013. messageSends: ["nextPutAll:", "stream", "visit:", "first", "instructions", ",", "asSelector", "selector", "do:separatedBy:", "allButFirst", "ifNotNil:", "classSend", "asJavascript"],
  2014. referencedClasses: []
  2015. }),
  2016. smalltalk.IRJSTranslator);
  2017. smalltalk.addMethod(
  2018. "_visitIRSequence_",
  2019. smalltalk.method({
  2020. selector: "visitIRSequence:",
  2021. category: 'visiting',
  2022. fn: function (anIRSequence) {
  2023. var self=this;
  2024. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutSequenceWith_", [(function(){return smalltalk.send(smalltalk.send(anIRSequence, "_instructions", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutStatementWith_", [smalltalk.send(self, "_visit_", [each])]);})]);})]);
  2025. return self;},
  2026. args: ["anIRSequence"],
  2027. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ]]",
  2028. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"],
  2029. referencedClasses: []
  2030. }),
  2031. smalltalk.IRJSTranslator);
  2032. smalltalk.addMethod(
  2033. "_visitIRTempDeclaration_",
  2034. smalltalk.method({
  2035. selector: "visitIRTempDeclaration:",
  2036. category: 'visiting',
  2037. fn: function (anIRTempDeclaration) {
  2038. var self=this;
  2039. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutVar_", [smalltalk.send(smalltalk.send(anIRTempDeclaration, "_name", []), "_asVariableName", [])]);
  2040. return self;},
  2041. args: ["anIRTempDeclaration"],
  2042. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09self stream nextPutVar: anIRTempDeclaration name asVariableName",
  2043. messageSends: ["nextPutVar:", "stream", "asVariableName", "name"],
  2044. referencedClasses: []
  2045. }),
  2046. smalltalk.IRJSTranslator);
  2047. smalltalk.addMethod(
  2048. "_visitIRValue_",
  2049. smalltalk.method({
  2050. selector: "visitIRValue:",
  2051. category: 'visiting',
  2052. fn: function (anIRValue) {
  2053. var self=this;
  2054. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(smalltalk.send(anIRValue, "_value", []), "_asJavascript", [])]);
  2055. return self;},
  2056. args: ["anIRValue"],
  2057. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  2058. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"],
  2059. referencedClasses: []
  2060. }),
  2061. smalltalk.IRJSTranslator);
  2062. smalltalk.addMethod(
  2063. "_visitIRVariable_",
  2064. smalltalk.method({
  2065. selector: "visitIRVariable:",
  2066. category: 'visiting',
  2067. fn: function (anIRVariable) {
  2068. var self=this;
  2069. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(smalltalk.send(anIRVariable, "_variable", []), "_alias", [])]);
  2070. return self;},
  2071. args: ["anIRVariable"],
  2072. source: "visitIRVariable: anIRVariable\x0a\x09self stream nextPutAll: anIRVariable variable alias",
  2073. messageSends: ["nextPutAll:", "stream", "alias", "variable"],
  2074. referencedClasses: []
  2075. }),
  2076. smalltalk.IRJSTranslator);
  2077. smalltalk.addMethod(
  2078. "_visitIRVerbatim_",
  2079. smalltalk.method({
  2080. selector: "visitIRVerbatim:",
  2081. category: 'visiting',
  2082. fn: function (anIRVerbatim) {
  2083. var self=this;
  2084. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutStatementWith_", [(function(){return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(anIRVerbatim, "_source", [])]);})]);
  2085. return self;},
  2086. args: ["anIRVerbatim"],
  2087. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  2088. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"],
  2089. referencedClasses: []
  2090. }),
  2091. smalltalk.IRJSTranslator);
  2092. smalltalk.addClass('JSStream', smalltalk.Object, ['stream'], 'Compiler-IR');
  2093. smalltalk.addMethod(
  2094. "_contents",
  2095. smalltalk.method({
  2096. selector: "contents",
  2097. category: 'accessing',
  2098. fn: function () {
  2099. var self=this;
  2100. return smalltalk.send(self['@stream'], "_contents", []);
  2101. return self;},
  2102. args: [],
  2103. source: "contents\x0a\x09^ stream contents",
  2104. messageSends: ["contents"],
  2105. referencedClasses: []
  2106. }),
  2107. smalltalk.JSStream);
  2108. smalltalk.addMethod(
  2109. "_initialize",
  2110. smalltalk.method({
  2111. selector: "initialize",
  2112. category: 'initialization',
  2113. fn: function () {
  2114. var self=this;
  2115. smalltalk.send(self, "_initialize", [], smalltalk.JSStream.superclass || nil);
  2116. (self['@stream']=smalltalk.send("", "_writeStream", []));
  2117. return self;},
  2118. args: [],
  2119. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  2120. messageSends: ["initialize", "writeStream"],
  2121. referencedClasses: []
  2122. }),
  2123. smalltalk.JSStream);
  2124. smalltalk.addMethod(
  2125. "_lf",
  2126. smalltalk.method({
  2127. selector: "lf",
  2128. category: 'streaming',
  2129. fn: function () {
  2130. var self=this;
  2131. smalltalk.send(self['@stream'], "_lf", []);
  2132. return self;},
  2133. args: [],
  2134. source: "lf\x0a\x09stream lf",
  2135. messageSends: ["lf"],
  2136. referencedClasses: []
  2137. }),
  2138. smalltalk.JSStream);
  2139. smalltalk.addMethod(
  2140. "_nextPut_",
  2141. smalltalk.method({
  2142. selector: "nextPut:",
  2143. category: 'streaming',
  2144. fn: function (aString) {
  2145. var self=this;
  2146. smalltalk.send(self['@stream'], "_nextPut_", [aString]);
  2147. return self;},
  2148. args: ["aString"],
  2149. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  2150. messageSends: ["nextPut:"],
  2151. referencedClasses: []
  2152. }),
  2153. smalltalk.JSStream);
  2154. smalltalk.addMethod(
  2155. "_nextPutAll_",
  2156. smalltalk.method({
  2157. selector: "nextPutAll:",
  2158. category: 'streaming',
  2159. fn: function (aString) {
  2160. var self=this;
  2161. smalltalk.send(self['@stream'], "_nextPutAll_", [aString]);
  2162. return self;},
  2163. args: ["aString"],
  2164. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  2165. messageSends: ["nextPutAll:"],
  2166. referencedClasses: []
  2167. }),
  2168. smalltalk.JSStream);
  2169. smalltalk.addMethod(
  2170. "_nextPutAssignment",
  2171. smalltalk.method({
  2172. selector: "nextPutAssignment",
  2173. category: 'streaming',
  2174. fn: function () {
  2175. var self=this;
  2176. smalltalk.send(self['@stream'], "_nextPutAll_", ["="]);
  2177. return self;},
  2178. args: [],
  2179. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  2180. messageSends: ["nextPutAll:"],
  2181. referencedClasses: []
  2182. }),
  2183. smalltalk.JSStream);
  2184. smalltalk.addMethod(
  2185. "_nextPutClosureWith_arguments_",
  2186. smalltalk.method({
  2187. selector: "nextPutClosureWith:arguments:",
  2188. category: 'streaming',
  2189. fn: function (aBlock, anArray) {
  2190. var self=this;
  2191. smalltalk.send(self['@stream'], "_nextPutAll_", ["(function("]);
  2192. smalltalk.send(anArray, "_do_separatedBy_", [(function(each){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(each, "_asVariableName", [])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPut_", [","]);})]);
  2193. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["){"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2194. smalltalk.send(aBlock, "_value", []);
  2195. smalltalk.send(self['@stream'], "_nextPutAll_", ["})"]);
  2196. return self;},
  2197. args: ["aBlock", "anArray"],
  2198. 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: '})'",
  2199. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  2200. referencedClasses: []
  2201. }),
  2202. smalltalk.JSStream);
  2203. smalltalk.addMethod(
  2204. "_nextPutFunctionWith_arguments_",
  2205. smalltalk.method({
  2206. selector: "nextPutFunctionWith:arguments:",
  2207. category: 'streaming',
  2208. fn: function (aBlock, anArray) {
  2209. var self=this;
  2210. smalltalk.send(self['@stream'], "_nextPutAll_", ["fn: function("]);
  2211. smalltalk.send(anArray, "_do_separatedBy_", [(function(each){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(each, "_asVariableName", [])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPut_", [","]);})]);
  2212. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["){"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2213. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["var self=this;"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2214. smalltalk.send(aBlock, "_value", []);
  2215. smalltalk.send(self['@stream'], "_nextPutAll_", ["}"]);
  2216. return self;},
  2217. args: ["aBlock", "anArray"],
  2218. 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: '}'",
  2219. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  2220. referencedClasses: []
  2221. }),
  2222. smalltalk.JSStream);
  2223. smalltalk.addMethod(
  2224. "_nextPutIf_with_",
  2225. smalltalk.method({
  2226. selector: "nextPutIf:with:",
  2227. category: 'streaming',
  2228. fn: function (aBlock, anotherBlock) {
  2229. var self=this;
  2230. smalltalk.send(self['@stream'], "_nextPutAll_", ["if("]);
  2231. smalltalk.send(aBlock, "_value", []);
  2232. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["){"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2233. smalltalk.send(anotherBlock, "_value", []);
  2234. smalltalk.send(self['@stream'], "_nextPutAll_", ["}"]);
  2235. return self;},
  2236. args: ["aBlock", "anotherBlock"],
  2237. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  2238. messageSends: ["nextPutAll:", "value", "lf"],
  2239. referencedClasses: []
  2240. }),
  2241. smalltalk.JSStream);
  2242. smalltalk.addMethod(
  2243. "_nextPutMethodDeclaration_with_",
  2244. smalltalk.method({
  2245. selector: "nextPutMethodDeclaration:with:",
  2246. category: 'streaming',
  2247. fn: function (aMethod, aBlock) {
  2248. var self=this;
  2249. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["smalltalk.method({"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("selector: \x22", "__comma", [smalltalk.send(aMethod, "_selector", [])]), "__comma", ["\x22,"])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("source: ", "__comma", [smalltalk.send(smalltalk.send(aMethod, "_source", []), "_asJavascript", [])]), "__comma", [","])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2250. smalltalk.send(aBlock, "_value", []);
  2251. (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(",", "__comma", [smalltalk.send((smalltalk.String || String), "_lf", [])]), "__comma", ["messageSends: "])]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod, "_messageSends", []), "_asArray", []), "_asJavascript", []), "__comma", [","])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("args: ", "__comma", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod, "_arguments", []), "_collect_", [(function(each){return smalltalk.send(each, "_value", []);})]), "_asArray", []), "_asJavascript", [])]), "__comma", [","])]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["referencedClasses: ["]);})(self['@stream']);
  2252. smalltalk.send(smalltalk.send(aMethod, "_classReferences", []), "_do_separatedBy_", [(function(each){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(each, "_asJavascript", [])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [","]);})]);
  2253. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["]"]);return smalltalk.send($rec, "_nextPutAll_", ["})"]);})(self['@stream']);
  2254. return self;},
  2255. args: ["aMethod", "aBlock"],
  2256. 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 \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: '})'",
  2257. messageSends: ["nextPutAll:", "lf", ",", "selector", "asJavascript", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"],
  2258. referencedClasses: ["String"]
  2259. }),
  2260. smalltalk.JSStream);
  2261. smalltalk.addMethod(
  2262. "_nextPutNonLocalReturnHandlingWith_",
  2263. smalltalk.method({
  2264. selector: "nextPutNonLocalReturnHandlingWith:",
  2265. category: 'streaming',
  2266. fn: function (aBlock) {
  2267. var self=this;
  2268. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["var $early={};"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", ["try {"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2269. smalltalk.send(aBlock, "_value", []);
  2270. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["}"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", ["catch(e) {if(e===$early)return e[0]; throw e}"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2271. return self;},
  2272. args: ["aBlock"],
  2273. 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",
  2274. messageSends: ["nextPutAll:", "lf", "value"],
  2275. referencedClasses: []
  2276. }),
  2277. smalltalk.JSStream);
  2278. smalltalk.addMethod(
  2279. "_nextPutNonLocalReturnWith_",
  2280. smalltalk.method({
  2281. selector: "nextPutNonLocalReturnWith:",
  2282. category: 'streaming',
  2283. fn: function (aBlock) {
  2284. var self=this;
  2285. smalltalk.send(self['@stream'], "_nextPutAll_", ["throw $early=["]);
  2286. smalltalk.send(aBlock, "_value", []);
  2287. smalltalk.send(self['@stream'], "_nextPutAll_", ["]"]);
  2288. return self;},
  2289. args: ["aBlock"],
  2290. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  2291. messageSends: ["nextPutAll:", "value"],
  2292. referencedClasses: []
  2293. }),
  2294. smalltalk.JSStream);
  2295. smalltalk.addMethod(
  2296. "_nextPutReturn",
  2297. smalltalk.method({
  2298. selector: "nextPutReturn",
  2299. category: 'streaming',
  2300. fn: function () {
  2301. var self=this;
  2302. smalltalk.send(self['@stream'], "_nextPutAll_", ["return "]);
  2303. return self;},
  2304. args: [],
  2305. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  2306. messageSends: ["nextPutAll:"],
  2307. referencedClasses: []
  2308. }),
  2309. smalltalk.JSStream);
  2310. smalltalk.addMethod(
  2311. "_nextPutReturnWith_",
  2312. smalltalk.method({
  2313. selector: "nextPutReturnWith:",
  2314. category: 'streaming',
  2315. fn: function (aBlock) {
  2316. var self=this;
  2317. smalltalk.send(self, "_nextPutReturn", []);
  2318. smalltalk.send(aBlock, "_value", []);
  2319. return self;},
  2320. args: ["aBlock"],
  2321. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  2322. messageSends: ["nextPutReturn", "value"],
  2323. referencedClasses: []
  2324. }),
  2325. smalltalk.JSStream);
  2326. smalltalk.addMethod(
  2327. "_nextPutSendTo_selector_arguments_",
  2328. smalltalk.method({
  2329. selector: "nextPutSendTo:selector:arguments:",
  2330. category: 'streaming',
  2331. fn: function (receiver, selector, arguments) {
  2332. var self=this;
  2333. smalltalk.send(self['@stream'], "_nextPutAll_", ["smalltalk.send("]);
  2334. smalltalk.send(receiver, "_emitOn_", [self]);
  2335. smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(",\x22", "__comma", [smalltalk.send(selector, "_asSelector", [])]), "__comma", ["\x22,["])]);
  2336. smalltalk.send(arguments, "_do_separatedBy_", [(function(each){return smalltalk.send(each, "_emitOn_", [self]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [","]);})]);
  2337. smalltalk.send(self['@stream'], "_nextPutAll_", ["])"]);
  2338. return self;},
  2339. args: ["receiver", "selector", "arguments"],
  2340. source: "nextPutSendTo: receiver selector: selector arguments: arguments\x0a\x09stream nextPutAll: 'smalltalk.send('.\x0a\x09receiver emitOn: self. \x0a\x09stream nextPutAll: ',\x22', selector asSelector, '\x22,['.\x0a\x09arguments \x0a\x09\x09do: [ :each | each emitOn: self ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: '])'",
  2341. messageSends: ["nextPutAll:", "emitOn:", ",", "asSelector", "do:separatedBy:"],
  2342. referencedClasses: []
  2343. }),
  2344. smalltalk.JSStream);
  2345. smalltalk.addMethod(
  2346. "_nextPutSequenceWith_",
  2347. smalltalk.method({
  2348. selector: "nextPutSequenceWith:",
  2349. category: 'streaming',
  2350. fn: function (aBlock) {
  2351. var self=this;
  2352. smalltalk.send(aBlock, "_value", []);
  2353. return self;},
  2354. args: ["aBlock"],
  2355. 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",
  2356. messageSends: ["value"],
  2357. referencedClasses: []
  2358. }),
  2359. smalltalk.JSStream);
  2360. smalltalk.addMethod(
  2361. "_nextPutStatement_with_",
  2362. smalltalk.method({
  2363. selector: "nextPutStatement:with:",
  2364. category: 'streaming',
  2365. fn: function (anInteger, aBlock) {
  2366. var self=this;
  2367. (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("case ", "__comma", [smalltalk.send(anInteger, "_asString", [])]), "__comma", [":"])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2368. smalltalk.send(self, "_nextPutStatementWith_", [aBlock]);
  2369. (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("smalltalk.thisContext.pc=", "__comma", [smalltalk.send(((($receiver = anInteger).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])), "_asString", [])]), "__comma", [";"])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2370. return self;},
  2371. args: ["anInteger", "aBlock"],
  2372. 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",
  2373. messageSends: ["nextPutAll:", ",", "asString", "lf", "nextPutStatementWith:", "+"],
  2374. referencedClasses: []
  2375. }),
  2376. smalltalk.JSStream);
  2377. smalltalk.addMethod(
  2378. "_nextPutStatementWith_",
  2379. smalltalk.method({
  2380. selector: "nextPutStatementWith:",
  2381. category: 'streaming',
  2382. fn: function (aBlock) {
  2383. var self=this;
  2384. smalltalk.send(aBlock, "_value", []);
  2385. (function($rec){smalltalk.send($rec, "_nextPutAll_", [";"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2386. return self;},
  2387. args: ["aBlock"],
  2388. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  2389. messageSends: ["value", "nextPutAll:", "lf"],
  2390. referencedClasses: []
  2391. }),
  2392. smalltalk.JSStream);
  2393. smalltalk.addMethod(
  2394. "_nextPutVar_",
  2395. smalltalk.method({
  2396. selector: "nextPutVar:",
  2397. category: 'streaming',
  2398. fn: function (aString) {
  2399. var self=this;
  2400. (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("var ", "__comma", [aString]), "__comma", [";"])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2401. return self;},
  2402. args: ["aString"],
  2403. source: "nextPutVar: aString\x0a\x09stream nextPutAll: 'var ', aString, ';'; lf",
  2404. messageSends: ["nextPutAll:", ",", "lf"],
  2405. referencedClasses: []
  2406. }),
  2407. smalltalk.JSStream);
  2408. smalltalk.addMethod(
  2409. "_nextPutVars_",
  2410. smalltalk.method({
  2411. selector: "nextPutVars:",
  2412. category: 'streaming',
  2413. fn: function (aCollection) {
  2414. var self=this;
  2415. smalltalk.send(self['@stream'], "_nextPutAll_", ["var "]);
  2416. smalltalk.send(aCollection, "_do_separatedBy_", [(function(each){return smalltalk.send(self['@stream'], "_nextPutAll_", [each]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [","]);})]);
  2417. (function($rec){smalltalk.send($rec, "_nextPutAll_", [";"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  2418. return self;},
  2419. args: ["aCollection"],
  2420. source: "nextPutVars: aCollection\x0a\x09stream nextPutAll: 'var '.\x0a\x09aCollection \x0a\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ';'; lf",
  2421. messageSends: ["nextPutAll:", "do:separatedBy:", "lf"],
  2422. referencedClasses: []
  2423. }),
  2424. smalltalk.JSStream);
  2425. smalltalk.addMethod(
  2426. "_appendToInstruction_",
  2427. smalltalk.method({
  2428. selector: "appendToInstruction:",
  2429. category: '*Compiler-IR',
  2430. fn: function (anIRInstruction) {
  2431. var self=this;
  2432. smalltalk.send(anIRInstruction,"_appendBlock_",[self]);
  2433. return self;},
  2434. args: ["anIRInstruction"],
  2435. source: "appendToInstruction: anIRInstruction\x0a anIRInstruction appendBlock: self",
  2436. messageSends: ["appendBlock:"],
  2437. referencedClasses: []
  2438. }),
  2439. smalltalk.BlockClosure);
  2440. smalltalk.addMethod(
  2441. "_asVariableName",
  2442. smalltalk.method({
  2443. selector: "asVariableName",
  2444. category: '*Compiler-IR',
  2445. fn: function () {
  2446. var self=this;
  2447. return ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_reservedWords", []), "_includes_", [self])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "__comma", ["_"]);})() : (function(){return self;})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self, "__comma", ["_"]);}), (function(){return self;})]));
  2448. return self;},
  2449. args: [],
  2450. source: "asVariableName\x0a\x09^ (Smalltalk current reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  2451. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", "current", ","],
  2452. referencedClasses: ["Smalltalk"]
  2453. }),
  2454. smalltalk.String);