1
0

Compiler-IR.deploy.js 57 KB

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