1
0

Compiler-IR.js 90 KB

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