Compiler-IR.js 90 KB

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