Compiler-IR.js 93 KB

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