Compiler-IR.js 129 KB

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