Compiler-IR.js 93 KB

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