1
0

Compiler-IR.js 95 KB

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