Compiler-IR.js 91 KB

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