Compiler-IR.deploy.js 60 KB

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