Compiler-IR.js 109 KB

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