Compiler-IR.js 91 KB

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