Compiler-IR.js 98 KB

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