Compiler-IR.js 132 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123
  1. define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-Core", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){
  2. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  3. smalltalk.addPackage('Compiler-IR');
  4. smalltalk.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5. smalltalk.addClass('IRASTTranslator', globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  6. globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  7. smalltalk.addMethod(
  8. smalltalk.method({
  9. selector: "alias:",
  10. protocol: 'visiting',
  11. fn: function (aNode){
  12. var self=this;
  13. var variable;
  14. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  15. function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  16. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  17. return smalltalk.withContext(function($ctx1) {
  18. var $1,$2,$3,$4,$6,$5,$7,$8,$10,$11,$9,$12;
  19. $1=_st(aNode)._isImmutable();
  20. if(smalltalk.assert($1)){
  21. $2=self._visit_(aNode);
  22. $ctx1.sendIdx["visit:"]=1;
  23. return $2;
  24. };
  25. $3=_st($IRVariable())._new();
  26. $ctx1.sendIdx["new"]=1;
  27. $4=$3;
  28. $6=_st($AliasVar())._new();
  29. $ctx1.sendIdx["new"]=2;
  30. $5=_st($6)._name_("$".__comma(self._nextAlias()));
  31. _st($4)._variable_($5);
  32. $7=_st($3)._yourself();
  33. $ctx1.sendIdx["yourself"]=1;
  34. variable=$7;
  35. $8=self._sequence();
  36. $10=_st($IRAssignment())._new();
  37. _st($10)._add_(variable);
  38. $ctx1.sendIdx["add:"]=2;
  39. _st($10)._add_(self._visit_(aNode));
  40. $ctx1.sendIdx["add:"]=3;
  41. $11=_st($10)._yourself();
  42. $9=$11;
  43. _st($8)._add_($9);
  44. $ctx1.sendIdx["add:"]=1;
  45. _st(_st(self._method())._internalVariables())._add_(variable);
  46. $12=variable;
  47. return $12;
  48. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},globals.IRASTTranslator)})},
  49. args: ["aNode"],
  50. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable 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",
  51. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"],
  52. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"]
  53. }),
  54. globals.IRASTTranslator);
  55. smalltalk.addMethod(
  56. smalltalk.method({
  57. selector: "aliasTemporally:",
  58. protocol: 'visiting',
  59. fn: function (aCollection){
  60. var self=this;
  61. var threshold,result;
  62. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  63. return smalltalk.withContext(function($ctx1) {
  64. var $1,$2,$4,$3,$5;
  65. threshold=(0);
  66. _st(aCollection)._withIndexDo_((function(each,i){
  67. return smalltalk.withContext(function($ctx2) {
  68. $1=_st(each)._subtreeNeedsAliasing();
  69. if(smalltalk.assert($1)){
  70. threshold=i;
  71. return threshold;
  72. };
  73. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)})}));
  74. $ctx1.sendIdx["withIndexDo:"]=1;
  75. result=_st($OrderedCollection())._new();
  76. _st(aCollection)._withIndexDo_((function(each,i){
  77. return smalltalk.withContext(function($ctx2) {
  78. $2=result;
  79. $4=_st(i).__lt_eq(threshold);
  80. if(smalltalk.assert($4)){
  81. $3=self._alias_(each);
  82. } else {
  83. $3=self._visit_(each);
  84. };
  85. return _st($2)._add_($3);
  86. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)})}));
  87. $5=result;
  88. return $5;
  89. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},globals.IRASTTranslator)})},
  90. args: ["aCollection"],
  91. source: "aliasTemporally: aCollection\x0a\x09\x22https://github.com/NicolasPetton/amber/issues/296\x0a\x09\x0a\x09If a node is aliased, all preceding ones are aliased as well.\x0a\x09The tree is iterated twice. First we get the aliasing dependency,\x0a\x09then the aliasing itself is done\x22\x0a\x0a\x09| threshold result |\x0a\x09threshold := 0.\x0a\x09\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09each subtreeNeedsAliasing\x0a\x09\x09\x09ifTrue: [ threshold := i ] ].\x0a\x0a\x09result := OrderedCollection new.\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09result add: (i <= threshold\x0a\x09\x09\x09ifTrue: [ self alias: each ]\x0a\x09\x09\x09ifFalse: [ self visit: each ]) ].\x0a\x0a\x09^ result",
  92. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"],
  93. referencedClasses: ["OrderedCollection"]
  94. }),
  95. globals.IRASTTranslator);
  96. smalltalk.addMethod(
  97. smalltalk.method({
  98. selector: "method",
  99. protocol: 'accessing',
  100. fn: function (){
  101. var self=this;
  102. var $1;
  103. $1=self["@method"];
  104. return $1;
  105. },
  106. args: [],
  107. source: "method\x0a\x09^ method",
  108. messageSends: [],
  109. referencedClasses: []
  110. }),
  111. globals.IRASTTranslator);
  112. smalltalk.addMethod(
  113. smalltalk.method({
  114. selector: "method:",
  115. protocol: 'accessing',
  116. fn: function (anIRMethod){
  117. var self=this;
  118. self["@method"]=anIRMethod;
  119. return self},
  120. args: ["anIRMethod"],
  121. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  122. messageSends: [],
  123. referencedClasses: []
  124. }),
  125. globals.IRASTTranslator);
  126. smalltalk.addMethod(
  127. smalltalk.method({
  128. selector: "nextAlias",
  129. protocol: 'accessing',
  130. fn: function (){
  131. var self=this;
  132. return smalltalk.withContext(function($ctx1) {
  133. var $1,$2,$receiver;
  134. $1=self["@nextAlias"];
  135. if(($receiver = $1) == null || $receiver.isNil){
  136. self["@nextAlias"]=(0);
  137. self["@nextAlias"];
  138. } else {
  139. $1;
  140. };
  141. self["@nextAlias"]=_st(self["@nextAlias"]).__plus((1));
  142. $2=_st(self["@nextAlias"])._asString();
  143. return $2;
  144. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},globals.IRASTTranslator)})},
  145. args: [],
  146. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  147. messageSends: ["ifNil:", "+", "asString"],
  148. referencedClasses: []
  149. }),
  150. globals.IRASTTranslator);
  151. smalltalk.addMethod(
  152. smalltalk.method({
  153. selector: "sequence",
  154. protocol: 'accessing',
  155. fn: function (){
  156. var self=this;
  157. var $1;
  158. $1=self["@sequence"];
  159. return $1;
  160. },
  161. args: [],
  162. source: "sequence\x0a\x09^ sequence",
  163. messageSends: [],
  164. referencedClasses: []
  165. }),
  166. globals.IRASTTranslator);
  167. smalltalk.addMethod(
  168. smalltalk.method({
  169. selector: "sequence:",
  170. protocol: 'accessing',
  171. fn: function (anIRSequence){
  172. var self=this;
  173. self["@sequence"]=anIRSequence;
  174. return self},
  175. args: ["anIRSequence"],
  176. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  177. messageSends: [],
  178. referencedClasses: []
  179. }),
  180. globals.IRASTTranslator);
  181. smalltalk.addMethod(
  182. smalltalk.method({
  183. selector: "source",
  184. protocol: 'accessing',
  185. fn: function (){
  186. var self=this;
  187. var $1;
  188. $1=self["@source"];
  189. return $1;
  190. },
  191. args: [],
  192. source: "source\x0a\x09^ source",
  193. messageSends: [],
  194. referencedClasses: []
  195. }),
  196. globals.IRASTTranslator);
  197. smalltalk.addMethod(
  198. smalltalk.method({
  199. selector: "source:",
  200. protocol: 'accessing',
  201. fn: function (aString){
  202. var self=this;
  203. self["@source"]=aString;
  204. return self},
  205. args: ["aString"],
  206. source: "source: aString\x0a\x09source := aString",
  207. messageSends: [],
  208. referencedClasses: []
  209. }),
  210. globals.IRASTTranslator);
  211. smalltalk.addMethod(
  212. smalltalk.method({
  213. selector: "theClass",
  214. protocol: 'accessing',
  215. fn: function (){
  216. var self=this;
  217. var $1;
  218. $1=self["@theClass"];
  219. return $1;
  220. },
  221. args: [],
  222. source: "theClass\x0a\x09^ theClass",
  223. messageSends: [],
  224. referencedClasses: []
  225. }),
  226. globals.IRASTTranslator);
  227. smalltalk.addMethod(
  228. smalltalk.method({
  229. selector: "theClass:",
  230. protocol: 'accessing',
  231. fn: function (aClass){
  232. var self=this;
  233. self["@theClass"]=aClass;
  234. return self},
  235. args: ["aClass"],
  236. source: "theClass: aClass\x0a\x09theClass := aClass",
  237. messageSends: [],
  238. referencedClasses: []
  239. }),
  240. globals.IRASTTranslator);
  241. smalltalk.addMethod(
  242. smalltalk.method({
  243. selector: "visitAssignmentNode:",
  244. protocol: 'visiting',
  245. fn: function (aNode){
  246. var self=this;
  247. var left,right,assignment;
  248. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  249. return smalltalk.withContext(function($ctx1) {
  250. var $1,$3,$4,$2,$5;
  251. right=self._visit_(_st(aNode)._right());
  252. $ctx1.sendIdx["visit:"]=1;
  253. left=self._visit_(_st(aNode)._left());
  254. $1=self._sequence();
  255. $3=_st($IRAssignment())._new();
  256. _st($3)._add_(left);
  257. $ctx1.sendIdx["add:"]=2;
  258. _st($3)._add_(right);
  259. $4=_st($3)._yourself();
  260. $2=$4;
  261. _st($1)._add_($2);
  262. $ctx1.sendIdx["add:"]=1;
  263. $5=left;
  264. return $5;
  265. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},globals.IRASTTranslator)})},
  266. args: ["aNode"],
  267. 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",
  268. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"],
  269. referencedClasses: ["IRAssignment"]
  270. }),
  271. globals.IRASTTranslator);
  272. smalltalk.addMethod(
  273. smalltalk.method({
  274. selector: "visitBlockNode:",
  275. protocol: 'visiting',
  276. fn: function (aNode){
  277. var self=this;
  278. var closure;
  279. function $IRClosure(){return globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  280. function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  281. return smalltalk.withContext(function($ctx1) {
  282. var $1,$2,$3,$4,$6,$5,$7,$8,$9;
  283. $1=_st($IRClosure())._new();
  284. $ctx1.sendIdx["new"]=1;
  285. _st($1)._arguments_(_st(aNode)._parameters());
  286. _st($1)._requiresSmalltalkContext_(_st(aNode)._requiresSmalltalkContext());
  287. $2=$1;
  288. $3=_st(aNode)._scope();
  289. $ctx1.sendIdx["scope"]=1;
  290. _st($2)._scope_($3);
  291. $ctx1.sendIdx["scope:"]=1;
  292. $4=_st($1)._yourself();
  293. $ctx1.sendIdx["yourself"]=1;
  294. closure=$4;
  295. $6=_st(aNode)._scope();
  296. $ctx1.sendIdx["scope"]=2;
  297. $5=_st($6)._temps();
  298. _st($5)._do_((function(each){
  299. return smalltalk.withContext(function($ctx2) {
  300. $7=_st($IRTempDeclaration())._new();
  301. _st($7)._name_(_st(each)._name());
  302. _st($7)._scope_(_st(aNode)._scope());
  303. $8=_st($7)._yourself();
  304. return _st(closure)._add_($8);
  305. $ctx2.sendIdx["add:"]=1;
  306. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  307. $ctx1.sendIdx["do:"]=1;
  308. _st(_st(aNode)._nodes())._do_((function(each){
  309. return smalltalk.withContext(function($ctx2) {
  310. return _st(closure)._add_(self._visit_(each));
  311. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  312. $9=closure;
  313. return $9;
  314. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},globals.IRASTTranslator)})},
  315. args: ["aNode"],
  316. source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\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\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x09aNode nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
  317. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"],
  318. referencedClasses: ["IRClosure", "IRTempDeclaration"]
  319. }),
  320. globals.IRASTTranslator);
  321. smalltalk.addMethod(
  322. smalltalk.method({
  323. selector: "visitBlockSequenceNode:",
  324. protocol: 'visiting',
  325. fn: function (aNode){
  326. var self=this;
  327. function $IRBlockSequence(){return globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  328. function $IRBlockReturn(){return globals.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)}
  329. return smalltalk.withContext(function($ctx1) {
  330. var $2,$3,$5,$4,$6,$7,$10,$9,$8,$11,$13,$14,$17,$16,$15,$18,$12,$1;
  331. $2=_st($IRBlockSequence())._new();
  332. $ctx1.sendIdx["new"]=1;
  333. $1=self._withSequence_do_($2,(function(){
  334. return smalltalk.withContext(function($ctx2) {
  335. $3=_st(aNode)._nodes();
  336. $ctx2.sendIdx["nodes"]=1;
  337. return _st($3)._ifNotEmpty_((function(){
  338. return smalltalk.withContext(function($ctx3) {
  339. $5=_st(aNode)._nodes();
  340. $ctx3.sendIdx["nodes"]=2;
  341. $4=_st($5)._allButLast();
  342. _st($4)._do_((function(each){
  343. return smalltalk.withContext(function($ctx4) {
  344. $6=self._sequence();
  345. $ctx4.sendIdx["sequence"]=1;
  346. $7=self._visitOrAlias_(each);
  347. $ctx4.sendIdx["visitOrAlias:"]=1;
  348. return _st($6)._add_($7);
  349. $ctx4.sendIdx["add:"]=1;
  350. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)})}));
  351. $10=_st(aNode)._nodes();
  352. $ctx3.sendIdx["nodes"]=3;
  353. $9=_st($10)._last();
  354. $ctx3.sendIdx["last"]=1;
  355. $8=_st($9)._isReturnNode();
  356. if(smalltalk.assert($8)){
  357. return _st(self._sequence())._add_(self._visitOrAlias_(_st(_st(aNode)._nodes())._last()));
  358. } else {
  359. $11=self._sequence();
  360. $ctx3.sendIdx["sequence"]=2;
  361. $13=_st($IRBlockReturn())._new();
  362. $14=$13;
  363. $17=_st(aNode)._nodes();
  364. $ctx3.sendIdx["nodes"]=4;
  365. $16=_st($17)._last();
  366. $ctx3.sendIdx["last"]=2;
  367. $15=self._visitOrAlias_($16);
  368. $ctx3.sendIdx["visitOrAlias:"]=2;
  369. _st($14)._add_($15);
  370. $ctx3.sendIdx["add:"]=3;
  371. $18=_st($13)._yourself();
  372. $12=$18;
  373. return _st($11)._add_($12);
  374. $ctx3.sendIdx["add:"]=2;
  375. };
  376. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  377. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  378. return $1;
  379. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},globals.IRASTTranslator)})},
  380. args: ["aNode"],
  381. 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 visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode nodes last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode nodes last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode nodes last) ] ]]",
  382. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"],
  383. referencedClasses: ["IRBlockSequence", "IRBlockReturn"]
  384. }),
  385. globals.IRASTTranslator);
  386. smalltalk.addMethod(
  387. smalltalk.method({
  388. selector: "visitCascadeNode:",
  389. protocol: 'visiting',
  390. fn: function (aNode){
  391. var self=this;
  392. var alias,receiver;
  393. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  394. return smalltalk.withContext(function($ctx1) {
  395. var $2,$1,$3,$5,$4,$6;
  396. $2=_st(aNode)._receiver();
  397. $ctx1.sendIdx["receiver"]=1;
  398. $1=_st($2)._isImmutable();
  399. if(smalltalk.assert($1)){
  400. receiver=_st(aNode)._receiver();
  401. $ctx1.sendIdx["receiver"]=2;
  402. receiver;
  403. } else {
  404. alias=self._alias_(_st(aNode)._receiver());
  405. $ctx1.sendIdx["alias:"]=1;
  406. alias;
  407. receiver=_st(_st($VariableNode())._new())._binding_(_st(alias)._variable());
  408. receiver;
  409. };
  410. $3=_st(aNode)._nodes();
  411. $ctx1.sendIdx["nodes"]=1;
  412. _st($3)._do_((function(each){
  413. return smalltalk.withContext(function($ctx2) {
  414. return _st(each)._receiver_(receiver);
  415. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  416. $ctx1.sendIdx["do:"]=1;
  417. $5=_st(aNode)._nodes();
  418. $ctx1.sendIdx["nodes"]=2;
  419. $4=_st($5)._allButLast();
  420. _st($4)._do_((function(each){
  421. return smalltalk.withContext(function($ctx2) {
  422. return _st(self._sequence())._add_(self._visit_(each));
  423. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  424. $6=self._alias_(_st(_st(aNode)._nodes())._last());
  425. return $6;
  426. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias,receiver:receiver},globals.IRASTTranslator)})},
  427. args: ["aNode"],
  428. source: "visitCascadeNode: aNode\x0a\x09| alias receiver |\x0a\x0a\x09aNode receiver isImmutable \x0a\x09\x09ifTrue: [ receiver := aNode receiver ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09alias := self alias: aNode receiver.\x0a\x09\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09\x09each receiver: receiver ].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self alias: aNode nodes last",
  429. messageSends: ["ifTrue:ifFalse:", "isImmutable", "receiver", "alias:", "binding:", "new", "variable", "do:", "nodes", "receiver:", "allButLast", "add:", "sequence", "visit:", "last"],
  430. referencedClasses: ["VariableNode"]
  431. }),
  432. globals.IRASTTranslator);
  433. smalltalk.addMethod(
  434. smalltalk.method({
  435. selector: "visitDynamicArrayNode:",
  436. protocol: 'visiting',
  437. fn: function (aNode){
  438. var self=this;
  439. var array;
  440. function $IRDynamicArray(){return globals.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)}
  441. return smalltalk.withContext(function($ctx1) {
  442. var $1;
  443. array=_st($IRDynamicArray())._new();
  444. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  445. return smalltalk.withContext(function($ctx2) {
  446. return _st(array)._add_(each);
  447. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  448. $1=array;
  449. return $1;
  450. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},globals.IRASTTranslator)})},
  451. args: ["aNode"],
  452. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
  453. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"],
  454. referencedClasses: ["IRDynamicArray"]
  455. }),
  456. globals.IRASTTranslator);
  457. smalltalk.addMethod(
  458. smalltalk.method({
  459. selector: "visitDynamicDictionaryNode:",
  460. protocol: 'visiting',
  461. fn: function (aNode){
  462. var self=this;
  463. var dictionary;
  464. function $IRDynamicDictionary(){return globals.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)}
  465. return smalltalk.withContext(function($ctx1) {
  466. var $1;
  467. dictionary=_st($IRDynamicDictionary())._new();
  468. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  469. return smalltalk.withContext(function($ctx2) {
  470. return _st(dictionary)._add_(each);
  471. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  472. $1=dictionary;
  473. return $1;
  474. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},globals.IRASTTranslator)})},
  475. args: ["aNode"],
  476. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  477. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"],
  478. referencedClasses: ["IRDynamicDictionary"]
  479. }),
  480. globals.IRASTTranslator);
  481. smalltalk.addMethod(
  482. smalltalk.method({
  483. selector: "visitJSStatementNode:",
  484. protocol: 'visiting',
  485. fn: function (aNode){
  486. var self=this;
  487. function $IRVerbatim(){return globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  488. return smalltalk.withContext(function($ctx1) {
  489. var $2,$3,$1;
  490. $2=_st($IRVerbatim())._new();
  491. _st($2)._source_(_st(_st(aNode)._source())._crlfSanitized());
  492. $3=_st($2)._yourself();
  493. $1=$3;
  494. return $1;
  495. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},globals.IRASTTranslator)})},
  496. args: ["aNode"],
  497. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  498. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"],
  499. referencedClasses: ["IRVerbatim"]
  500. }),
  501. globals.IRASTTranslator);
  502. smalltalk.addMethod(
  503. smalltalk.method({
  504. selector: "visitMethodNode:",
  505. protocol: 'visiting',
  506. fn: function (aNode){
  507. var self=this;
  508. function $IRMethod(){return globals.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)}
  509. function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  510. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  511. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  512. return smalltalk.withContext(function($ctx1) {
  513. var $2,$3,$4,$5,$1,$7,$6,$8,$10,$11,$12,$13,$9,$14,$16,$15,$18,$19,$17,$20,$21,$22;
  514. $2=_st($IRMethod())._new();
  515. $ctx1.sendIdx["new"]=1;
  516. _st($2)._source_(_st(self._source())._crlfSanitized());
  517. _st($2)._theClass_(self._theClass());
  518. _st($2)._arguments_(_st(aNode)._arguments());
  519. _st($2)._selector_(_st(aNode)._selector());
  520. _st($2)._sendIndexes_(_st(aNode)._sendIndexes());
  521. _st($2)._superSends_(_st(aNode)._superSends());
  522. _st($2)._requiresSmalltalkContext_(_st(aNode)._requiresSmalltalkContext());
  523. _st($2)._classReferences_(_st(aNode)._classReferences());
  524. $3=$2;
  525. $4=_st(aNode)._scope();
  526. $ctx1.sendIdx["scope"]=1;
  527. _st($3)._scope_($4);
  528. $ctx1.sendIdx["scope:"]=1;
  529. $5=_st($2)._yourself();
  530. $ctx1.sendIdx["yourself"]=1;
  531. $1=$5;
  532. self._method_($1);
  533. $7=_st(aNode)._scope();
  534. $ctx1.sendIdx["scope"]=2;
  535. $6=_st($7)._temps();
  536. _st($6)._do_((function(each){
  537. return smalltalk.withContext(function($ctx2) {
  538. $8=self._method();
  539. $ctx2.sendIdx["method"]=1;
  540. $10=_st($IRTempDeclaration())._new();
  541. $ctx2.sendIdx["new"]=2;
  542. _st($10)._name_(_st(each)._name());
  543. $11=$10;
  544. $12=_st(aNode)._scope();
  545. $ctx2.sendIdx["scope"]=3;
  546. _st($11)._scope_($12);
  547. $13=_st($10)._yourself();
  548. $ctx2.sendIdx["yourself"]=2;
  549. $9=$13;
  550. return _st($8)._add_($9);
  551. $ctx2.sendIdx["add:"]=1;
  552. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  553. $ctx1.sendIdx["do:"]=1;
  554. _st(_st(aNode)._nodes())._do_((function(each){
  555. return smalltalk.withContext(function($ctx2) {
  556. $14=self._method();
  557. $ctx2.sendIdx["method"]=2;
  558. return _st($14)._add_(self._visit_(each));
  559. $ctx2.sendIdx["add:"]=2;
  560. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  561. $16=_st(aNode)._scope();
  562. $ctx1.sendIdx["scope"]=4;
  563. $15=_st($16)._hasLocalReturn();
  564. if(! smalltalk.assert($15)){
  565. $18=self._method();
  566. $ctx1.sendIdx["method"]=3;
  567. $19=_st($IRReturn())._new();
  568. $ctx1.sendIdx["new"]=3;
  569. $17=_st($18)._add_($19);
  570. $20=_st($IRVariable())._new();
  571. _st($20)._variable_(_st(_st(_st(aNode)._scope())._pseudoVars())._at_("self"));
  572. $21=_st($20)._yourself();
  573. _st($17)._add_($21);
  574. $ctx1.sendIdx["add:"]=3;
  575. };
  576. $22=self._method();
  577. return $22;
  578. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},globals.IRASTTranslator)})},
  579. args: ["aNode"],
  580. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09superSends: aNode superSends;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\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\x09scope: aNode scope;\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",
  581. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "superSends:", "superSends", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"],
  582. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable"]
  583. }),
  584. globals.IRASTTranslator);
  585. smalltalk.addMethod(
  586. smalltalk.method({
  587. selector: "visitOrAlias:",
  588. protocol: 'visiting',
  589. fn: function (aNode){
  590. var self=this;
  591. return smalltalk.withContext(function($ctx1) {
  592. var $2,$1;
  593. $2=_st(aNode)._shouldBeAliased();
  594. if(smalltalk.assert($2)){
  595. $1=self._alias_(aNode);
  596. } else {
  597. $1=self._visit_(aNode);
  598. };
  599. return $1;
  600. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},globals.IRASTTranslator)})},
  601. args: ["aNode"],
  602. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  603. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"],
  604. referencedClasses: []
  605. }),
  606. globals.IRASTTranslator);
  607. smalltalk.addMethod(
  608. smalltalk.method({
  609. selector: "visitReturnNode:",
  610. protocol: 'visiting',
  611. fn: function (aNode){
  612. var self=this;
  613. var return_;
  614. function $IRNonLocalReturn(){return globals.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)}
  615. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  616. return smalltalk.withContext(function($ctx1) {
  617. var $1,$2;
  618. $1=_st(aNode)._nonLocalReturn();
  619. if(smalltalk.assert($1)){
  620. return_=_st($IRNonLocalReturn())._new();
  621. $ctx1.sendIdx["new"]=1;
  622. } else {
  623. return_=_st($IRReturn())._new();
  624. };
  625. _st(return_)._scope_(_st(aNode)._scope());
  626. _st(_st(aNode)._nodes())._do_((function(each){
  627. return smalltalk.withContext(function($ctx2) {
  628. return _st(return_)._add_(self._alias_(each));
  629. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  630. $2=return_;
  631. return $2;
  632. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},globals.IRASTTranslator)})},
  633. args: ["aNode"],
  634. 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",
  635. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "alias:"],
  636. referencedClasses: ["IRNonLocalReturn", "IRReturn"]
  637. }),
  638. globals.IRASTTranslator);
  639. smalltalk.addMethod(
  640. smalltalk.method({
  641. selector: "visitSendNode:",
  642. protocol: 'visiting',
  643. fn: function (aNode){
  644. var self=this;
  645. var send,all,receiver,arguments;
  646. function $IRSend(){return globals.IRSend||(typeof IRSend=="undefined"?nil:IRSend)}
  647. return smalltalk.withContext(function($ctx1) {
  648. var $1,$2,$3,$4;
  649. send=_st($IRSend())._new();
  650. $1=send;
  651. _st($1)._selector_(_st(aNode)._selector());
  652. $2=_st($1)._index_(_st(aNode)._index());
  653. $3=_st(aNode)._superSend();
  654. if(smalltalk.assert($3)){
  655. _st(send)._classSend_(_st(self._theClass())._superclass());
  656. };
  657. all=self._aliasTemporally_(_st([_st(aNode)._receiver()]).__comma(_st(aNode)._arguments()));
  658. receiver=_st(all)._first();
  659. arguments=_st(all)._allButFirst();
  660. _st(send)._add_(receiver);
  661. $ctx1.sendIdx["add:"]=1;
  662. _st(arguments)._do_((function(each){
  663. return smalltalk.withContext(function($ctx2) {
  664. return _st(send)._add_(each);
  665. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  666. $4=send;
  667. return $4;
  668. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments:arguments},globals.IRASTTranslator)})},
  669. args: ["aNode"],
  670. source: "visitSendNode: aNode\x0a\x09| send all 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\x09\x0a\x09all := self aliasTemporally: { aNode receiver }, aNode arguments.\x0a\x09receiver := all first.\x0a\x09arguments := all allButFirst.\x0a\x0a\x09send add: receiver.\x0a\x09arguments do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  671. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "aliasTemporally:", ",", "receiver", "arguments", "first", "allButFirst", "add:", "do:"],
  672. referencedClasses: ["IRSend"]
  673. }),
  674. globals.IRASTTranslator);
  675. smalltalk.addMethod(
  676. smalltalk.method({
  677. selector: "visitSequenceNode:",
  678. protocol: 'visiting',
  679. fn: function (aNode){
  680. var self=this;
  681. function $IRSequence(){return globals.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)}
  682. return smalltalk.withContext(function($ctx1) {
  683. var $2,$1;
  684. $1=self._withSequence_do_(_st($IRSequence())._new(),(function(){
  685. return smalltalk.withContext(function($ctx2) {
  686. return _st(_st(aNode)._nodes())._do_((function(each){
  687. var instruction;
  688. return smalltalk.withContext(function($ctx3) {
  689. instruction=self._visitOrAlias_(each);
  690. instruction;
  691. $2=_st(instruction)._isVariable();
  692. if(! smalltalk.assert($2)){
  693. return _st(self._sequence())._add_(instruction);
  694. };
  695. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)})}));
  696. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  697. return $1;
  698. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.IRASTTranslator)})},
  699. args: ["aNode"],
  700. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visitOrAlias: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ] ]]",
  701. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"],
  702. referencedClasses: ["IRSequence"]
  703. }),
  704. globals.IRASTTranslator);
  705. smalltalk.addMethod(
  706. smalltalk.method({
  707. selector: "visitValueNode:",
  708. protocol: 'visiting',
  709. fn: function (aNode){
  710. var self=this;
  711. function $IRValue(){return globals.IRValue||(typeof IRValue=="undefined"?nil:IRValue)}
  712. return smalltalk.withContext(function($ctx1) {
  713. var $2,$3,$1;
  714. $2=_st($IRValue())._new();
  715. _st($2)._value_(_st(aNode)._value());
  716. $3=_st($2)._yourself();
  717. $1=$3;
  718. return $1;
  719. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},globals.IRASTTranslator)})},
  720. args: ["aNode"],
  721. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  722. messageSends: ["value:", "new", "value", "yourself"],
  723. referencedClasses: ["IRValue"]
  724. }),
  725. globals.IRASTTranslator);
  726. smalltalk.addMethod(
  727. smalltalk.method({
  728. selector: "visitVariableNode:",
  729. protocol: 'visiting',
  730. fn: function (aNode){
  731. var self=this;
  732. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  733. return smalltalk.withContext(function($ctx1) {
  734. var $2,$3,$1;
  735. $2=_st($IRVariable())._new();
  736. _st($2)._variable_(_st(aNode)._binding());
  737. $3=_st($2)._yourself();
  738. $1=$3;
  739. return $1;
  740. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.IRASTTranslator)})},
  741. args: ["aNode"],
  742. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  743. messageSends: ["variable:", "new", "binding", "yourself"],
  744. referencedClasses: ["IRVariable"]
  745. }),
  746. globals.IRASTTranslator);
  747. smalltalk.addMethod(
  748. smalltalk.method({
  749. selector: "withSequence:do:",
  750. protocol: 'accessing',
  751. fn: function (aSequence,aBlock){
  752. var self=this;
  753. var outerSequence;
  754. return smalltalk.withContext(function($ctx1) {
  755. outerSequence=self._sequence();
  756. self._sequence_(aSequence);
  757. $ctx1.sendIdx["sequence:"]=1;
  758. _st(aBlock)._value();
  759. self._sequence_(outerSequence);
  760. return aSequence;
  761. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},globals.IRASTTranslator)})},
  762. args: ["aSequence", "aBlock"],
  763. 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",
  764. messageSends: ["sequence", "sequence:", "value"],
  765. referencedClasses: []
  766. }),
  767. globals.IRASTTranslator);
  768. smalltalk.addClass('IRInstruction', globals.Object, ['parent', 'instructions'], 'Compiler-IR');
  769. globals.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.";
  770. smalltalk.addMethod(
  771. smalltalk.method({
  772. selector: "accept:",
  773. protocol: 'visiting',
  774. fn: function (aVisitor){
  775. var self=this;
  776. return smalltalk.withContext(function($ctx1) {
  777. var $1;
  778. $1=_st(aVisitor)._visitIRInstruction_(self);
  779. return $1;
  780. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInstruction)})},
  781. args: ["aVisitor"],
  782. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  783. messageSends: ["visitIRInstruction:"],
  784. referencedClasses: []
  785. }),
  786. globals.IRInstruction);
  787. smalltalk.addMethod(
  788. smalltalk.method({
  789. selector: "add:",
  790. protocol: 'building',
  791. fn: function (anObject){
  792. var self=this;
  793. return smalltalk.withContext(function($ctx1) {
  794. var $1;
  795. _st(anObject)._parent_(self);
  796. $1=_st(self._instructions())._add_(anObject);
  797. return $1;
  798. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.IRInstruction)})},
  799. args: ["anObject"],
  800. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  801. messageSends: ["parent:", "add:", "instructions"],
  802. referencedClasses: []
  803. }),
  804. globals.IRInstruction);
  805. smalltalk.addMethod(
  806. smalltalk.method({
  807. selector: "canBeAssigned",
  808. protocol: 'testing',
  809. fn: function (){
  810. var self=this;
  811. return true;
  812. },
  813. args: [],
  814. source: "canBeAssigned\x0a\x09^ true",
  815. messageSends: [],
  816. referencedClasses: []
  817. }),
  818. globals.IRInstruction);
  819. smalltalk.addMethod(
  820. smalltalk.method({
  821. selector: "instructions",
  822. protocol: 'accessing',
  823. fn: function (){
  824. var self=this;
  825. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  826. return smalltalk.withContext(function($ctx1) {
  827. var $2,$1,$receiver;
  828. $2=self["@instructions"];
  829. if(($receiver = $2) == null || $receiver.isNil){
  830. self["@instructions"]=_st($OrderedCollection())._new();
  831. $1=self["@instructions"];
  832. } else {
  833. $1=$2;
  834. };
  835. return $1;
  836. }, function($ctx1) {$ctx1.fill(self,"instructions",{},globals.IRInstruction)})},
  837. args: [],
  838. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  839. messageSends: ["ifNil:", "new"],
  840. referencedClasses: ["OrderedCollection"]
  841. }),
  842. globals.IRInstruction);
  843. smalltalk.addMethod(
  844. smalltalk.method({
  845. selector: "isClosure",
  846. protocol: 'testing',
  847. fn: function (){
  848. var self=this;
  849. return false;
  850. },
  851. args: [],
  852. source: "isClosure\x0a\x09^ false",
  853. messageSends: [],
  854. referencedClasses: []
  855. }),
  856. globals.IRInstruction);
  857. smalltalk.addMethod(
  858. smalltalk.method({
  859. selector: "isInlined",
  860. protocol: 'testing',
  861. fn: function (){
  862. var self=this;
  863. return false;
  864. },
  865. args: [],
  866. source: "isInlined\x0a\x09^ false",
  867. messageSends: [],
  868. referencedClasses: []
  869. }),
  870. globals.IRInstruction);
  871. smalltalk.addMethod(
  872. smalltalk.method({
  873. selector: "isLocalReturn",
  874. protocol: 'testing',
  875. fn: function (){
  876. var self=this;
  877. return false;
  878. },
  879. args: [],
  880. source: "isLocalReturn\x0a\x09^ false",
  881. messageSends: [],
  882. referencedClasses: []
  883. }),
  884. globals.IRInstruction);
  885. smalltalk.addMethod(
  886. smalltalk.method({
  887. selector: "isMethod",
  888. protocol: 'testing',
  889. fn: function (){
  890. var self=this;
  891. return false;
  892. },
  893. args: [],
  894. source: "isMethod\x0a\x09^ false",
  895. messageSends: [],
  896. referencedClasses: []
  897. }),
  898. globals.IRInstruction);
  899. smalltalk.addMethod(
  900. smalltalk.method({
  901. selector: "isReturn",
  902. protocol: 'testing',
  903. fn: function (){
  904. var self=this;
  905. return false;
  906. },
  907. args: [],
  908. source: "isReturn\x0a\x09^ false",
  909. messageSends: [],
  910. referencedClasses: []
  911. }),
  912. globals.IRInstruction);
  913. smalltalk.addMethod(
  914. smalltalk.method({
  915. selector: "isSend",
  916. protocol: 'testing',
  917. fn: function (){
  918. var self=this;
  919. return false;
  920. },
  921. args: [],
  922. source: "isSend\x0a\x09^ false",
  923. messageSends: [],
  924. referencedClasses: []
  925. }),
  926. globals.IRInstruction);
  927. smalltalk.addMethod(
  928. smalltalk.method({
  929. selector: "isSequence",
  930. protocol: 'testing',
  931. fn: function (){
  932. var self=this;
  933. return false;
  934. },
  935. args: [],
  936. source: "isSequence\x0a\x09^ false",
  937. messageSends: [],
  938. referencedClasses: []
  939. }),
  940. globals.IRInstruction);
  941. smalltalk.addMethod(
  942. smalltalk.method({
  943. selector: "isTempDeclaration",
  944. protocol: 'testing',
  945. fn: function (){
  946. var self=this;
  947. return false;
  948. },
  949. args: [],
  950. source: "isTempDeclaration\x0a\x09^ false",
  951. messageSends: [],
  952. referencedClasses: []
  953. }),
  954. globals.IRInstruction);
  955. smalltalk.addMethod(
  956. smalltalk.method({
  957. selector: "isVariable",
  958. protocol: 'testing',
  959. fn: function (){
  960. var self=this;
  961. return false;
  962. },
  963. args: [],
  964. source: "isVariable\x0a\x09^ false",
  965. messageSends: [],
  966. referencedClasses: []
  967. }),
  968. globals.IRInstruction);
  969. smalltalk.addMethod(
  970. smalltalk.method({
  971. selector: "method",
  972. protocol: 'accessing',
  973. fn: function (){
  974. var self=this;
  975. return smalltalk.withContext(function($ctx1) {
  976. var $1;
  977. $1=_st(self._parent())._method();
  978. return $1;
  979. }, function($ctx1) {$ctx1.fill(self,"method",{},globals.IRInstruction)})},
  980. args: [],
  981. source: "method\x0a\x09^ self parent method",
  982. messageSends: ["method", "parent"],
  983. referencedClasses: []
  984. }),
  985. globals.IRInstruction);
  986. smalltalk.addMethod(
  987. smalltalk.method({
  988. selector: "needsBoxingAsReceiver",
  989. protocol: 'testing',
  990. fn: function (){
  991. var self=this;
  992. return true;
  993. },
  994. args: [],
  995. source: "needsBoxingAsReceiver\x0a\x09^ true",
  996. messageSends: [],
  997. referencedClasses: []
  998. }),
  999. globals.IRInstruction);
  1000. smalltalk.addMethod(
  1001. smalltalk.method({
  1002. selector: "parent",
  1003. protocol: 'accessing',
  1004. fn: function (){
  1005. var self=this;
  1006. var $1;
  1007. $1=self["@parent"];
  1008. return $1;
  1009. },
  1010. args: [],
  1011. source: "parent\x0a\x09^ parent",
  1012. messageSends: [],
  1013. referencedClasses: []
  1014. }),
  1015. globals.IRInstruction);
  1016. smalltalk.addMethod(
  1017. smalltalk.method({
  1018. selector: "parent:",
  1019. protocol: 'accessing',
  1020. fn: function (anIRInstruction){
  1021. var self=this;
  1022. self["@parent"]=anIRInstruction;
  1023. return self},
  1024. args: ["anIRInstruction"],
  1025. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  1026. messageSends: [],
  1027. referencedClasses: []
  1028. }),
  1029. globals.IRInstruction);
  1030. smalltalk.addMethod(
  1031. smalltalk.method({
  1032. selector: "remove",
  1033. protocol: 'building',
  1034. fn: function (){
  1035. var self=this;
  1036. return smalltalk.withContext(function($ctx1) {
  1037. _st(self._parent())._remove_(self);
  1038. return self}, function($ctx1) {$ctx1.fill(self,"remove",{},globals.IRInstruction)})},
  1039. args: [],
  1040. source: "remove\x0a\x09self parent remove: self",
  1041. messageSends: ["remove:", "parent"],
  1042. referencedClasses: []
  1043. }),
  1044. globals.IRInstruction);
  1045. smalltalk.addMethod(
  1046. smalltalk.method({
  1047. selector: "remove:",
  1048. protocol: 'building',
  1049. fn: function (anIRInstruction){
  1050. var self=this;
  1051. return smalltalk.withContext(function($ctx1) {
  1052. _st(self._instructions())._remove_(anIRInstruction);
  1053. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},globals.IRInstruction)})},
  1054. args: ["anIRInstruction"],
  1055. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  1056. messageSends: ["remove:", "instructions"],
  1057. referencedClasses: []
  1058. }),
  1059. globals.IRInstruction);
  1060. smalltalk.addMethod(
  1061. smalltalk.method({
  1062. selector: "replace:with:",
  1063. protocol: 'building',
  1064. fn: function (anIRInstruction,anotherIRInstruction){
  1065. var self=this;
  1066. return smalltalk.withContext(function($ctx1) {
  1067. var $1;
  1068. _st(anotherIRInstruction)._parent_(self);
  1069. $1=self._instructions();
  1070. $ctx1.sendIdx["instructions"]=1;
  1071. _st($1)._at_put_(_st(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  1072. return self}, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRInstruction)})},
  1073. args: ["anIRInstruction", "anotherIRInstruction"],
  1074. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  1075. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"],
  1076. referencedClasses: []
  1077. }),
  1078. globals.IRInstruction);
  1079. smalltalk.addMethod(
  1080. smalltalk.method({
  1081. selector: "replaceWith:",
  1082. protocol: 'building',
  1083. fn: function (anIRInstruction){
  1084. var self=this;
  1085. return smalltalk.withContext(function($ctx1) {
  1086. _st(self._parent())._replace_with_(self,anIRInstruction);
  1087. return self}, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},globals.IRInstruction)})},
  1088. args: ["anIRInstruction"],
  1089. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  1090. messageSends: ["replace:with:", "parent"],
  1091. referencedClasses: []
  1092. }),
  1093. globals.IRInstruction);
  1094. smalltalk.addMethod(
  1095. smalltalk.method({
  1096. selector: "scope",
  1097. protocol: 'accessing',
  1098. fn: function (){
  1099. var self=this;
  1100. return smalltalk.withContext(function($ctx1) {
  1101. var $2,$1,$receiver;
  1102. $2=self._parent();
  1103. if(($receiver = $2) == null || $receiver.isNil){
  1104. $1=$2;
  1105. } else {
  1106. var node;
  1107. node=$receiver;
  1108. $1=_st(node)._scope();
  1109. };
  1110. return $1;
  1111. }, function($ctx1) {$ctx1.fill(self,"scope",{},globals.IRInstruction)})},
  1112. args: [],
  1113. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  1114. messageSends: ["ifNotNil:", "parent", "scope"],
  1115. referencedClasses: []
  1116. }),
  1117. globals.IRInstruction);
  1118. smalltalk.addMethod(
  1119. smalltalk.method({
  1120. selector: "on:",
  1121. protocol: 'instance creation',
  1122. fn: function (aBuilder){
  1123. var self=this;
  1124. return smalltalk.withContext(function($ctx1) {
  1125. var $2,$3,$1;
  1126. $2=self._new();
  1127. _st($2)._builder_(aBuilder);
  1128. $3=_st($2)._yourself();
  1129. $1=$3;
  1130. return $1;
  1131. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},globals.IRInstruction.klass)})},
  1132. args: ["aBuilder"],
  1133. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  1134. messageSends: ["builder:", "new", "yourself"],
  1135. referencedClasses: []
  1136. }),
  1137. globals.IRInstruction.klass);
  1138. smalltalk.addClass('IRAssignment', globals.IRInstruction, [], 'Compiler-IR');
  1139. smalltalk.addMethod(
  1140. smalltalk.method({
  1141. selector: "accept:",
  1142. protocol: 'visiting',
  1143. fn: function (aVisitor){
  1144. var self=this;
  1145. return smalltalk.withContext(function($ctx1) {
  1146. var $1;
  1147. $1=_st(aVisitor)._visitIRAssignment_(self);
  1148. return $1;
  1149. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRAssignment)})},
  1150. args: ["aVisitor"],
  1151. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  1152. messageSends: ["visitIRAssignment:"],
  1153. referencedClasses: []
  1154. }),
  1155. globals.IRAssignment);
  1156. smalltalk.addClass('IRDynamicArray', globals.IRInstruction, [], 'Compiler-IR');
  1157. smalltalk.addMethod(
  1158. smalltalk.method({
  1159. selector: "accept:",
  1160. protocol: 'visiting',
  1161. fn: function (aVisitor){
  1162. var self=this;
  1163. return smalltalk.withContext(function($ctx1) {
  1164. var $1;
  1165. $1=_st(aVisitor)._visitIRDynamicArray_(self);
  1166. return $1;
  1167. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRDynamicArray)})},
  1168. args: ["aVisitor"],
  1169. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  1170. messageSends: ["visitIRDynamicArray:"],
  1171. referencedClasses: []
  1172. }),
  1173. globals.IRDynamicArray);
  1174. smalltalk.addClass('IRDynamicDictionary', globals.IRInstruction, [], 'Compiler-IR');
  1175. smalltalk.addMethod(
  1176. smalltalk.method({
  1177. selector: "accept:",
  1178. protocol: 'visiting',
  1179. fn: function (aVisitor){
  1180. var self=this;
  1181. return smalltalk.withContext(function($ctx1) {
  1182. var $1;
  1183. $1=_st(aVisitor)._visitIRDynamicDictionary_(self);
  1184. return $1;
  1185. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRDynamicDictionary)})},
  1186. args: ["aVisitor"],
  1187. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  1188. messageSends: ["visitIRDynamicDictionary:"],
  1189. referencedClasses: []
  1190. }),
  1191. globals.IRDynamicDictionary);
  1192. smalltalk.addClass('IRScopedInstruction', globals.IRInstruction, ['scope'], 'Compiler-IR');
  1193. smalltalk.addMethod(
  1194. smalltalk.method({
  1195. selector: "scope",
  1196. protocol: 'accessing',
  1197. fn: function (){
  1198. var self=this;
  1199. var $1;
  1200. $1=self["@scope"];
  1201. return $1;
  1202. },
  1203. args: [],
  1204. source: "scope\x0a\x09^ scope",
  1205. messageSends: [],
  1206. referencedClasses: []
  1207. }),
  1208. globals.IRScopedInstruction);
  1209. smalltalk.addMethod(
  1210. smalltalk.method({
  1211. selector: "scope:",
  1212. protocol: 'accessing',
  1213. fn: function (aScope){
  1214. var self=this;
  1215. self["@scope"]=aScope;
  1216. return self},
  1217. args: ["aScope"],
  1218. source: "scope: aScope\x0a\x09scope := aScope",
  1219. messageSends: [],
  1220. referencedClasses: []
  1221. }),
  1222. globals.IRScopedInstruction);
  1223. smalltalk.addClass('IRClosureInstruction', globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  1224. smalltalk.addMethod(
  1225. smalltalk.method({
  1226. selector: "arguments",
  1227. protocol: 'accessing',
  1228. fn: function (){
  1229. var self=this;
  1230. return smalltalk.withContext(function($ctx1) {
  1231. var $2,$1,$receiver;
  1232. $2=self["@arguments"];
  1233. if(($receiver = $2) == null || $receiver.isNil){
  1234. $1=[];
  1235. } else {
  1236. $1=$2;
  1237. };
  1238. return $1;
  1239. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.IRClosureInstruction)})},
  1240. args: [],
  1241. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  1242. messageSends: ["ifNil:"],
  1243. referencedClasses: []
  1244. }),
  1245. globals.IRClosureInstruction);
  1246. smalltalk.addMethod(
  1247. smalltalk.method({
  1248. selector: "arguments:",
  1249. protocol: 'accessing',
  1250. fn: function (aCollection){
  1251. var self=this;
  1252. self["@arguments"]=aCollection;
  1253. return self},
  1254. args: ["aCollection"],
  1255. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  1256. messageSends: [],
  1257. referencedClasses: []
  1258. }),
  1259. globals.IRClosureInstruction);
  1260. smalltalk.addMethod(
  1261. smalltalk.method({
  1262. selector: "locals",
  1263. protocol: 'accessing',
  1264. fn: function (){
  1265. var self=this;
  1266. return smalltalk.withContext(function($ctx1) {
  1267. var $2,$3,$1;
  1268. $2=_st(self._arguments())._copy();
  1269. _st($2)._addAll_(_st(self._tempDeclarations())._collect_((function(each){
  1270. return smalltalk.withContext(function($ctx2) {
  1271. return _st(each)._name();
  1272. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})));
  1273. $3=_st($2)._yourself();
  1274. $1=$3;
  1275. return $1;
  1276. }, function($ctx1) {$ctx1.fill(self,"locals",{},globals.IRClosureInstruction)})},
  1277. args: [],
  1278. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  1279. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"],
  1280. referencedClasses: []
  1281. }),
  1282. globals.IRClosureInstruction);
  1283. smalltalk.addMethod(
  1284. smalltalk.method({
  1285. selector: "requiresSmalltalkContext",
  1286. protocol: 'accessing',
  1287. fn: function (){
  1288. var self=this;
  1289. return smalltalk.withContext(function($ctx1) {
  1290. var $2,$1,$receiver;
  1291. $2=self["@requiresSmalltalkContext"];
  1292. if(($receiver = $2) == null || $receiver.isNil){
  1293. $1=false;
  1294. } else {
  1295. $1=$2;
  1296. };
  1297. return $1;
  1298. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},globals.IRClosureInstruction)})},
  1299. args: [],
  1300. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  1301. messageSends: ["ifNil:"],
  1302. referencedClasses: []
  1303. }),
  1304. globals.IRClosureInstruction);
  1305. smalltalk.addMethod(
  1306. smalltalk.method({
  1307. selector: "requiresSmalltalkContext:",
  1308. protocol: 'accessing',
  1309. fn: function (anObject){
  1310. var self=this;
  1311. self["@requiresSmalltalkContext"]=anObject;
  1312. return self},
  1313. args: ["anObject"],
  1314. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  1315. messageSends: [],
  1316. referencedClasses: []
  1317. }),
  1318. globals.IRClosureInstruction);
  1319. smalltalk.addMethod(
  1320. smalltalk.method({
  1321. selector: "scope:",
  1322. protocol: 'accessing',
  1323. fn: function (aScope){
  1324. var self=this;
  1325. return smalltalk.withContext(function($ctx1) {
  1326. ($ctx1.supercall = true, globals.IRClosureInstruction.superclass.fn.prototype._scope_.apply(_st(self), [aScope]));
  1327. $ctx1.supercall = false;
  1328. _st(aScope)._instruction_(self);
  1329. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},globals.IRClosureInstruction)})},
  1330. args: ["aScope"],
  1331. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  1332. messageSends: ["scope:", "instruction:"],
  1333. referencedClasses: []
  1334. }),
  1335. globals.IRClosureInstruction);
  1336. smalltalk.addMethod(
  1337. smalltalk.method({
  1338. selector: "tempDeclarations",
  1339. protocol: 'accessing',
  1340. fn: function (){
  1341. var self=this;
  1342. return smalltalk.withContext(function($ctx1) {
  1343. var $1;
  1344. $1=_st(self._instructions())._select_((function(each){
  1345. return smalltalk.withContext(function($ctx2) {
  1346. return _st(each)._isTempDeclaration();
  1347. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1348. return $1;
  1349. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},globals.IRClosureInstruction)})},
  1350. args: [],
  1351. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  1352. messageSends: ["select:", "instructions", "isTempDeclaration"],
  1353. referencedClasses: []
  1354. }),
  1355. globals.IRClosureInstruction);
  1356. smalltalk.addClass('IRClosure', globals.IRClosureInstruction, [], 'Compiler-IR');
  1357. smalltalk.addMethod(
  1358. smalltalk.method({
  1359. selector: "accept:",
  1360. protocol: 'visiting',
  1361. fn: function (aVisitor){
  1362. var self=this;
  1363. return smalltalk.withContext(function($ctx1) {
  1364. var $1;
  1365. $1=_st(aVisitor)._visitIRClosure_(self);
  1366. return $1;
  1367. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRClosure)})},
  1368. args: ["aVisitor"],
  1369. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  1370. messageSends: ["visitIRClosure:"],
  1371. referencedClasses: []
  1372. }),
  1373. globals.IRClosure);
  1374. smalltalk.addMethod(
  1375. smalltalk.method({
  1376. selector: "isClosure",
  1377. protocol: 'testing',
  1378. fn: function (){
  1379. var self=this;
  1380. return true;
  1381. },
  1382. args: [],
  1383. source: "isClosure\x0a\x09^ true",
  1384. messageSends: [],
  1385. referencedClasses: []
  1386. }),
  1387. globals.IRClosure);
  1388. smalltalk.addMethod(
  1389. smalltalk.method({
  1390. selector: "sequence",
  1391. protocol: 'accessing',
  1392. fn: function (){
  1393. var self=this;
  1394. return smalltalk.withContext(function($ctx1) {
  1395. var $1;
  1396. $1=_st(self._instructions())._last();
  1397. return $1;
  1398. }, function($ctx1) {$ctx1.fill(self,"sequence",{},globals.IRClosure)})},
  1399. args: [],
  1400. source: "sequence\x0a\x09^ self instructions last",
  1401. messageSends: ["last", "instructions"],
  1402. referencedClasses: []
  1403. }),
  1404. globals.IRClosure);
  1405. smalltalk.addClass('IRMethod', globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'superSends', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  1406. globals.IRMethod.comment="I am a method instruction";
  1407. smalltalk.addMethod(
  1408. smalltalk.method({
  1409. selector: "accept:",
  1410. protocol: 'visiting',
  1411. fn: function (aVisitor){
  1412. var self=this;
  1413. return smalltalk.withContext(function($ctx1) {
  1414. var $1;
  1415. $1=_st(aVisitor)._visitIRMethod_(self);
  1416. return $1;
  1417. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRMethod)})},
  1418. args: ["aVisitor"],
  1419. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  1420. messageSends: ["visitIRMethod:"],
  1421. referencedClasses: []
  1422. }),
  1423. globals.IRMethod);
  1424. smalltalk.addMethod(
  1425. smalltalk.method({
  1426. selector: "classReferences",
  1427. protocol: 'accessing',
  1428. fn: function (){
  1429. var self=this;
  1430. var $1;
  1431. $1=self["@classReferences"];
  1432. return $1;
  1433. },
  1434. args: [],
  1435. source: "classReferences\x0a\x09^ classReferences",
  1436. messageSends: [],
  1437. referencedClasses: []
  1438. }),
  1439. globals.IRMethod);
  1440. smalltalk.addMethod(
  1441. smalltalk.method({
  1442. selector: "classReferences:",
  1443. protocol: 'accessing',
  1444. fn: function (aCollection){
  1445. var self=this;
  1446. self["@classReferences"]=aCollection;
  1447. return self},
  1448. args: ["aCollection"],
  1449. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  1450. messageSends: [],
  1451. referencedClasses: []
  1452. }),
  1453. globals.IRMethod);
  1454. smalltalk.addMethod(
  1455. smalltalk.method({
  1456. selector: "internalVariables",
  1457. protocol: 'accessing',
  1458. fn: function (){
  1459. var self=this;
  1460. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  1461. return smalltalk.withContext(function($ctx1) {
  1462. var $2,$1,$receiver;
  1463. $2=self["@internalVariables"];
  1464. if(($receiver = $2) == null || $receiver.isNil){
  1465. self["@internalVariables"]=_st($Set())._new();
  1466. $1=self["@internalVariables"];
  1467. } else {
  1468. $1=$2;
  1469. };
  1470. return $1;
  1471. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},globals.IRMethod)})},
  1472. args: [],
  1473. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  1474. messageSends: ["ifNil:", "new"],
  1475. referencedClasses: ["Set"]
  1476. }),
  1477. globals.IRMethod);
  1478. smalltalk.addMethod(
  1479. smalltalk.method({
  1480. selector: "isMethod",
  1481. protocol: 'accessing',
  1482. fn: function (){
  1483. var self=this;
  1484. return true;
  1485. },
  1486. args: [],
  1487. source: "isMethod\x0a\x09^ true",
  1488. messageSends: [],
  1489. referencedClasses: []
  1490. }),
  1491. globals.IRMethod);
  1492. smalltalk.addMethod(
  1493. smalltalk.method({
  1494. selector: "messageSends",
  1495. protocol: 'accessing',
  1496. fn: function (){
  1497. var self=this;
  1498. return smalltalk.withContext(function($ctx1) {
  1499. var $1;
  1500. $1=_st(self._sendIndexes())._keys();
  1501. return $1;
  1502. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.IRMethod)})},
  1503. args: [],
  1504. source: "messageSends\x0a\x09^ self sendIndexes keys",
  1505. messageSends: ["keys", "sendIndexes"],
  1506. referencedClasses: []
  1507. }),
  1508. globals.IRMethod);
  1509. smalltalk.addMethod(
  1510. smalltalk.method({
  1511. selector: "method",
  1512. protocol: 'accessing',
  1513. fn: function (){
  1514. var self=this;
  1515. return self;
  1516. },
  1517. args: [],
  1518. source: "method\x0a\x09^ self",
  1519. messageSends: [],
  1520. referencedClasses: []
  1521. }),
  1522. globals.IRMethod);
  1523. smalltalk.addMethod(
  1524. smalltalk.method({
  1525. selector: "selector",
  1526. protocol: 'accessing',
  1527. fn: function (){
  1528. var self=this;
  1529. var $1;
  1530. $1=self["@selector"];
  1531. return $1;
  1532. },
  1533. args: [],
  1534. source: "selector\x0a\x09^ selector",
  1535. messageSends: [],
  1536. referencedClasses: []
  1537. }),
  1538. globals.IRMethod);
  1539. smalltalk.addMethod(
  1540. smalltalk.method({
  1541. selector: "selector:",
  1542. protocol: 'accessing',
  1543. fn: function (aString){
  1544. var self=this;
  1545. self["@selector"]=aString;
  1546. return self},
  1547. args: ["aString"],
  1548. source: "selector: aString\x0a\x09selector := aString",
  1549. messageSends: [],
  1550. referencedClasses: []
  1551. }),
  1552. globals.IRMethod);
  1553. smalltalk.addMethod(
  1554. smalltalk.method({
  1555. selector: "sendIndexes",
  1556. protocol: 'accessing',
  1557. fn: function (){
  1558. var self=this;
  1559. var $1;
  1560. $1=self["@sendIndexes"];
  1561. return $1;
  1562. },
  1563. args: [],
  1564. source: "sendIndexes\x0a\x09^ sendIndexes",
  1565. messageSends: [],
  1566. referencedClasses: []
  1567. }),
  1568. globals.IRMethod);
  1569. smalltalk.addMethod(
  1570. smalltalk.method({
  1571. selector: "sendIndexes:",
  1572. protocol: 'accessing',
  1573. fn: function (aDictionary){
  1574. var self=this;
  1575. self["@sendIndexes"]=aDictionary;
  1576. return self},
  1577. args: ["aDictionary"],
  1578. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  1579. messageSends: [],
  1580. referencedClasses: []
  1581. }),
  1582. globals.IRMethod);
  1583. smalltalk.addMethod(
  1584. smalltalk.method({
  1585. selector: "source",
  1586. protocol: 'accessing',
  1587. fn: function (){
  1588. var self=this;
  1589. var $1;
  1590. $1=self["@source"];
  1591. return $1;
  1592. },
  1593. args: [],
  1594. source: "source\x0a\x09^ source",
  1595. messageSends: [],
  1596. referencedClasses: []
  1597. }),
  1598. globals.IRMethod);
  1599. smalltalk.addMethod(
  1600. smalltalk.method({
  1601. selector: "source:",
  1602. protocol: 'accessing',
  1603. fn: function (aString){
  1604. var self=this;
  1605. self["@source"]=aString;
  1606. return self},
  1607. args: ["aString"],
  1608. source: "source: aString\x0a\x09source := aString",
  1609. messageSends: [],
  1610. referencedClasses: []
  1611. }),
  1612. globals.IRMethod);
  1613. smalltalk.addMethod(
  1614. smalltalk.method({
  1615. selector: "superSends",
  1616. protocol: 'accessing',
  1617. fn: function (){
  1618. var self=this;
  1619. var $1;
  1620. $1=self["@superSends"];
  1621. return $1;
  1622. },
  1623. args: [],
  1624. source: "superSends\x0a\x09^ superSends",
  1625. messageSends: [],
  1626. referencedClasses: []
  1627. }),
  1628. globals.IRMethod);
  1629. smalltalk.addMethod(
  1630. smalltalk.method({
  1631. selector: "superSends:",
  1632. protocol: 'accessing',
  1633. fn: function (aCollection){
  1634. var self=this;
  1635. self["@superSends"]=aCollection;
  1636. return self},
  1637. args: ["aCollection"],
  1638. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  1639. messageSends: [],
  1640. referencedClasses: []
  1641. }),
  1642. globals.IRMethod);
  1643. smalltalk.addMethod(
  1644. smalltalk.method({
  1645. selector: "theClass",
  1646. protocol: 'accessing',
  1647. fn: function (){
  1648. var self=this;
  1649. var $1;
  1650. $1=self["@theClass"];
  1651. return $1;
  1652. },
  1653. args: [],
  1654. source: "theClass\x0a\x09^ theClass",
  1655. messageSends: [],
  1656. referencedClasses: []
  1657. }),
  1658. globals.IRMethod);
  1659. smalltalk.addMethod(
  1660. smalltalk.method({
  1661. selector: "theClass:",
  1662. protocol: 'accessing',
  1663. fn: function (aClass){
  1664. var self=this;
  1665. self["@theClass"]=aClass;
  1666. return self},
  1667. args: ["aClass"],
  1668. source: "theClass: aClass\x0a\x09theClass := aClass",
  1669. messageSends: [],
  1670. referencedClasses: []
  1671. }),
  1672. globals.IRMethod);
  1673. smalltalk.addClass('IRReturn', globals.IRScopedInstruction, [], 'Compiler-IR');
  1674. globals.IRReturn.comment="I am a local return instruction.";
  1675. smalltalk.addMethod(
  1676. smalltalk.method({
  1677. selector: "accept:",
  1678. protocol: 'visiting',
  1679. fn: function (aVisitor){
  1680. var self=this;
  1681. return smalltalk.withContext(function($ctx1) {
  1682. var $1;
  1683. $1=_st(aVisitor)._visitIRReturn_(self);
  1684. return $1;
  1685. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRReturn)})},
  1686. args: ["aVisitor"],
  1687. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  1688. messageSends: ["visitIRReturn:"],
  1689. referencedClasses: []
  1690. }),
  1691. globals.IRReturn);
  1692. smalltalk.addMethod(
  1693. smalltalk.method({
  1694. selector: "canBeAssigned",
  1695. protocol: 'testing',
  1696. fn: function (){
  1697. var self=this;
  1698. return false;
  1699. },
  1700. args: [],
  1701. source: "canBeAssigned\x0a\x09^ false",
  1702. messageSends: [],
  1703. referencedClasses: []
  1704. }),
  1705. globals.IRReturn);
  1706. smalltalk.addMethod(
  1707. smalltalk.method({
  1708. selector: "isBlockReturn",
  1709. protocol: 'testing',
  1710. fn: function (){
  1711. var self=this;
  1712. return false;
  1713. },
  1714. args: [],
  1715. source: "isBlockReturn\x0a\x09^ false",
  1716. messageSends: [],
  1717. referencedClasses: []
  1718. }),
  1719. globals.IRReturn);
  1720. smalltalk.addMethod(
  1721. smalltalk.method({
  1722. selector: "isLocalReturn",
  1723. protocol: 'testing',
  1724. fn: function (){
  1725. var self=this;
  1726. return true;
  1727. },
  1728. args: [],
  1729. source: "isLocalReturn\x0a\x09^ true",
  1730. messageSends: [],
  1731. referencedClasses: []
  1732. }),
  1733. globals.IRReturn);
  1734. smalltalk.addMethod(
  1735. smalltalk.method({
  1736. selector: "isNonLocalReturn",
  1737. protocol: 'testing',
  1738. fn: function (){
  1739. var self=this;
  1740. return smalltalk.withContext(function($ctx1) {
  1741. var $1;
  1742. $1=_st(self._isLocalReturn())._not();
  1743. return $1;
  1744. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},globals.IRReturn)})},
  1745. args: [],
  1746. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  1747. messageSends: ["not", "isLocalReturn"],
  1748. referencedClasses: []
  1749. }),
  1750. globals.IRReturn);
  1751. smalltalk.addMethod(
  1752. smalltalk.method({
  1753. selector: "isReturn",
  1754. protocol: 'testing',
  1755. fn: function (){
  1756. var self=this;
  1757. return true;
  1758. },
  1759. args: [],
  1760. source: "isReturn\x0a\x09^ true",
  1761. messageSends: [],
  1762. referencedClasses: []
  1763. }),
  1764. globals.IRReturn);
  1765. smalltalk.addMethod(
  1766. smalltalk.method({
  1767. selector: "scope",
  1768. protocol: 'accessing',
  1769. fn: function (){
  1770. var self=this;
  1771. return smalltalk.withContext(function($ctx1) {
  1772. var $2,$1,$receiver;
  1773. $2=self["@scope"];
  1774. if(($receiver = $2) == null || $receiver.isNil){
  1775. $1=_st(self._parent())._scope();
  1776. } else {
  1777. $1=$2;
  1778. };
  1779. return $1;
  1780. }, function($ctx1) {$ctx1.fill(self,"scope",{},globals.IRReturn)})},
  1781. args: [],
  1782. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  1783. messageSends: ["ifNil:", "scope", "parent"],
  1784. referencedClasses: []
  1785. }),
  1786. globals.IRReturn);
  1787. smalltalk.addClass('IRBlockReturn', globals.IRReturn, [], 'Compiler-IR');
  1788. globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  1789. smalltalk.addMethod(
  1790. smalltalk.method({
  1791. selector: "accept:",
  1792. protocol: 'visiting',
  1793. fn: function (aVisitor){
  1794. var self=this;
  1795. return smalltalk.withContext(function($ctx1) {
  1796. var $1;
  1797. $1=_st(aVisitor)._visitIRBlockReturn_(self);
  1798. return $1;
  1799. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRBlockReturn)})},
  1800. args: ["aVisitor"],
  1801. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  1802. messageSends: ["visitIRBlockReturn:"],
  1803. referencedClasses: []
  1804. }),
  1805. globals.IRBlockReturn);
  1806. smalltalk.addMethod(
  1807. smalltalk.method({
  1808. selector: "isBlockReturn",
  1809. protocol: 'testing',
  1810. fn: function (){
  1811. var self=this;
  1812. return true;
  1813. },
  1814. args: [],
  1815. source: "isBlockReturn\x0a\x09^ true",
  1816. messageSends: [],
  1817. referencedClasses: []
  1818. }),
  1819. globals.IRBlockReturn);
  1820. smalltalk.addClass('IRNonLocalReturn', globals.IRReturn, [], 'Compiler-IR');
  1821. globals.IRNonLocalReturn.comment="I am a non local return instruction.\x0aNon local returns are handled using a try/catch JavaScript statement.\x0a\x0aSee `IRNonLocalReturnHandling` class.";
  1822. smalltalk.addMethod(
  1823. smalltalk.method({
  1824. selector: "accept:",
  1825. protocol: 'visiting',
  1826. fn: function (aVisitor){
  1827. var self=this;
  1828. return smalltalk.withContext(function($ctx1) {
  1829. var $1;
  1830. $1=_st(aVisitor)._visitIRNonLocalReturn_(self);
  1831. return $1;
  1832. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRNonLocalReturn)})},
  1833. args: ["aVisitor"],
  1834. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  1835. messageSends: ["visitIRNonLocalReturn:"],
  1836. referencedClasses: []
  1837. }),
  1838. globals.IRNonLocalReturn);
  1839. smalltalk.addMethod(
  1840. smalltalk.method({
  1841. selector: "isLocalReturn",
  1842. protocol: 'testing',
  1843. fn: function (){
  1844. var self=this;
  1845. return false;
  1846. },
  1847. args: [],
  1848. source: "isLocalReturn\x0a\x09^ false",
  1849. messageSends: [],
  1850. referencedClasses: []
  1851. }),
  1852. globals.IRNonLocalReturn);
  1853. smalltalk.addClass('IRTempDeclaration', globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  1854. smalltalk.addMethod(
  1855. smalltalk.method({
  1856. selector: "accept:",
  1857. protocol: 'visiting',
  1858. fn: function (aVisitor){
  1859. var self=this;
  1860. return smalltalk.withContext(function($ctx1) {
  1861. var $1;
  1862. $1=_st(aVisitor)._visitIRTempDeclaration_(self);
  1863. return $1;
  1864. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRTempDeclaration)})},
  1865. args: ["aVisitor"],
  1866. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  1867. messageSends: ["visitIRTempDeclaration:"],
  1868. referencedClasses: []
  1869. }),
  1870. globals.IRTempDeclaration);
  1871. smalltalk.addMethod(
  1872. smalltalk.method({
  1873. selector: "isTempDeclaration",
  1874. protocol: 'testing',
  1875. fn: function (){
  1876. var self=this;
  1877. return true;
  1878. },
  1879. args: [],
  1880. source: "isTempDeclaration\x0a\x09^ true",
  1881. messageSends: [],
  1882. referencedClasses: []
  1883. }),
  1884. globals.IRTempDeclaration);
  1885. smalltalk.addMethod(
  1886. smalltalk.method({
  1887. selector: "name",
  1888. protocol: 'accessing',
  1889. fn: function (){
  1890. var self=this;
  1891. var $1;
  1892. $1=self["@name"];
  1893. return $1;
  1894. },
  1895. args: [],
  1896. source: "name\x0a\x09^ name",
  1897. messageSends: [],
  1898. referencedClasses: []
  1899. }),
  1900. globals.IRTempDeclaration);
  1901. smalltalk.addMethod(
  1902. smalltalk.method({
  1903. selector: "name:",
  1904. protocol: 'accessing',
  1905. fn: function (aString){
  1906. var self=this;
  1907. self["@name"]=aString;
  1908. return self},
  1909. args: ["aString"],
  1910. source: "name: aString\x0a\x09name := aString",
  1911. messageSends: [],
  1912. referencedClasses: []
  1913. }),
  1914. globals.IRTempDeclaration);
  1915. smalltalk.addClass('IRSend', globals.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  1916. globals.IRSend.comment="I am a message send instruction.";
  1917. smalltalk.addMethod(
  1918. smalltalk.method({
  1919. selector: "accept:",
  1920. protocol: 'visiting',
  1921. fn: function (aVisitor){
  1922. var self=this;
  1923. return smalltalk.withContext(function($ctx1) {
  1924. var $1;
  1925. $1=_st(aVisitor)._visitIRSend_(self);
  1926. return $1;
  1927. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRSend)})},
  1928. args: ["aVisitor"],
  1929. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  1930. messageSends: ["visitIRSend:"],
  1931. referencedClasses: []
  1932. }),
  1933. globals.IRSend);
  1934. smalltalk.addMethod(
  1935. smalltalk.method({
  1936. selector: "classSend",
  1937. protocol: 'accessing',
  1938. fn: function (){
  1939. var self=this;
  1940. var $1;
  1941. $1=self["@classSend"];
  1942. return $1;
  1943. },
  1944. args: [],
  1945. source: "classSend\x0a\x09^ classSend",
  1946. messageSends: [],
  1947. referencedClasses: []
  1948. }),
  1949. globals.IRSend);
  1950. smalltalk.addMethod(
  1951. smalltalk.method({
  1952. selector: "classSend:",
  1953. protocol: 'accessing',
  1954. fn: function (aClass){
  1955. var self=this;
  1956. self["@classSend"]=aClass;
  1957. return self},
  1958. args: ["aClass"],
  1959. source: "classSend: aClass\x0a\x09classSend := aClass",
  1960. messageSends: [],
  1961. referencedClasses: []
  1962. }),
  1963. globals.IRSend);
  1964. smalltalk.addMethod(
  1965. smalltalk.method({
  1966. selector: "index",
  1967. protocol: 'accessing',
  1968. fn: function (){
  1969. var self=this;
  1970. var $1;
  1971. $1=self["@index"];
  1972. return $1;
  1973. },
  1974. args: [],
  1975. source: "index\x0a\x09^ index",
  1976. messageSends: [],
  1977. referencedClasses: []
  1978. }),
  1979. globals.IRSend);
  1980. smalltalk.addMethod(
  1981. smalltalk.method({
  1982. selector: "index:",
  1983. protocol: 'accessing',
  1984. fn: function (anInteger){
  1985. var self=this;
  1986. self["@index"]=anInteger;
  1987. return self},
  1988. args: ["anInteger"],
  1989. source: "index: anInteger\x0a\x09index := anInteger",
  1990. messageSends: [],
  1991. referencedClasses: []
  1992. }),
  1993. globals.IRSend);
  1994. smalltalk.addMethod(
  1995. smalltalk.method({
  1996. selector: "isSend",
  1997. protocol: 'testing',
  1998. fn: function (){
  1999. var self=this;
  2000. return true;
  2001. },
  2002. args: [],
  2003. source: "isSend\x0a\x09^ true",
  2004. messageSends: [],
  2005. referencedClasses: []
  2006. }),
  2007. globals.IRSend);
  2008. smalltalk.addMethod(
  2009. smalltalk.method({
  2010. selector: "selector",
  2011. protocol: 'accessing',
  2012. fn: function (){
  2013. var self=this;
  2014. var $1;
  2015. $1=self["@selector"];
  2016. return $1;
  2017. },
  2018. args: [],
  2019. source: "selector\x0a\x09^ selector",
  2020. messageSends: [],
  2021. referencedClasses: []
  2022. }),
  2023. globals.IRSend);
  2024. smalltalk.addMethod(
  2025. smalltalk.method({
  2026. selector: "selector:",
  2027. protocol: 'accessing',
  2028. fn: function (aString){
  2029. var self=this;
  2030. self["@selector"]=aString;
  2031. return self},
  2032. args: ["aString"],
  2033. source: "selector: aString\x0a\x09selector := aString",
  2034. messageSends: [],
  2035. referencedClasses: []
  2036. }),
  2037. globals.IRSend);
  2038. smalltalk.addClass('IRSequence', globals.IRInstruction, [], 'Compiler-IR');
  2039. smalltalk.addMethod(
  2040. smalltalk.method({
  2041. selector: "accept:",
  2042. protocol: 'visiting',
  2043. fn: function (aVisitor){
  2044. var self=this;
  2045. return smalltalk.withContext(function($ctx1) {
  2046. var $1;
  2047. $1=_st(aVisitor)._visitIRSequence_(self);
  2048. return $1;
  2049. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRSequence)})},
  2050. args: ["aVisitor"],
  2051. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  2052. messageSends: ["visitIRSequence:"],
  2053. referencedClasses: []
  2054. }),
  2055. globals.IRSequence);
  2056. smalltalk.addMethod(
  2057. smalltalk.method({
  2058. selector: "isSequence",
  2059. protocol: 'testing',
  2060. fn: function (){
  2061. var self=this;
  2062. return true;
  2063. },
  2064. args: [],
  2065. source: "isSequence\x0a\x09^ true",
  2066. messageSends: [],
  2067. referencedClasses: []
  2068. }),
  2069. globals.IRSequence);
  2070. smalltalk.addClass('IRBlockSequence', globals.IRSequence, [], 'Compiler-IR');
  2071. smalltalk.addMethod(
  2072. smalltalk.method({
  2073. selector: "accept:",
  2074. protocol: 'visiting',
  2075. fn: function (aVisitor){
  2076. var self=this;
  2077. return smalltalk.withContext(function($ctx1) {
  2078. var $1;
  2079. $1=_st(aVisitor)._visitIRBlockSequence_(self);
  2080. return $1;
  2081. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRBlockSequence)})},
  2082. args: ["aVisitor"],
  2083. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  2084. messageSends: ["visitIRBlockSequence:"],
  2085. referencedClasses: []
  2086. }),
  2087. globals.IRBlockSequence);
  2088. smalltalk.addClass('IRValue', globals.IRInstruction, ['value'], 'Compiler-IR');
  2089. globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  2090. smalltalk.addMethod(
  2091. smalltalk.method({
  2092. selector: "accept:",
  2093. protocol: 'visiting',
  2094. fn: function (aVisitor){
  2095. var self=this;
  2096. return smalltalk.withContext(function($ctx1) {
  2097. var $1;
  2098. $1=_st(aVisitor)._visitIRValue_(self);
  2099. return $1;
  2100. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRValue)})},
  2101. args: ["aVisitor"],
  2102. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  2103. messageSends: ["visitIRValue:"],
  2104. referencedClasses: []
  2105. }),
  2106. globals.IRValue);
  2107. smalltalk.addMethod(
  2108. smalltalk.method({
  2109. selector: "needsBoxingAsReceiver",
  2110. protocol: 'testing',
  2111. fn: function (){
  2112. var self=this;
  2113. return false;
  2114. },
  2115. args: [],
  2116. source: "needsBoxingAsReceiver\x0a\x09^ false",
  2117. messageSends: [],
  2118. referencedClasses: []
  2119. }),
  2120. globals.IRValue);
  2121. smalltalk.addMethod(
  2122. smalltalk.method({
  2123. selector: "value",
  2124. protocol: 'accessing',
  2125. fn: function (){
  2126. var self=this;
  2127. var $1;
  2128. $1=self["@value"];
  2129. return $1;
  2130. },
  2131. args: [],
  2132. source: "value\x0a\x09^ value",
  2133. messageSends: [],
  2134. referencedClasses: []
  2135. }),
  2136. globals.IRValue);
  2137. smalltalk.addMethod(
  2138. smalltalk.method({
  2139. selector: "value:",
  2140. protocol: 'accessing',
  2141. fn: function (aString){
  2142. var self=this;
  2143. self["@value"]=aString;
  2144. return self},
  2145. args: ["aString"],
  2146. source: "value: aString\x0a\x09value := aString",
  2147. messageSends: [],
  2148. referencedClasses: []
  2149. }),
  2150. globals.IRValue);
  2151. smalltalk.addClass('IRVariable', globals.IRInstruction, ['variable'], 'Compiler-IR');
  2152. globals.IRVariable.comment="I am a variable instruction.";
  2153. smalltalk.addMethod(
  2154. smalltalk.method({
  2155. selector: "accept:",
  2156. protocol: 'visiting',
  2157. fn: function (aVisitor){
  2158. var self=this;
  2159. return smalltalk.withContext(function($ctx1) {
  2160. var $1;
  2161. $1=_st(aVisitor)._visitIRVariable_(self);
  2162. return $1;
  2163. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRVariable)})},
  2164. args: ["aVisitor"],
  2165. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  2166. messageSends: ["visitIRVariable:"],
  2167. referencedClasses: []
  2168. }),
  2169. globals.IRVariable);
  2170. smalltalk.addMethod(
  2171. smalltalk.method({
  2172. selector: "isVariable",
  2173. protocol: 'testing',
  2174. fn: function (){
  2175. var self=this;
  2176. return true;
  2177. },
  2178. args: [],
  2179. source: "isVariable\x0a\x09^ true",
  2180. messageSends: [],
  2181. referencedClasses: []
  2182. }),
  2183. globals.IRVariable);
  2184. smalltalk.addMethod(
  2185. smalltalk.method({
  2186. selector: "needsBoxingAsReceiver",
  2187. protocol: 'testing',
  2188. fn: function (){
  2189. var self=this;
  2190. return smalltalk.withContext(function($ctx1) {
  2191. var $1;
  2192. $1=_st(_st(self._variable())._isPseudoVar())._not();
  2193. return $1;
  2194. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},globals.IRVariable)})},
  2195. args: [],
  2196. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  2197. messageSends: ["not", "isPseudoVar", "variable"],
  2198. referencedClasses: []
  2199. }),
  2200. globals.IRVariable);
  2201. smalltalk.addMethod(
  2202. smalltalk.method({
  2203. selector: "variable",
  2204. protocol: 'accessing',
  2205. fn: function (){
  2206. var self=this;
  2207. var $1;
  2208. $1=self["@variable"];
  2209. return $1;
  2210. },
  2211. args: [],
  2212. source: "variable\x0a\x09^ variable",
  2213. messageSends: [],
  2214. referencedClasses: []
  2215. }),
  2216. globals.IRVariable);
  2217. smalltalk.addMethod(
  2218. smalltalk.method({
  2219. selector: "variable:",
  2220. protocol: 'accessing',
  2221. fn: function (aScopeVariable){
  2222. var self=this;
  2223. self["@variable"]=aScopeVariable;
  2224. return self},
  2225. args: ["aScopeVariable"],
  2226. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  2227. messageSends: [],
  2228. referencedClasses: []
  2229. }),
  2230. globals.IRVariable);
  2231. smalltalk.addClass('IRVerbatim', globals.IRInstruction, ['source'], 'Compiler-IR');
  2232. smalltalk.addMethod(
  2233. smalltalk.method({
  2234. selector: "accept:",
  2235. protocol: 'visiting',
  2236. fn: function (aVisitor){
  2237. var self=this;
  2238. return smalltalk.withContext(function($ctx1) {
  2239. var $1;
  2240. $1=_st(aVisitor)._visitIRVerbatim_(self);
  2241. return $1;
  2242. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRVerbatim)})},
  2243. args: ["aVisitor"],
  2244. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  2245. messageSends: ["visitIRVerbatim:"],
  2246. referencedClasses: []
  2247. }),
  2248. globals.IRVerbatim);
  2249. smalltalk.addMethod(
  2250. smalltalk.method({
  2251. selector: "source",
  2252. protocol: 'accessing',
  2253. fn: function (){
  2254. var self=this;
  2255. var $1;
  2256. $1=self["@source"];
  2257. return $1;
  2258. },
  2259. args: [],
  2260. source: "source\x0a\x09^ source",
  2261. messageSends: [],
  2262. referencedClasses: []
  2263. }),
  2264. globals.IRVerbatim);
  2265. smalltalk.addMethod(
  2266. smalltalk.method({
  2267. selector: "source:",
  2268. protocol: 'accessing',
  2269. fn: function (aString){
  2270. var self=this;
  2271. self["@source"]=aString;
  2272. return self},
  2273. args: ["aString"],
  2274. source: "source: aString\x0a\x09source := aString",
  2275. messageSends: [],
  2276. referencedClasses: []
  2277. }),
  2278. globals.IRVerbatim);
  2279. smalltalk.addClass('IRVisitor', globals.Object, [], 'Compiler-IR');
  2280. smalltalk.addMethod(
  2281. smalltalk.method({
  2282. selector: "visit:",
  2283. protocol: 'visiting',
  2284. fn: function (anIRInstruction){
  2285. var self=this;
  2286. return smalltalk.withContext(function($ctx1) {
  2287. var $1;
  2288. $1=_st(anIRInstruction)._accept_(self);
  2289. return $1;
  2290. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},globals.IRVisitor)})},
  2291. args: ["anIRInstruction"],
  2292. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  2293. messageSends: ["accept:"],
  2294. referencedClasses: []
  2295. }),
  2296. globals.IRVisitor);
  2297. smalltalk.addMethod(
  2298. smalltalk.method({
  2299. selector: "visitIRAssignment:",
  2300. protocol: 'visiting',
  2301. fn: function (anIRAssignment){
  2302. var self=this;
  2303. return smalltalk.withContext(function($ctx1) {
  2304. var $1;
  2305. $1=self._visitIRInstruction_(anIRAssignment);
  2306. return $1;
  2307. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRVisitor)})},
  2308. args: ["anIRAssignment"],
  2309. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  2310. messageSends: ["visitIRInstruction:"],
  2311. referencedClasses: []
  2312. }),
  2313. globals.IRVisitor);
  2314. smalltalk.addMethod(
  2315. smalltalk.method({
  2316. selector: "visitIRBlockReturn:",
  2317. protocol: 'visiting',
  2318. fn: function (anIRBlockReturn){
  2319. var self=this;
  2320. return smalltalk.withContext(function($ctx1) {
  2321. var $1;
  2322. $1=self._visitIRReturn_(anIRBlockReturn);
  2323. return $1;
  2324. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},globals.IRVisitor)})},
  2325. args: ["anIRBlockReturn"],
  2326. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  2327. messageSends: ["visitIRReturn:"],
  2328. referencedClasses: []
  2329. }),
  2330. globals.IRVisitor);
  2331. smalltalk.addMethod(
  2332. smalltalk.method({
  2333. selector: "visitIRBlockSequence:",
  2334. protocol: 'visiting',
  2335. fn: function (anIRBlockSequence){
  2336. var self=this;
  2337. return smalltalk.withContext(function($ctx1) {
  2338. var $1;
  2339. $1=self._visitIRSequence_(anIRBlockSequence);
  2340. return $1;
  2341. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},globals.IRVisitor)})},
  2342. args: ["anIRBlockSequence"],
  2343. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  2344. messageSends: ["visitIRSequence:"],
  2345. referencedClasses: []
  2346. }),
  2347. globals.IRVisitor);
  2348. smalltalk.addMethod(
  2349. smalltalk.method({
  2350. selector: "visitIRClosure:",
  2351. protocol: 'visiting',
  2352. fn: function (anIRClosure){
  2353. var self=this;
  2354. return smalltalk.withContext(function($ctx1) {
  2355. var $1;
  2356. $1=self._visitIRInstruction_(anIRClosure);
  2357. return $1;
  2358. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},globals.IRVisitor)})},
  2359. args: ["anIRClosure"],
  2360. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  2361. messageSends: ["visitIRInstruction:"],
  2362. referencedClasses: []
  2363. }),
  2364. globals.IRVisitor);
  2365. smalltalk.addMethod(
  2366. smalltalk.method({
  2367. selector: "visitIRDynamicArray:",
  2368. protocol: 'visiting',
  2369. fn: function (anIRDynamicArray){
  2370. var self=this;
  2371. return smalltalk.withContext(function($ctx1) {
  2372. var $1;
  2373. $1=self._visitIRInstruction_(anIRDynamicArray);
  2374. return $1;
  2375. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},globals.IRVisitor)})},
  2376. args: ["anIRDynamicArray"],
  2377. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  2378. messageSends: ["visitIRInstruction:"],
  2379. referencedClasses: []
  2380. }),
  2381. globals.IRVisitor);
  2382. smalltalk.addMethod(
  2383. smalltalk.method({
  2384. selector: "visitIRDynamicDictionary:",
  2385. protocol: 'visiting',
  2386. fn: function (anIRDynamicDictionary){
  2387. var self=this;
  2388. return smalltalk.withContext(function($ctx1) {
  2389. var $1;
  2390. $1=self._visitIRInstruction_(anIRDynamicDictionary);
  2391. return $1;
  2392. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},globals.IRVisitor)})},
  2393. args: ["anIRDynamicDictionary"],
  2394. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  2395. messageSends: ["visitIRInstruction:"],
  2396. referencedClasses: []
  2397. }),
  2398. globals.IRVisitor);
  2399. smalltalk.addMethod(
  2400. smalltalk.method({
  2401. selector: "visitIRInlinedClosure:",
  2402. protocol: 'visiting',
  2403. fn: function (anIRInlinedClosure){
  2404. var self=this;
  2405. return smalltalk.withContext(function($ctx1) {
  2406. var $1;
  2407. $1=self._visitIRClosure_(anIRInlinedClosure);
  2408. return $1;
  2409. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},globals.IRVisitor)})},
  2410. args: ["anIRInlinedClosure"],
  2411. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  2412. messageSends: ["visitIRClosure:"],
  2413. referencedClasses: []
  2414. }),
  2415. globals.IRVisitor);
  2416. smalltalk.addMethod(
  2417. smalltalk.method({
  2418. selector: "visitIRInlinedSequence:",
  2419. protocol: 'visiting',
  2420. fn: function (anIRInlinedSequence){
  2421. var self=this;
  2422. return smalltalk.withContext(function($ctx1) {
  2423. var $1;
  2424. $1=self._visitIRSequence_(anIRInlinedSequence);
  2425. return $1;
  2426. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},globals.IRVisitor)})},
  2427. args: ["anIRInlinedSequence"],
  2428. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  2429. messageSends: ["visitIRSequence:"],
  2430. referencedClasses: []
  2431. }),
  2432. globals.IRVisitor);
  2433. smalltalk.addMethod(
  2434. smalltalk.method({
  2435. selector: "visitIRInstruction:",
  2436. protocol: 'visiting',
  2437. fn: function (anIRInstruction){
  2438. var self=this;
  2439. return smalltalk.withContext(function($ctx1) {
  2440. _st(_st(anIRInstruction)._instructions())._do_((function(each){
  2441. return smalltalk.withContext(function($ctx2) {
  2442. return self._visit_(each);
  2443. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2444. return anIRInstruction;
  2445. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},globals.IRVisitor)})},
  2446. args: ["anIRInstruction"],
  2447. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  2448. messageSends: ["do:", "instructions", "visit:"],
  2449. referencedClasses: []
  2450. }),
  2451. globals.IRVisitor);
  2452. smalltalk.addMethod(
  2453. smalltalk.method({
  2454. selector: "visitIRMethod:",
  2455. protocol: 'visiting',
  2456. fn: function (anIRMethod){
  2457. var self=this;
  2458. return smalltalk.withContext(function($ctx1) {
  2459. var $1;
  2460. $1=self._visitIRInstruction_(anIRMethod);
  2461. return $1;
  2462. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},globals.IRVisitor)})},
  2463. args: ["anIRMethod"],
  2464. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  2465. messageSends: ["visitIRInstruction:"],
  2466. referencedClasses: []
  2467. }),
  2468. globals.IRVisitor);
  2469. smalltalk.addMethod(
  2470. smalltalk.method({
  2471. selector: "visitIRNonLocalReturn:",
  2472. protocol: 'visiting',
  2473. fn: function (anIRNonLocalReturn){
  2474. var self=this;
  2475. return smalltalk.withContext(function($ctx1) {
  2476. var $1;
  2477. $1=self._visitIRInstruction_(anIRNonLocalReturn);
  2478. return $1;
  2479. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRVisitor)})},
  2480. args: ["anIRNonLocalReturn"],
  2481. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  2482. messageSends: ["visitIRInstruction:"],
  2483. referencedClasses: []
  2484. }),
  2485. globals.IRVisitor);
  2486. smalltalk.addMethod(
  2487. smalltalk.method({
  2488. selector: "visitIRNonLocalReturnHandling:",
  2489. protocol: 'visiting',
  2490. fn: function (anIRNonLocalReturnHandling){
  2491. var self=this;
  2492. return smalltalk.withContext(function($ctx1) {
  2493. var $1;
  2494. $1=self._visitIRInstruction_(anIRNonLocalReturnHandling);
  2495. return $1;
  2496. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},globals.IRVisitor)})},
  2497. args: ["anIRNonLocalReturnHandling"],
  2498. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  2499. messageSends: ["visitIRInstruction:"],
  2500. referencedClasses: []
  2501. }),
  2502. globals.IRVisitor);
  2503. smalltalk.addMethod(
  2504. smalltalk.method({
  2505. selector: "visitIRReturn:",
  2506. protocol: 'visiting',
  2507. fn: function (anIRReturn){
  2508. var self=this;
  2509. return smalltalk.withContext(function($ctx1) {
  2510. var $1;
  2511. $1=self._visitIRInstruction_(anIRReturn);
  2512. return $1;
  2513. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRVisitor)})},
  2514. args: ["anIRReturn"],
  2515. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  2516. messageSends: ["visitIRInstruction:"],
  2517. referencedClasses: []
  2518. }),
  2519. globals.IRVisitor);
  2520. smalltalk.addMethod(
  2521. smalltalk.method({
  2522. selector: "visitIRSend:",
  2523. protocol: 'visiting',
  2524. fn: function (anIRSend){
  2525. var self=this;
  2526. return smalltalk.withContext(function($ctx1) {
  2527. var $1;
  2528. $1=self._visitIRInstruction_(anIRSend);
  2529. return $1;
  2530. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},globals.IRVisitor)})},
  2531. args: ["anIRSend"],
  2532. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  2533. messageSends: ["visitIRInstruction:"],
  2534. referencedClasses: []
  2535. }),
  2536. globals.IRVisitor);
  2537. smalltalk.addMethod(
  2538. smalltalk.method({
  2539. selector: "visitIRSequence:",
  2540. protocol: 'visiting',
  2541. fn: function (anIRSequence){
  2542. var self=this;
  2543. return smalltalk.withContext(function($ctx1) {
  2544. var $1;
  2545. $1=self._visitIRInstruction_(anIRSequence);
  2546. return $1;
  2547. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},globals.IRVisitor)})},
  2548. args: ["anIRSequence"],
  2549. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  2550. messageSends: ["visitIRInstruction:"],
  2551. referencedClasses: []
  2552. }),
  2553. globals.IRVisitor);
  2554. smalltalk.addMethod(
  2555. smalltalk.method({
  2556. selector: "visitIRTempDeclaration:",
  2557. protocol: 'visiting',
  2558. fn: function (anIRTempDeclaration){
  2559. var self=this;
  2560. return smalltalk.withContext(function($ctx1) {
  2561. var $1;
  2562. $1=self._visitIRInstruction_(anIRTempDeclaration);
  2563. return $1;
  2564. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},globals.IRVisitor)})},
  2565. args: ["anIRTempDeclaration"],
  2566. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  2567. messageSends: ["visitIRInstruction:"],
  2568. referencedClasses: []
  2569. }),
  2570. globals.IRVisitor);
  2571. smalltalk.addMethod(
  2572. smalltalk.method({
  2573. selector: "visitIRValue:",
  2574. protocol: 'visiting',
  2575. fn: function (anIRValue){
  2576. var self=this;
  2577. return smalltalk.withContext(function($ctx1) {
  2578. var $1;
  2579. $1=self._visitIRInstruction_(anIRValue);
  2580. return $1;
  2581. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},globals.IRVisitor)})},
  2582. args: ["anIRValue"],
  2583. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  2584. messageSends: ["visitIRInstruction:"],
  2585. referencedClasses: []
  2586. }),
  2587. globals.IRVisitor);
  2588. smalltalk.addMethod(
  2589. smalltalk.method({
  2590. selector: "visitIRVariable:",
  2591. protocol: 'visiting',
  2592. fn: function (anIRVariable){
  2593. var self=this;
  2594. return smalltalk.withContext(function($ctx1) {
  2595. var $1;
  2596. $1=self._visitIRInstruction_(anIRVariable);
  2597. return $1;
  2598. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},globals.IRVisitor)})},
  2599. args: ["anIRVariable"],
  2600. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  2601. messageSends: ["visitIRInstruction:"],
  2602. referencedClasses: []
  2603. }),
  2604. globals.IRVisitor);
  2605. smalltalk.addMethod(
  2606. smalltalk.method({
  2607. selector: "visitIRVerbatim:",
  2608. protocol: 'visiting',
  2609. fn: function (anIRVerbatim){
  2610. var self=this;
  2611. return smalltalk.withContext(function($ctx1) {
  2612. var $1;
  2613. $1=self._visitIRInstruction_(anIRVerbatim);
  2614. return $1;
  2615. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},globals.IRVisitor)})},
  2616. args: ["anIRVerbatim"],
  2617. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  2618. messageSends: ["visitIRInstruction:"],
  2619. referencedClasses: []
  2620. }),
  2621. globals.IRVisitor);
  2622. smalltalk.addClass('IRJSTranslator', globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  2623. smalltalk.addMethod(
  2624. smalltalk.method({
  2625. selector: "contents",
  2626. protocol: 'accessing',
  2627. fn: function (){
  2628. var self=this;
  2629. return smalltalk.withContext(function($ctx1) {
  2630. var $1;
  2631. $1=_st(self._stream())._contents();
  2632. return $1;
  2633. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.IRJSTranslator)})},
  2634. args: [],
  2635. source: "contents\x0a\x09^ self stream contents",
  2636. messageSends: ["contents", "stream"],
  2637. referencedClasses: []
  2638. }),
  2639. globals.IRJSTranslator);
  2640. smalltalk.addMethod(
  2641. smalltalk.method({
  2642. selector: "currentClass",
  2643. protocol: 'accessing',
  2644. fn: function (){
  2645. var self=this;
  2646. var $1;
  2647. $1=self["@currentClass"];
  2648. return $1;
  2649. },
  2650. args: [],
  2651. source: "currentClass\x0a\x09^ currentClass",
  2652. messageSends: [],
  2653. referencedClasses: []
  2654. }),
  2655. globals.IRJSTranslator);
  2656. smalltalk.addMethod(
  2657. smalltalk.method({
  2658. selector: "currentClass:",
  2659. protocol: 'accessing',
  2660. fn: function (aClass){
  2661. var self=this;
  2662. self["@currentClass"]=aClass;
  2663. return self},
  2664. args: ["aClass"],
  2665. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  2666. messageSends: [],
  2667. referencedClasses: []
  2668. }),
  2669. globals.IRJSTranslator);
  2670. smalltalk.addMethod(
  2671. smalltalk.method({
  2672. selector: "initialize",
  2673. protocol: 'initialization',
  2674. fn: function (){
  2675. var self=this;
  2676. function $JSStream(){return globals.JSStream||(typeof JSStream=="undefined"?nil:JSStream)}
  2677. return smalltalk.withContext(function($ctx1) {
  2678. ($ctx1.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._initialize.apply(_st(self), []));
  2679. $ctx1.supercall = false;
  2680. self["@stream"]=_st($JSStream())._new();
  2681. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.IRJSTranslator)})},
  2682. args: [],
  2683. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  2684. messageSends: ["initialize", "new"],
  2685. referencedClasses: ["JSStream"]
  2686. }),
  2687. globals.IRJSTranslator);
  2688. smalltalk.addMethod(
  2689. smalltalk.method({
  2690. selector: "stream",
  2691. protocol: 'accessing',
  2692. fn: function (){
  2693. var self=this;
  2694. var $1;
  2695. $1=self["@stream"];
  2696. return $1;
  2697. },
  2698. args: [],
  2699. source: "stream\x0a\x09^ stream",
  2700. messageSends: [],
  2701. referencedClasses: []
  2702. }),
  2703. globals.IRJSTranslator);
  2704. smalltalk.addMethod(
  2705. smalltalk.method({
  2706. selector: "stream:",
  2707. protocol: 'accessing',
  2708. fn: function (aStream){
  2709. var self=this;
  2710. self["@stream"]=aStream;
  2711. return self},
  2712. args: ["aStream"],
  2713. source: "stream: aStream\x0a\x09stream := aStream",
  2714. messageSends: [],
  2715. referencedClasses: []
  2716. }),
  2717. globals.IRJSTranslator);
  2718. smalltalk.addMethod(
  2719. smalltalk.method({
  2720. selector: "visitIRAssignment:",
  2721. protocol: 'visiting',
  2722. fn: function (anIRAssignment){
  2723. var self=this;
  2724. return smalltalk.withContext(function($ctx1) {
  2725. var $2,$1;
  2726. $2=_st(anIRAssignment)._instructions();
  2727. $ctx1.sendIdx["instructions"]=1;
  2728. $1=_st($2)._first();
  2729. self._visit_($1);
  2730. $ctx1.sendIdx["visit:"]=1;
  2731. _st(self._stream())._nextPutAssignment();
  2732. self._visit_(_st(_st(anIRAssignment)._instructions())._last());
  2733. return self}, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRJSTranslator)})},
  2734. args: ["anIRAssignment"],
  2735. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  2736. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"],
  2737. referencedClasses: []
  2738. }),
  2739. globals.IRJSTranslator);
  2740. smalltalk.addMethod(
  2741. smalltalk.method({
  2742. selector: "visitIRClosure:",
  2743. protocol: 'visiting',
  2744. fn: function (anIRClosure){
  2745. var self=this;
  2746. return smalltalk.withContext(function($ctx1) {
  2747. var $1,$2;
  2748. $1=self._stream();
  2749. $ctx1.sendIdx["stream"]=1;
  2750. _st($1)._nextPutClosureWith_arguments_((function(){
  2751. return smalltalk.withContext(function($ctx2) {
  2752. $2=self._stream();
  2753. $ctx2.sendIdx["stream"]=2;
  2754. _st($2)._nextPutVars_(_st(_st(anIRClosure)._tempDeclarations())._collect_((function(each){
  2755. return smalltalk.withContext(function($ctx3) {
  2756. return _st(_st(each)._name())._asVariableName();
  2757. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})})));
  2758. return _st(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  2759. return smalltalk.withContext(function($ctx3) {
  2760. return ($ctx3.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRClosure_.apply(_st(self), [anIRClosure]));
  2761. $ctx3.supercall = false;
  2762. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),_st(anIRClosure)._arguments());
  2764. return self}, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},globals.IRJSTranslator)})},
  2765. args: ["anIRClosure"],
  2766. source: "visitIRClosure: anIRClosure\x0a\x09self stream\x0a\x09\x09nextPutClosureWith: [\x0a\x09\x09\x09self stream nextPutVars: (anIRClosure tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09self stream\x0a\x09\x09\x09\x09nextPutBlockContextFor: anIRClosure\x0a\x09\x09\x09\x09during: [ super visitIRClosure: anIRClosure ] ]\x0a\x09\x09arguments: anIRClosure arguments",
  2767. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"],
  2768. referencedClasses: []
  2769. }),
  2770. globals.IRJSTranslator);
  2771. smalltalk.addMethod(
  2772. smalltalk.method({
  2773. selector: "visitIRDynamicArray:",
  2774. protocol: 'visiting',
  2775. fn: function (anIRDynamicArray){
  2776. var self=this;
  2777. return smalltalk.withContext(function($ctx1) {
  2778. var $1;
  2779. $1=self._stream();
  2780. $ctx1.sendIdx["stream"]=1;
  2781. _st($1)._nextPutAll_("[");
  2782. $ctx1.sendIdx["nextPutAll:"]=1;
  2783. _st(_st(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){
  2784. return smalltalk.withContext(function($ctx2) {
  2785. return self._visit_(each);
  2786. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  2787. return smalltalk.withContext(function($ctx2) {
  2788. return _st(self._stream())._nextPutAll_(",");
  2789. $ctx2.sendIdx["nextPutAll:"]=2;
  2790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2791. _st(self["@stream"])._nextPutAll_("]");
  2792. return self}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},globals.IRJSTranslator)})},
  2793. args: ["anIRDynamicArray"],
  2794. 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: ']'",
  2795. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"],
  2796. referencedClasses: []
  2797. }),
  2798. globals.IRJSTranslator);
  2799. smalltalk.addMethod(
  2800. smalltalk.method({
  2801. selector: "visitIRDynamicDictionary:",
  2802. protocol: 'visiting',
  2803. fn: function (anIRDynamicDictionary){
  2804. var self=this;
  2805. return smalltalk.withContext(function($ctx1) {
  2806. var $1,$2;
  2807. $1=self._stream();
  2808. $ctx1.sendIdx["stream"]=1;
  2809. _st($1)._nextPutAll_("globals.HashedCollection._newFromPairs_([");
  2810. $ctx1.sendIdx["nextPutAll:"]=1;
  2811. _st(_st(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){
  2812. return smalltalk.withContext(function($ctx2) {
  2813. return self._visit_(each);
  2814. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  2815. return smalltalk.withContext(function($ctx2) {
  2816. $2=self._stream();
  2817. $ctx2.sendIdx["stream"]=2;
  2818. return _st($2)._nextPutAll_(",");
  2819. $ctx2.sendIdx["nextPutAll:"]=2;
  2820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2821. _st(self._stream())._nextPutAll_("])");
  2822. return self}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},globals.IRJSTranslator)})},
  2823. args: ["anIRDynamicDictionary"],
  2824. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self stream nextPutAll: 'globals.HashedCollection._newFromPairs_(['.\x0a\x09\x09anIRDynamicDictionary instructions\x0a\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
  2825. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"],
  2826. referencedClasses: []
  2827. }),
  2828. globals.IRJSTranslator);
  2829. smalltalk.addMethod(
  2830. smalltalk.method({
  2831. selector: "visitIRMethod:",
  2832. protocol: 'visiting',
  2833. fn: function (anIRMethod){
  2834. var self=this;
  2835. return smalltalk.withContext(function($ctx1) {
  2836. var $1,$2,$3,$4,$5,$6,$8,$7,$9,$10;
  2837. $1=self._stream();
  2838. $ctx1.sendIdx["stream"]=1;
  2839. _st($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  2840. return smalltalk.withContext(function($ctx2) {
  2841. $2=self._stream();
  2842. $ctx2.sendIdx["stream"]=2;
  2843. return _st($2)._nextPutFunctionWith_arguments_((function(){
  2844. return smalltalk.withContext(function($ctx3) {
  2845. $3=self._stream();
  2846. $ctx3.sendIdx["stream"]=3;
  2847. $4=_st(_st(anIRMethod)._tempDeclarations())._collect_((function(each){
  2848. return smalltalk.withContext(function($ctx4) {
  2849. return _st(_st(each)._name())._asVariableName();
  2850. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)})}));
  2851. $ctx3.sendIdx["collect:"]=1;
  2852. _st($3)._nextPutVars_($4);
  2853. $ctx3.sendIdx["nextPutVars:"]=1;
  2854. _st(_st(anIRMethod)._classReferences())._do_((function(each){
  2855. return smalltalk.withContext(function($ctx4) {
  2856. $5=self._stream();
  2857. $ctx4.sendIdx["stream"]=4;
  2858. return _st($5)._nextPutClassRefFunction_(each);
  2859. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)})}));
  2860. $6=self._stream();
  2861. $ctx3.sendIdx["stream"]=5;
  2862. return _st($6)._nextPutContextFor_during_(anIRMethod,(function(){
  2863. return smalltalk.withContext(function($ctx4) {
  2864. $8=_st(anIRMethod)._internalVariables();
  2865. $ctx4.sendIdx["internalVariables"]=1;
  2866. $7=_st($8)._notEmpty();
  2867. if(smalltalk.assert($7)){
  2868. $9=self._stream();
  2869. $ctx4.sendIdx["stream"]=6;
  2870. _st($9)._nextPutVars_(_st(_st(_st(anIRMethod)._internalVariables())._asSet())._collect_((function(each){
  2871. return smalltalk.withContext(function($ctx5) {
  2872. return _st(_st(each)._variable())._alias();
  2873. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,7)})})));
  2874. };
  2875. $10=_st(_st(anIRMethod)._scope())._hasNonLocalReturn();
  2876. if(smalltalk.assert($10)){
  2877. return _st(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  2878. return smalltalk.withContext(function($ctx5) {
  2879. return ($ctx5.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]));
  2880. $ctx5.supercall = false;
  2881. $ctx5.sendIdx["visitIRMethod:"]=1;
  2882. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)})}));
  2883. } else {
  2884. return ($ctx4.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]));
  2885. $ctx4.supercall = false;
  2886. };
  2887. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)})}));
  2888. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),_st(anIRMethod)._arguments());
  2889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2890. return self}, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},globals.IRJSTranslator)})},
  2891. args: ["anIRMethod"],
  2892. source: "visitIRMethod: anIRMethod\x0a\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod\x0a\x09\x09with: [ self stream\x0a\x09\x09\x09nextPutFunctionWith: [\x0a\x09\x09\x09\x09self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09\x09anIRMethod classReferences do: [ :each | self stream nextPutClassRefFunction: each ].\x0a\x09\x09\x09\x09self stream nextPutContextFor: anIRMethod during: [\x0a\x09\x09\x09\x09anIRMethod internalVariables notEmpty ifTrue: [\x0a\x09\x09\x09\x09\x09self stream nextPutVars: (anIRMethod internalVariables asSet 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 ]",
  2893. messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "classReferences", "nextPutClassRefFunction:", "nextPutContextFor:during:", "ifTrue:", "notEmpty", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"],
  2894. referencedClasses: []
  2895. }),
  2896. globals.IRJSTranslator);
  2897. smalltalk.addMethod(
  2898. smalltalk.method({
  2899. selector: "visitIRNonLocalReturn:",
  2900. protocol: 'visiting',
  2901. fn: function (anIRNonLocalReturn){
  2902. var self=this;
  2903. return smalltalk.withContext(function($ctx1) {
  2904. _st(self._stream())._nextPutNonLocalReturnWith_((function(){
  2905. return smalltalk.withContext(function($ctx2) {
  2906. return ($ctx2.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]));
  2907. $ctx2.supercall = false;
  2908. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2909. return self}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRJSTranslator)})},
  2910. args: ["anIRNonLocalReturn"],
  2911. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  2912. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"],
  2913. referencedClasses: []
  2914. }),
  2915. globals.IRJSTranslator);
  2916. smalltalk.addMethod(
  2917. smalltalk.method({
  2918. selector: "visitIRReturn:",
  2919. protocol: 'visiting',
  2920. fn: function (anIRReturn){
  2921. var self=this;
  2922. return smalltalk.withContext(function($ctx1) {
  2923. _st(self._stream())._nextPutReturnWith_((function(){
  2924. return smalltalk.withContext(function($ctx2) {
  2925. return ($ctx2.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]));
  2926. $ctx2.supercall = false;
  2927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2928. return self}, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRJSTranslator)})},
  2929. args: ["anIRReturn"],
  2930. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  2931. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"],
  2932. referencedClasses: []
  2933. }),
  2934. globals.IRJSTranslator);
  2935. smalltalk.addMethod(
  2936. smalltalk.method({
  2937. selector: "visitIRSend:",
  2938. protocol: 'visiting',
  2939. fn: function (anIRSend){
  2940. var self=this;
  2941. var sends;
  2942. return smalltalk.withContext(function($ctx1) {
  2943. var $1,$2,$receiver;
  2944. sends=_st(_st(_st(_st(anIRSend)._method())._sendIndexes())._at_(_st(anIRSend)._selector()))._size();
  2945. $1=_st(anIRSend)._classSend();
  2946. if(($receiver = $1) == null || $receiver.isNil){
  2947. self._visitSend_(anIRSend);
  2948. } else {
  2949. self._visitSuperSend_(anIRSend);
  2950. };
  2951. $2=_st(_st(sends).__gt((1)))._and_((function(){
  2952. return smalltalk.withContext(function($ctx2) {
  2953. return _st(_st(anIRSend)._index()).__lt(sends);
  2954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  2955. if(smalltalk.assert($2)){
  2956. _st(self._stream())._nextPutSendIndexFor_(anIRSend);
  2957. };
  2958. return self}, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends},globals.IRJSTranslator)})},
  2959. args: ["anIRSend"],
  2960. source: "visitIRSend: anIRSend\x0a\x09| sends |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend classSend\x0a\x09\x09ifNil: [ self visitSend: anIRSend ]\x0a\x09\x09ifNotNil: [ self visitSuperSend: anIRSend ].\x0a\x09\x09\x0a\x09(sends > 1 and: [ anIRSend index < sends ])\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
  2961. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifNil:ifNotNil:", "classSend", "visitSend:", "visitSuperSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"],
  2962. referencedClasses: []
  2963. }),
  2964. globals.IRJSTranslator);
  2965. smalltalk.addMethod(
  2966. smalltalk.method({
  2967. selector: "visitIRSequence:",
  2968. protocol: 'visiting',
  2969. fn: function (anIRSequence){
  2970. var self=this;
  2971. return smalltalk.withContext(function($ctx1) {
  2972. var $1;
  2973. $1=self._stream();
  2974. $ctx1.sendIdx["stream"]=1;
  2975. _st($1)._nextPutSequenceWith_((function(){
  2976. return smalltalk.withContext(function($ctx2) {
  2977. return _st(_st(anIRSequence)._instructions())._do_((function(each){
  2978. return smalltalk.withContext(function($ctx3) {
  2979. return _st(self._stream())._nextPutStatementWith_(self._visit_(each));
  2980. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}));
  2981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2982. return self}, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},globals.IRJSTranslator)})},
  2983. args: ["anIRSequence"],
  2984. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
  2985. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"],
  2986. referencedClasses: []
  2987. }),
  2988. globals.IRJSTranslator);
  2989. smalltalk.addMethod(
  2990. smalltalk.method({
  2991. selector: "visitIRTempDeclaration:",
  2992. protocol: 'visiting',
  2993. fn: function (anIRTempDeclaration){
  2994. var self=this;
  2995. return self},
  2996. args: ["anIRTempDeclaration"],
  2997. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  2998. messageSends: [],
  2999. referencedClasses: []
  3000. }),
  3001. globals.IRJSTranslator);
  3002. smalltalk.addMethod(
  3003. smalltalk.method({
  3004. selector: "visitIRValue:",
  3005. protocol: 'visiting',
  3006. fn: function (anIRValue){
  3007. var self=this;
  3008. return smalltalk.withContext(function($ctx1) {
  3009. _st(self._stream())._nextPutAll_(_st(_st(anIRValue)._value())._asJavascript());
  3010. return self}, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},globals.IRJSTranslator)})},
  3011. args: ["anIRValue"],
  3012. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  3013. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"],
  3014. referencedClasses: []
  3015. }),
  3016. globals.IRJSTranslator);
  3017. smalltalk.addMethod(
  3018. smalltalk.method({
  3019. selector: "visitIRVariable:",
  3020. protocol: 'visiting',
  3021. fn: function (anIRVariable){
  3022. var self=this;
  3023. return smalltalk.withContext(function($ctx1) {
  3024. var $3,$2,$1,$4;
  3025. $3=_st(anIRVariable)._variable();
  3026. $ctx1.sendIdx["variable"]=1;
  3027. $2=_st($3)._name();
  3028. $1=_st($2).__eq("thisContext");
  3029. if(smalltalk.assert($1)){
  3030. $4=self._stream();
  3031. $ctx1.sendIdx["stream"]=1;
  3032. _st($4)._nextPutAll_("smalltalk.getThisContext()");
  3033. $ctx1.sendIdx["nextPutAll:"]=1;
  3034. } else {
  3035. _st(self._stream())._nextPutAll_(_st(_st(anIRVariable)._variable())._alias());
  3036. };
  3037. return self}, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},globals.IRJSTranslator)})},
  3038. args: ["anIRVariable"],
  3039. source: "visitIRVariable: anIRVariable\x0a\x09anIRVariable variable name = 'thisContext'\x0a\x09\x09ifTrue: [ self stream nextPutAll: 'smalltalk.getThisContext()' ]\x0a\x09\x09ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]",
  3040. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"],
  3041. referencedClasses: []
  3042. }),
  3043. globals.IRJSTranslator);
  3044. smalltalk.addMethod(
  3045. smalltalk.method({
  3046. selector: "visitIRVerbatim:",
  3047. protocol: 'visiting',
  3048. fn: function (anIRVerbatim){
  3049. var self=this;
  3050. return smalltalk.withContext(function($ctx1) {
  3051. var $1;
  3052. $1=self._stream();
  3053. $ctx1.sendIdx["stream"]=1;
  3054. _st($1)._nextPutStatementWith_((function(){
  3055. return smalltalk.withContext(function($ctx2) {
  3056. return _st(self._stream())._nextPutAll_(_st(anIRVerbatim)._source());
  3057. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3058. return self}, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},globals.IRJSTranslator)})},
  3059. args: ["anIRVerbatim"],
  3060. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  3061. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"],
  3062. referencedClasses: []
  3063. }),
  3064. globals.IRJSTranslator);
  3065. smalltalk.addMethod(
  3066. smalltalk.method({
  3067. selector: "visitReceiver:",
  3068. protocol: 'visiting',
  3069. fn: function (anIRInstruction){
  3070. var self=this;
  3071. return smalltalk.withContext(function($ctx1) {
  3072. var $1,$2,$3;
  3073. $1=_st(anIRInstruction)._needsBoxingAsReceiver();
  3074. if(! smalltalk.assert($1)){
  3075. $2=self._visit_(anIRInstruction);
  3076. $ctx1.sendIdx["visit:"]=1;
  3077. return $2;
  3078. };
  3079. $3=self._stream();
  3080. $ctx1.sendIdx["stream"]=1;
  3081. _st($3)._nextPutAll_("_st(");
  3082. $ctx1.sendIdx["nextPutAll:"]=1;
  3083. self._visit_(anIRInstruction);
  3084. _st(self._stream())._nextPutAll_(")");
  3085. return self}, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},globals.IRJSTranslator)})},
  3086. args: ["anIRInstruction"],
  3087. source: "visitReceiver: anIRInstruction\x0a\x09anIRInstruction needsBoxingAsReceiver ifFalse: [ ^ self visit: anIRInstruction ].\x0a\x09\x0a\x09self stream nextPutAll: '_st('.\x0a\x09self visit: anIRInstruction.\x0a\x09self stream nextPutAll: ')'",
  3088. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"],
  3089. referencedClasses: []
  3090. }),
  3091. globals.IRJSTranslator);
  3092. smalltalk.addMethod(
  3093. smalltalk.method({
  3094. selector: "visitSend:",
  3095. protocol: 'visiting',
  3096. fn: function (anIRSend){
  3097. var self=this;
  3098. return smalltalk.withContext(function($ctx1) {
  3099. var $2,$1,$3,$4,$5;
  3100. $2=_st(anIRSend)._instructions();
  3101. $ctx1.sendIdx["instructions"]=1;
  3102. $1=_st($2)._first();
  3103. self._visitReceiver_($1);
  3104. $3=self._stream();
  3105. $ctx1.sendIdx["stream"]=1;
  3106. $4=_st(".".__comma(_st(_st(anIRSend)._selector())._asJavaScriptMethodName())).__comma("(");
  3107. $ctx1.sendIdx[","]=1;
  3108. _st($3)._nextPutAll_($4);
  3109. $ctx1.sendIdx["nextPutAll:"]=1;
  3110. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  3111. return smalltalk.withContext(function($ctx2) {
  3112. return self._visit_(each);
  3113. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  3114. return smalltalk.withContext(function($ctx2) {
  3115. $5=self._stream();
  3116. $ctx2.sendIdx["stream"]=2;
  3117. return _st($5)._nextPutAll_(",");
  3118. $ctx2.sendIdx["nextPutAll:"]=2;
  3119. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3120. _st(self._stream())._nextPutAll_(")");
  3121. return self}, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},globals.IRJSTranslator)})},
  3122. args: ["anIRSend"],
  3123. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName, '('.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ')'",
  3124. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "do:separatedBy:", "allButFirst", "visit:"],
  3125. referencedClasses: []
  3126. }),
  3127. globals.IRJSTranslator);
  3128. smalltalk.addMethod(
  3129. smalltalk.method({
  3130. selector: "visitSuperSend:",
  3131. protocol: 'visiting',
  3132. fn: function (anIRSend){
  3133. var self=this;
  3134. return smalltalk.withContext(function($ctx1) {
  3135. var $1,$2,$6,$5,$4,$3,$7,$8,$9,$11,$10,$12,$13,$14,$15;
  3136. $1=self._stream();
  3137. $ctx1.sendIdx["stream"]=1;
  3138. $2=$1;
  3139. $6=_st(anIRSend)._scope();
  3140. $ctx1.sendIdx["scope"]=1;
  3141. $5=_st($6)._alias();
  3142. $ctx1.sendIdx["alias"]=1;
  3143. $4="(".__comma($5);
  3144. $ctx1.sendIdx[","]=2;
  3145. $3=_st($4).__comma(".supercall = true, ");
  3146. $ctx1.sendIdx[","]=1;
  3147. _st($2)._nextPutAll_($3);
  3148. $ctx1.sendIdx["nextPutAll:"]=1;
  3149. _st($1)._nextPutAll_(_st(self._currentClass())._asJavascript());
  3150. $ctx1.sendIdx["nextPutAll:"]=2;
  3151. _st($1)._nextPutAll_(".superclass.fn.prototype.");
  3152. $ctx1.sendIdx["nextPutAll:"]=3;
  3153. $7=$1;
  3154. $8=_st(_st(_st(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  3155. $ctx1.sendIdx[","]=3;
  3156. _st($7)._nextPutAll_($8);
  3157. $ctx1.sendIdx["nextPutAll:"]=4;
  3158. $9=_st($1)._nextPutAll_("_st(");
  3159. $ctx1.sendIdx["nextPutAll:"]=5;
  3160. $11=_st(anIRSend)._instructions();
  3161. $ctx1.sendIdx["instructions"]=1;
  3162. $10=_st($11)._first();
  3163. self._visit_($10);
  3164. $ctx1.sendIdx["visit:"]=1;
  3165. $12=self._stream();
  3166. $ctx1.sendIdx["stream"]=2;
  3167. _st($12)._nextPutAll_("), [");
  3168. $ctx1.sendIdx["nextPutAll:"]=6;
  3169. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  3170. return smalltalk.withContext(function($ctx2) {
  3171. return self._visit_(each);
  3172. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  3173. return smalltalk.withContext(function($ctx2) {
  3174. $13=self._stream();
  3175. $ctx2.sendIdx["stream"]=3;
  3176. return _st($13)._nextPutAll_(",");
  3177. $ctx2.sendIdx["nextPutAll:"]=7;
  3178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3179. $14=self._stream();
  3180. _st($14)._nextPutAll_("]));");
  3181. $ctx1.sendIdx["nextPutAll:"]=8;
  3182. _st($14)._lf();
  3183. $15=_st($14)._nextPutAll_(_st(_st(_st(anIRSend)._scope())._alias()).__comma(".supercall = false"));
  3184. return self}, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},globals.IRJSTranslator)})},
  3185. args: ["anIRSend"],
  3186. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '(', anIRSend scope alias, '.supercall = true, ';\x0a\x09\x09nextPutAll: self currentClass asJavascript;\x0a\x09\x09nextPutAll: '.superclass.fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '_st('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll: '), ['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream \x0a\x09\x09nextPutAll: ']));'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false'",
  3187. messageSends: ["nextPutAll:", "stream", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst", "lf"],
  3188. referencedClasses: []
  3189. }),
  3190. globals.IRJSTranslator);
  3191. smalltalk.addClass('JSStream', globals.Object, ['stream'], 'Compiler-IR');
  3192. smalltalk.addMethod(
  3193. smalltalk.method({
  3194. selector: "contents",
  3195. protocol: 'accessing',
  3196. fn: function (){
  3197. var self=this;
  3198. return smalltalk.withContext(function($ctx1) {
  3199. var $1;
  3200. $1=_st(self["@stream"])._contents();
  3201. return $1;
  3202. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.JSStream)})},
  3203. args: [],
  3204. source: "contents\x0a\x09^ stream contents",
  3205. messageSends: ["contents"],
  3206. referencedClasses: []
  3207. }),
  3208. globals.JSStream);
  3209. smalltalk.addMethod(
  3210. smalltalk.method({
  3211. selector: "initialize",
  3212. protocol: 'initialization',
  3213. fn: function (){
  3214. var self=this;
  3215. return smalltalk.withContext(function($ctx1) {
  3216. ($ctx1.supercall = true, globals.JSStream.superclass.fn.prototype._initialize.apply(_st(self), []));
  3217. $ctx1.supercall = false;
  3218. self["@stream"]=""._writeStream();
  3219. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.JSStream)})},
  3220. args: [],
  3221. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  3222. messageSends: ["initialize", "writeStream"],
  3223. referencedClasses: []
  3224. }),
  3225. globals.JSStream);
  3226. smalltalk.addMethod(
  3227. smalltalk.method({
  3228. selector: "lf",
  3229. protocol: 'streaming',
  3230. fn: function (){
  3231. var self=this;
  3232. return smalltalk.withContext(function($ctx1) {
  3233. _st(self["@stream"])._lf();
  3234. return self}, function($ctx1) {$ctx1.fill(self,"lf",{},globals.JSStream)})},
  3235. args: [],
  3236. source: "lf\x0a\x09stream lf",
  3237. messageSends: ["lf"],
  3238. referencedClasses: []
  3239. }),
  3240. globals.JSStream);
  3241. smalltalk.addMethod(
  3242. smalltalk.method({
  3243. selector: "nextPut:",
  3244. protocol: 'streaming',
  3245. fn: function (aString){
  3246. var self=this;
  3247. return smalltalk.withContext(function($ctx1) {
  3248. _st(self["@stream"])._nextPut_(aString);
  3249. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},globals.JSStream)})},
  3250. args: ["aString"],
  3251. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  3252. messageSends: ["nextPut:"],
  3253. referencedClasses: []
  3254. }),
  3255. globals.JSStream);
  3256. smalltalk.addMethod(
  3257. smalltalk.method({
  3258. selector: "nextPutAll:",
  3259. protocol: 'streaming',
  3260. fn: function (aString){
  3261. var self=this;
  3262. return smalltalk.withContext(function($ctx1) {
  3263. _st(self["@stream"])._nextPutAll_(aString);
  3264. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},globals.JSStream)})},
  3265. args: ["aString"],
  3266. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  3267. messageSends: ["nextPutAll:"],
  3268. referencedClasses: []
  3269. }),
  3270. globals.JSStream);
  3271. smalltalk.addMethod(
  3272. smalltalk.method({
  3273. selector: "nextPutAssignment",
  3274. protocol: 'streaming',
  3275. fn: function (){
  3276. var self=this;
  3277. return smalltalk.withContext(function($ctx1) {
  3278. _st(self["@stream"])._nextPutAll_("=");
  3279. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},globals.JSStream)})},
  3280. args: [],
  3281. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  3282. messageSends: ["nextPutAll:"],
  3283. referencedClasses: []
  3284. }),
  3285. globals.JSStream);
  3286. smalltalk.addMethod(
  3287. smalltalk.method({
  3288. selector: "nextPutBlockContextFor:during:",
  3289. protocol: 'streaming',
  3290. fn: function (anIRClosure,aBlock){
  3291. var self=this;
  3292. return smalltalk.withContext(function($ctx1) {
  3293. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$24,$23,$22,$21,$20,$19,$18;
  3294. $1=_st(anIRClosure)._requiresSmalltalkContext();
  3295. if(! smalltalk.assert($1)){
  3296. $2=_st(aBlock)._value();
  3297. $ctx1.sendIdx["value"]=1;
  3298. return $2;
  3299. };
  3300. $6=_st(anIRClosure)._scope();
  3301. $ctx1.sendIdx["scope"]=1;
  3302. $5=_st($6)._alias();
  3303. $ctx1.sendIdx["alias"]=1;
  3304. $4="return smalltalk.withContext(function(".__comma($5);
  3305. $ctx1.sendIdx[","]=2;
  3306. $3=_st($4).__comma(") {");
  3307. $ctx1.sendIdx[","]=1;
  3308. self._nextPutAll_($3);
  3309. $ctx1.sendIdx["nextPutAll:"]=1;
  3310. $7=self._lf();
  3311. _st(aBlock)._value();
  3312. $11=_st(anIRClosure)._scope();
  3313. $ctx1.sendIdx["scope"]=2;
  3314. $10=_st($11)._alias();
  3315. $ctx1.sendIdx["alias"]=2;
  3316. $9="}, function(".__comma($10);
  3317. $ctx1.sendIdx[","]=4;
  3318. $8=_st($9).__comma(") {");
  3319. $ctx1.sendIdx[","]=3;
  3320. self._nextPutAll_($8);
  3321. $ctx1.sendIdx["nextPutAll:"]=2;
  3322. $15=_st(anIRClosure)._scope();
  3323. $ctx1.sendIdx["scope"]=3;
  3324. $14=_st($15)._alias();
  3325. $ctx1.sendIdx["alias"]=3;
  3326. $13=_st($14).__comma(".fillBlock({");
  3327. $ctx1.sendIdx[","]=5;
  3328. $12=self._nextPutAll_($13);
  3329. $ctx1.sendIdx["nextPutAll:"]=3;
  3330. _st(_st(anIRClosure)._locals())._do_separatedBy_((function(each){
  3331. return smalltalk.withContext(function($ctx2) {
  3332. $16=_st(each)._asVariableName();
  3333. $ctx2.sendIdx["asVariableName"]=1;
  3334. self._nextPutAll_($16);
  3335. $ctx2.sendIdx["nextPutAll:"]=4;
  3336. self._nextPutAll_(":");
  3337. $ctx2.sendIdx["nextPutAll:"]=5;
  3338. $17=self._nextPutAll_(_st(each)._asVariableName());
  3339. $ctx2.sendIdx["nextPutAll:"]=6;
  3340. return $17;
  3341. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})
  3342. }),(function(){
  3343. return smalltalk.withContext(function($ctx2) {
  3344. return self._nextPutAll_(",");
  3345. $ctx2.sendIdx["nextPutAll:"]=7;
  3346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})
  3347. }));
  3348. self._nextPutAll_("},");
  3349. $ctx1.sendIdx["nextPutAll:"]=8;
  3350. $24=_st(anIRClosure)._scope();
  3351. $ctx1.sendIdx["scope"]=4;
  3352. $23=_st($24)._outerScope();
  3353. $22=_st($23)._alias();
  3354. $21=_st($22).__comma(",");
  3355. $20=_st($21).__comma(_st(_st(_st(anIRClosure)._scope())._blockIndex())._asString());
  3356. $ctx1.sendIdx[","]=7;
  3357. $19=_st($20).__comma(")});");
  3358. $ctx1.sendIdx[","]=6;
  3359. $18=self._nextPutAll_($19);
  3360. return self}, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},globals.JSStream)});
  3361. },
  3362. args: ["anIRClosure", "aBlock"],
  3363. source: "nextPutBlockContextFor: anIRClosure during: aBlock\x0a\x09anIRClosure requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09self\x0a\x09\x09nextPutAll: 'return smalltalk.withContext(function(', anIRClosure scope alias, ') {'; lf.\x0a\x09\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '}, function(', anIRClosure scope alias, ') {';\x0a\x09\x09nextPutAll: anIRClosure scope alias, '.fillBlock({'.\x0a\x09\x0a\x09anIRClosure locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: anIRClosure scope outerScope alias, ',', anIRClosure scope blockIndex asString, ')});'",
  3364. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", ",", "alias", "scope", "lf", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"],
  3365. referencedClasses: []
  3366. }),
  3367. globals.JSStream);
  3368. smalltalk.addMethod(
  3369. smalltalk.method({
  3370. selector: "nextPutClassRefFunction:",
  3371. protocol: 'streaming',
  3372. fn: function (aString){
  3373. var self=this;
  3374. return smalltalk.withContext(function($ctx1) {
  3375. var $1,$2;
  3376. $1=self["@stream"];
  3377. _st($1)._nextPutAll_("function $");
  3378. $ctx1.sendIdx["nextPutAll:"]=1;
  3379. _st($1)._nextPutAll_(aString);
  3380. $ctx1.sendIdx["nextPutAll:"]=2;
  3381. _st($1)._nextPutAll_("(){return globals.");
  3382. $ctx1.sendIdx["nextPutAll:"]=3;
  3383. _st($1)._nextPutAll_(aString);
  3384. $ctx1.sendIdx["nextPutAll:"]=4;
  3385. _st($1)._nextPutAll_("||(typeof ");
  3386. $ctx1.sendIdx["nextPutAll:"]=5;
  3387. _st($1)._nextPutAll_(aString);
  3388. $ctx1.sendIdx["nextPutAll:"]=6;
  3389. _st($1)._nextPutAll_("==\x22undefined\x22?nil:");
  3390. $ctx1.sendIdx["nextPutAll:"]=7;
  3391. _st($1)._nextPutAll_(aString);
  3392. $ctx1.sendIdx["nextPutAll:"]=8;
  3393. _st($1)._nextPutAll_(")}");
  3394. $2=_st($1)._lf();
  3395. return self}, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},globals.JSStream)})},
  3396. args: ["aString"],
  3397. source: "nextPutClassRefFunction: aString\x0a\x09\x22Creates an inner function $aString into method and called as `$Foo()`whenever the global is accessed.\x0a\x09This ensures that undefined global access will answer `nil`\x22\x0a\x09\x0a\x09stream\x0a\x09\x09nextPutAll: 'function $';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '(){return globals.';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '||(typeof ';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '==\x22undefined\x22?nil:';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: ')}';\x0a\x09\x09lf",
  3398. messageSends: ["nextPutAll:", "lf"],
  3399. referencedClasses: []
  3400. }),
  3401. globals.JSStream);
  3402. smalltalk.addMethod(
  3403. smalltalk.method({
  3404. selector: "nextPutClosureWith:arguments:",
  3405. protocol: 'streaming',
  3406. fn: function (aBlock,anArray){
  3407. var self=this;
  3408. return smalltalk.withContext(function($ctx1) {
  3409. var $1,$2,$3,$4;
  3410. _st(self["@stream"])._nextPutAll_("(function(");
  3411. $ctx1.sendIdx["nextPutAll:"]=1;
  3412. _st(anArray)._do_separatedBy_((function(each){
  3413. return smalltalk.withContext(function($ctx2) {
  3414. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  3415. $ctx2.sendIdx["nextPutAll:"]=2;
  3416. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  3417. return smalltalk.withContext(function($ctx2) {
  3418. return _st(self["@stream"])._nextPut_(",");
  3419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3420. $1=self["@stream"];
  3421. _st($1)._nextPutAll_("){");
  3422. $ctx1.sendIdx["nextPutAll:"]=3;
  3423. $2=_st($1)._lf();
  3424. $ctx1.sendIdx["lf"]=1;
  3425. _st(aBlock)._value();
  3426. $3=self["@stream"];
  3427. _st($3)._lf();
  3428. $4=_st($3)._nextPutAll_("})");
  3429. return self}, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},globals.JSStream)})
  3430. },
  3431. args: ["aBlock", "anArray"],
  3432. 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 lf; nextPutAll: '})'",
  3433. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  3434. referencedClasses: []
  3435. }),
  3436. globals.JSStream);
  3437. smalltalk.addMethod(
  3438. smalltalk.method({
  3439. selector: "nextPutContextFor:during:",
  3440. protocol: 'streaming',
  3441. fn: function (aMethod,aBlock){
  3442. var self=this;
  3443. return smalltalk.withContext(function($ctx1) {
  3444. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18,$19;
  3445. $1=_st(aMethod)._requiresSmalltalkContext();
  3446. if(! smalltalk.assert($1)){
  3447. $2=_st(aBlock)._value();
  3448. $ctx1.sendIdx["value"]=1;
  3449. return $2;
  3450. };
  3451. $6=_st(aMethod)._scope();
  3452. $ctx1.sendIdx["scope"]=1;
  3453. $5=_st($6)._alias();
  3454. $ctx1.sendIdx["alias"]=1;
  3455. $4="return smalltalk.withContext(function(".__comma($5);
  3456. $ctx1.sendIdx[","]=2;
  3457. $3=_st($4).__comma(") { ");
  3458. $ctx1.sendIdx[","]=1;
  3459. self._nextPutAll_($3);
  3460. $ctx1.sendIdx["nextPutAll:"]=1;
  3461. $7=self._lf();
  3462. _st(aBlock)._value();
  3463. $12=_st(aMethod)._scope();
  3464. $ctx1.sendIdx["scope"]=2;
  3465. $11=_st($12)._alias();
  3466. $ctx1.sendIdx["alias"]=2;
  3467. $10="}, function(".__comma($11);
  3468. $ctx1.sendIdx[","]=5;
  3469. $9=_st($10).__comma(") {");
  3470. $ctx1.sendIdx[","]=4;
  3471. $8=_st($9).__comma(_st(_st(aMethod)._scope())._alias());
  3472. $ctx1.sendIdx[","]=3;
  3473. self._nextPutAll_($8);
  3474. $ctx1.sendIdx["nextPutAll:"]=2;
  3475. $16=_st(_st(aMethod)._selector())._asJavascript();
  3476. $ctx1.sendIdx["asJavascript"]=1;
  3477. $15=".fill(self,".__comma($16);
  3478. $14=_st($15).__comma(",{");
  3479. $ctx1.sendIdx[","]=6;
  3480. $13=self._nextPutAll_($14);
  3481. $ctx1.sendIdx["nextPutAll:"]=3;
  3482. _st(_st(aMethod)._locals())._do_separatedBy_((function(each){
  3483. return smalltalk.withContext(function($ctx2) {
  3484. $17=_st(each)._asVariableName();
  3485. $ctx2.sendIdx["asVariableName"]=1;
  3486. self._nextPutAll_($17);
  3487. $ctx2.sendIdx["nextPutAll:"]=4;
  3488. self._nextPutAll_(":");
  3489. $ctx2.sendIdx["nextPutAll:"]=5;
  3490. $18=self._nextPutAll_(_st(each)._asVariableName());
  3491. $ctx2.sendIdx["nextPutAll:"]=6;
  3492. return $18;
  3493. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})
  3494. }),(function(){
  3495. return smalltalk.withContext(function($ctx2) {
  3496. return self._nextPutAll_(",");
  3497. $ctx2.sendIdx["nextPutAll:"]=7;
  3498. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})
  3499. }));
  3500. self._nextPutAll_("},");
  3501. $ctx1.sendIdx["nextPutAll:"]=8;
  3502. self._nextPutAll_(_st(_st(aMethod)._theClass())._asJavascript());
  3503. $ctx1.sendIdx["nextPutAll:"]=9;
  3504. $19=self._nextPutAll_(")});");
  3505. return self}, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},globals.JSStream)})
  3506. },
  3507. args: ["aMethod", "aBlock"],
  3508. source: "nextPutContextFor: aMethod during: aBlock\x0a\x09aMethod requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: 'return smalltalk.withContext(function(', aMethod scope alias, ') { '; lf.\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '}, function(', aMethod scope alias, ') {', aMethod scope alias;\x0a\x09\x09nextPutAll: '.fill(self,', aMethod selector asJavascript, ',{'.\x0a\x0a\x09aMethod locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: aMethod theClass asJavascript;\x0a\x09\x09nextPutAll: ')});'",
  3509. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", ",", "alias", "scope", "lf", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"],
  3510. referencedClasses: []
  3511. }),
  3512. globals.JSStream);
  3513. smalltalk.addMethod(
  3514. smalltalk.method({
  3515. selector: "nextPutFunctionWith:arguments:",
  3516. protocol: 'streaming',
  3517. fn: function (aBlock,anArray){
  3518. var self=this;
  3519. return smalltalk.withContext(function($ctx1) {
  3520. var $1,$2,$3,$4,$5,$6;
  3521. _st(self["@stream"])._nextPutAll_("fn: function(");
  3522. $ctx1.sendIdx["nextPutAll:"]=1;
  3523. _st(anArray)._do_separatedBy_((function(each){
  3524. return smalltalk.withContext(function($ctx2) {
  3525. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  3526. $ctx2.sendIdx["nextPutAll:"]=2;
  3527. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  3528. return smalltalk.withContext(function($ctx2) {
  3529. return _st(self["@stream"])._nextPut_(",");
  3530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3531. $1=self["@stream"];
  3532. _st($1)._nextPutAll_("){");
  3533. $ctx1.sendIdx["nextPutAll:"]=3;
  3534. $2=_st($1)._lf();
  3535. $ctx1.sendIdx["lf"]=1;
  3536. $3=self["@stream"];
  3537. _st($3)._nextPutAll_("var self=this;");
  3538. $ctx1.sendIdx["nextPutAll:"]=4;
  3539. $4=_st($3)._lf();
  3540. $ctx1.sendIdx["lf"]=2;
  3541. _st(aBlock)._value();
  3542. $5=self["@stream"];
  3543. _st($5)._lf();
  3544. $6=_st($5)._nextPutAll_("}");
  3545. return self}, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},globals.JSStream)})},
  3546. args: ["aBlock", "anArray"],
  3547. 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 lf; nextPutAll: '}'",
  3548. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  3549. referencedClasses: []
  3550. }),
  3551. globals.JSStream);
  3552. smalltalk.addMethod(
  3553. smalltalk.method({
  3554. selector: "nextPutIf:with:",
  3555. protocol: 'streaming',
  3556. fn: function (aBlock,anotherBlock){
  3557. var self=this;
  3558. return smalltalk.withContext(function($ctx1) {
  3559. var $1,$2;
  3560. _st(self["@stream"])._nextPutAll_("if(");
  3561. $ctx1.sendIdx["nextPutAll:"]=1;
  3562. _st(aBlock)._value();
  3563. $ctx1.sendIdx["value"]=1;
  3564. $1=self["@stream"];
  3565. _st($1)._nextPutAll_("){");
  3566. $ctx1.sendIdx["nextPutAll:"]=2;
  3567. $2=_st($1)._lf();
  3568. _st(anotherBlock)._value();
  3569. _st(self["@stream"])._nextPutAll_("}");
  3570. return self}, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.JSStream)})},
  3571. args: ["aBlock", "anotherBlock"],
  3572. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  3573. messageSends: ["nextPutAll:", "value", "lf"],
  3574. referencedClasses: []
  3575. }),
  3576. globals.JSStream);
  3577. smalltalk.addMethod(
  3578. smalltalk.method({
  3579. selector: "nextPutIfElse:with:with:",
  3580. protocol: 'streaming',
  3581. fn: function (aBlock,ifBlock,elseBlock){
  3582. var self=this;
  3583. return smalltalk.withContext(function($ctx1) {
  3584. var $1,$2,$3,$4;
  3585. _st(self["@stream"])._nextPutAll_("if(");
  3586. $ctx1.sendIdx["nextPutAll:"]=1;
  3587. _st(aBlock)._value();
  3588. $ctx1.sendIdx["value"]=1;
  3589. $1=self["@stream"];
  3590. _st($1)._nextPutAll_("){");
  3591. $ctx1.sendIdx["nextPutAll:"]=2;
  3592. $2=_st($1)._lf();
  3593. $ctx1.sendIdx["lf"]=1;
  3594. _st(ifBlock)._value();
  3595. $ctx1.sendIdx["value"]=2;
  3596. $3=self["@stream"];
  3597. _st($3)._nextPutAll_("} else {");
  3598. $ctx1.sendIdx["nextPutAll:"]=3;
  3599. $4=_st($3)._lf();
  3600. _st(elseBlock)._value();
  3601. _st(self["@stream"])._nextPutAll_("}");
  3602. return self}, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},globals.JSStream)})},
  3603. args: ["aBlock", "ifBlock", "elseBlock"],
  3604. 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: '}'",
  3605. messageSends: ["nextPutAll:", "value", "lf"],
  3606. referencedClasses: []
  3607. }),
  3608. globals.JSStream);
  3609. smalltalk.addMethod(
  3610. smalltalk.method({
  3611. selector: "nextPutMethodDeclaration:with:",
  3612. protocol: 'streaming',
  3613. fn: function (aMethod,aBlock){
  3614. var self=this;
  3615. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  3616. return smalltalk.withContext(function($ctx1) {
  3617. var $1,$2,$5,$4,$3,$6,$9,$8,$7,$10,$11,$12,$15,$14,$13,$16,$19,$18,$17,$20,$23,$22,$21,$24,$25,$26;
  3618. $1=self["@stream"];
  3619. _st($1)._nextPutAll_("smalltalk.method({");
  3620. $ctx1.sendIdx["nextPutAll:"]=1;
  3621. _st($1)._lf();
  3622. $ctx1.sendIdx["lf"]=1;
  3623. $2=$1;
  3624. $5=_st(_st(aMethod)._selector())._asJavascript();
  3625. $ctx1.sendIdx["asJavascript"]=1;
  3626. $4="selector: ".__comma($5);
  3627. $ctx1.sendIdx[","]=2;
  3628. $3=_st($4).__comma(",");
  3629. $ctx1.sendIdx[","]=1;
  3630. _st($2)._nextPutAll_($3);
  3631. $ctx1.sendIdx["nextPutAll:"]=2;
  3632. _st($1)._lf();
  3633. $ctx1.sendIdx["lf"]=2;
  3634. $6=$1;
  3635. $9=_st(_st(aMethod)._source())._asJavascript();
  3636. $ctx1.sendIdx["asJavascript"]=2;
  3637. $8="source: ".__comma($9);
  3638. $ctx1.sendIdx[","]=4;
  3639. $7=_st($8).__comma(",");
  3640. $ctx1.sendIdx[","]=3;
  3641. _st($6)._nextPutAll_($7);
  3642. $ctx1.sendIdx["nextPutAll:"]=3;
  3643. $10=_st($1)._lf();
  3644. $ctx1.sendIdx["lf"]=3;
  3645. _st(aBlock)._value();
  3646. $ctx1.sendIdx["value"]=1;
  3647. $11=self["@stream"];
  3648. $12=$11;
  3649. $15=_st($String())._lf();
  3650. $ctx1.sendIdx["lf"]=4;
  3651. $14=",".__comma($15);
  3652. $ctx1.sendIdx[","]=6;
  3653. $13=_st($14).__comma("messageSends: ");
  3654. $ctx1.sendIdx[","]=5;
  3655. _st($12)._nextPutAll_($13);
  3656. $ctx1.sendIdx["nextPutAll:"]=4;
  3657. $16=$11;
  3658. $19=_st(_st(aMethod)._messageSends())._asArray();
  3659. $ctx1.sendIdx["asArray"]=1;
  3660. $18=_st($19)._asJavascript();
  3661. $ctx1.sendIdx["asJavascript"]=3;
  3662. $17=_st($18).__comma(",");
  3663. $ctx1.sendIdx[","]=7;
  3664. _st($16)._nextPutAll_($17);
  3665. $ctx1.sendIdx["nextPutAll:"]=5;
  3666. _st($11)._lf();
  3667. $ctx1.sendIdx["lf"]=5;
  3668. $20=$11;
  3669. $23=_st(_st(_st(_st(aMethod)._arguments())._collect_((function(each){
  3670. return smalltalk.withContext(function($ctx2) {
  3671. return _st(each)._value();
  3672. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._asArray())._asJavascript();
  3673. $ctx1.sendIdx["asJavascript"]=4;
  3674. $22="args: ".__comma($23);
  3675. $21=_st($22).__comma(",");
  3676. $ctx1.sendIdx[","]=8;
  3677. _st($20)._nextPutAll_($21);
  3678. $ctx1.sendIdx["nextPutAll:"]=6;
  3679. _st($11)._lf();
  3680. $24=_st($11)._nextPutAll_("referencedClasses: [");
  3681. $ctx1.sendIdx["nextPutAll:"]=7;
  3682. _st(_st(aMethod)._classReferences())._do_separatedBy_((function(each){
  3683. return smalltalk.withContext(function($ctx2) {
  3684. return _st(self["@stream"])._nextPutAll_(_st(each)._asJavascript());
  3685. $ctx2.sendIdx["nextPutAll:"]=8;
  3686. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  3687. return smalltalk.withContext(function($ctx2) {
  3688. return _st(self["@stream"])._nextPutAll_(",");
  3689. $ctx2.sendIdx["nextPutAll:"]=9;
  3690. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  3691. $25=self["@stream"];
  3692. _st($25)._nextPutAll_("]");
  3693. $ctx1.sendIdx["nextPutAll:"]=10;
  3694. $26=_st($25)._nextPutAll_("})");
  3695. return self}, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},globals.JSStream)})},
  3696. args: ["aMethod", "aBlock"],
  3697. source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: 'smalltalk.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ','; 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\x09\x09nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences\x0a\x09\x09do: [ :each | stream nextPutAll: each asJavascript ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream\x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'",
  3698. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"],
  3699. referencedClasses: ["String"]
  3700. }),
  3701. globals.JSStream);
  3702. smalltalk.addMethod(
  3703. smalltalk.method({
  3704. selector: "nextPutNonLocalReturnHandlingWith:",
  3705. protocol: 'streaming',
  3706. fn: function (aBlock){
  3707. var self=this;
  3708. return smalltalk.withContext(function($ctx1) {
  3709. var $1,$2,$3,$4;
  3710. $1=self["@stream"];
  3711. _st($1)._nextPutAll_("var $early={};");
  3712. $ctx1.sendIdx["nextPutAll:"]=1;
  3713. _st($1)._lf();
  3714. $ctx1.sendIdx["lf"]=1;
  3715. _st($1)._nextPutAll_("try {");
  3716. $ctx1.sendIdx["nextPutAll:"]=2;
  3717. $2=_st($1)._lf();
  3718. $ctx1.sendIdx["lf"]=2;
  3719. _st(aBlock)._value();
  3720. $3=self["@stream"];
  3721. _st($3)._nextPutAll_("}");
  3722. $ctx1.sendIdx["nextPutAll:"]=3;
  3723. _st($3)._lf();
  3724. $ctx1.sendIdx["lf"]=3;
  3725. _st($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  3726. $4=_st($3)._lf();
  3727. return self}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},globals.JSStream)})},
  3728. args: ["aBlock"],
  3729. 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",
  3730. messageSends: ["nextPutAll:", "lf", "value"],
  3731. referencedClasses: []
  3732. }),
  3733. globals.JSStream);
  3734. smalltalk.addMethod(
  3735. smalltalk.method({
  3736. selector: "nextPutNonLocalReturnWith:",
  3737. protocol: 'streaming',
  3738. fn: function (aBlock){
  3739. var self=this;
  3740. return smalltalk.withContext(function($ctx1) {
  3741. _st(self["@stream"])._nextPutAll_("throw $early=[");
  3742. $ctx1.sendIdx["nextPutAll:"]=1;
  3743. _st(aBlock)._value();
  3744. _st(self["@stream"])._nextPutAll_("]");
  3745. return self}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},globals.JSStream)})},
  3746. args: ["aBlock"],
  3747. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  3748. messageSends: ["nextPutAll:", "value"],
  3749. referencedClasses: []
  3750. }),
  3751. globals.JSStream);
  3752. smalltalk.addMethod(
  3753. smalltalk.method({
  3754. selector: "nextPutReturn",
  3755. protocol: 'streaming',
  3756. fn: function (){
  3757. var self=this;
  3758. return smalltalk.withContext(function($ctx1) {
  3759. _st(self["@stream"])._nextPutAll_("return ");
  3760. return self}, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},globals.JSStream)})},
  3761. args: [],
  3762. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  3763. messageSends: ["nextPutAll:"],
  3764. referencedClasses: []
  3765. }),
  3766. globals.JSStream);
  3767. smalltalk.addMethod(
  3768. smalltalk.method({
  3769. selector: "nextPutReturnWith:",
  3770. protocol: 'streaming',
  3771. fn: function (aBlock){
  3772. var self=this;
  3773. return smalltalk.withContext(function($ctx1) {
  3774. self._nextPutReturn();
  3775. _st(aBlock)._value();
  3776. return self}, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},globals.JSStream)})},
  3777. args: ["aBlock"],
  3778. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  3779. messageSends: ["nextPutReturn", "value"],
  3780. referencedClasses: []
  3781. }),
  3782. globals.JSStream);
  3783. smalltalk.addMethod(
  3784. smalltalk.method({
  3785. selector: "nextPutSendIndexFor:",
  3786. protocol: 'streaming',
  3787. fn: function (anIRSend){
  3788. var self=this;
  3789. return smalltalk.withContext(function($ctx1) {
  3790. var $1;
  3791. self._nextPutAll_(";");
  3792. $ctx1.sendIdx["nextPutAll:"]=1;
  3793. self._lf();
  3794. self._nextPutAll_(_st(_st(anIRSend)._scope())._alias());
  3795. $ctx1.sendIdx["nextPutAll:"]=2;
  3796. self._nextPutAll_(".sendIdx[");
  3797. $ctx1.sendIdx["nextPutAll:"]=3;
  3798. self._nextPutAll_(_st(_st(anIRSend)._selector())._asJavascript());
  3799. $ctx1.sendIdx["nextPutAll:"]=4;
  3800. self._nextPutAll_("]=");
  3801. $ctx1.sendIdx["nextPutAll:"]=5;
  3802. $1=self._nextPutAll_(_st(_st(anIRSend)._index())._asString());
  3803. return self}, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},globals.JSStream)})},
  3804. args: ["anIRSend"],
  3805. source: "nextPutSendIndexFor: anIRSend\x0a\x09self \x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias;\x0a\x09\x09nextPutAll: '.sendIdx[';\x0a\x09\x09nextPutAll: anIRSend selector asJavascript;\x0a\x09\x09nextPutAll: ']=';\x0a\x09\x09nextPutAll: anIRSend index asString",
  3806. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"],
  3807. referencedClasses: []
  3808. }),
  3809. globals.JSStream);
  3810. smalltalk.addMethod(
  3811. smalltalk.method({
  3812. selector: "nextPutSequenceWith:",
  3813. protocol: 'streaming',
  3814. fn: function (aBlock){
  3815. var self=this;
  3816. return smalltalk.withContext(function($ctx1) {
  3817. _st(aBlock)._value();
  3818. return self}, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},globals.JSStream)})},
  3819. args: ["aBlock"],
  3820. 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",
  3821. messageSends: ["value"],
  3822. referencedClasses: []
  3823. }),
  3824. globals.JSStream);
  3825. smalltalk.addMethod(
  3826. smalltalk.method({
  3827. selector: "nextPutStatementWith:",
  3828. protocol: 'streaming',
  3829. fn: function (aBlock){
  3830. var self=this;
  3831. return smalltalk.withContext(function($ctx1) {
  3832. var $1,$2;
  3833. _st(aBlock)._value();
  3834. $1=self["@stream"];
  3835. _st($1)._nextPutAll_(";");
  3836. $2=_st($1)._lf();
  3837. return self}, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},globals.JSStream)})},
  3838. args: ["aBlock"],
  3839. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  3840. messageSends: ["value", "nextPutAll:", "lf"],
  3841. referencedClasses: []
  3842. }),
  3843. globals.JSStream);
  3844. smalltalk.addMethod(
  3845. smalltalk.method({
  3846. selector: "nextPutVars:",
  3847. protocol: 'streaming',
  3848. fn: function (aCollection){
  3849. var self=this;
  3850. return smalltalk.withContext(function($ctx1) {
  3851. var $1,$2;
  3852. var $early={};
  3853. try {
  3854. _st(aCollection)._ifEmpty_((function(){
  3855. throw $early=[self];
  3856. }));
  3857. _st(self["@stream"])._nextPutAll_("var ");
  3858. $ctx1.sendIdx["nextPutAll:"]=1;
  3859. _st(aCollection)._do_separatedBy_((function(each){
  3860. return smalltalk.withContext(function($ctx2) {
  3861. return _st(self["@stream"])._nextPutAll_(each);
  3862. $ctx2.sendIdx["nextPutAll:"]=2;
  3863. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  3864. return smalltalk.withContext(function($ctx2) {
  3865. return _st(self["@stream"])._nextPutAll_(",");
  3866. $ctx2.sendIdx["nextPutAll:"]=3;
  3867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  3868. $1=self["@stream"];
  3869. _st($1)._nextPutAll_(";");
  3870. $2=_st($1)._lf();
  3871. return self}
  3872. catch(e) {if(e===$early)return e[0]; throw e}
  3873. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},globals.JSStream)})},
  3874. args: ["aCollection"],
  3875. source: "nextPutVars: aCollection\x0a\x09aCollection ifEmpty: [ ^ self ].\x0a\x09\x0a\x09stream nextPutAll: 'var '.\x0a\x09aCollection\x0a\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ';'; lf",
  3876. messageSends: ["ifEmpty:", "nextPutAll:", "do:separatedBy:", "lf"],
  3877. referencedClasses: []
  3878. }),
  3879. globals.JSStream);
  3880. smalltalk.addMethod(
  3881. smalltalk.method({
  3882. selector: "appendToInstruction:",
  3883. protocol: '*Compiler-IR',
  3884. fn: function (anIRInstruction){
  3885. var self=this;
  3886. return smalltalk.withContext(function($ctx1) {
  3887. _st(anIRInstruction)._appendBlock_(self);
  3888. return self}, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},globals.BlockClosure)})},
  3889. args: ["anIRInstruction"],
  3890. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  3891. messageSends: ["appendBlock:"],
  3892. referencedClasses: []
  3893. }),
  3894. globals.BlockClosure);
  3895. });