1
0

Compiler-IR.js 129 KB

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