1
0

Compiler-IR.js 140 KB

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