Compiler-Interpreter.js 129 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986
  1. define(["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Semantic", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  2. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  3. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  4. $core.addPackage("Compiler-Interpreter");
  5. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  6. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  8. //>>excludeStart("ide", pragmas.excludeIdeData);
  9. $globals.AIBlockClosure.comment="I am a special `BlockClosure` subclass used by an interpreter to interpret a block node.\x0a\x0aWhile I am polymorphic with `BlockClosure`, some methods such as `#new` will raise interpretation errors. Unlike a `BlockClosure`, my instance are not JavaScript functions.\x0a\x0aEvaluating an instance will result in interpreting the `node` instance variable (instance of `BlockNode`).";
  10. //>>excludeEnd("ide");
  11. $core.addMethod(
  12. $core.method({
  13. selector: "applyTo:arguments:",
  14. protocol: "evaluating",
  15. fn: function (anObject,aCollection){
  16. var self=this,$self=this;
  17. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18. return $core.withContext(function($ctx1) {
  19. //>>excludeEnd("ctx");
  20. $self._interpreterError();
  21. return self;
  22. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  24. //>>excludeEnd("ctx");
  25. },
  26. //>>excludeStart("ide", pragmas.excludeIdeData);
  27. args: ["anObject", "aCollection"],
  28. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  29. referencedClasses: [],
  30. //>>excludeEnd("ide");
  31. messageSends: ["interpreterError"]
  32. }),
  33. $globals.AIBlockClosure);
  34. $core.addMethod(
  35. $core.method({
  36. selector: "compiledSource",
  37. protocol: "accessing",
  38. fn: function (){
  39. var self=this,$self=this;
  40. return "[ AST Block closure ]";
  41. },
  42. //>>excludeStart("ide", pragmas.excludeIdeData);
  43. args: [],
  44. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  45. referencedClasses: [],
  46. //>>excludeEnd("ide");
  47. messageSends: []
  48. }),
  49. $globals.AIBlockClosure);
  50. $core.addMethod(
  51. $core.method({
  52. selector: "currySelf",
  53. protocol: "converting",
  54. fn: function (){
  55. var self=this,$self=this;
  56. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57. return $core.withContext(function($ctx1) {
  58. //>>excludeEnd("ctx");
  59. $self._interpreterError();
  60. return self;
  61. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  63. //>>excludeEnd("ctx");
  64. },
  65. //>>excludeStart("ide", pragmas.excludeIdeData);
  66. args: [],
  67. source: "currySelf\x0a\x09self interpreterError",
  68. referencedClasses: [],
  69. //>>excludeEnd("ide");
  70. messageSends: ["interpreterError"]
  71. }),
  72. $globals.AIBlockClosure);
  73. $core.addMethod(
  74. $core.method({
  75. selector: "initializeWithContext:node:",
  76. protocol: "initialization",
  77. fn: function (aContext,aNode){
  78. var self=this,$self=this;
  79. $self["@node"]=aNode;
  80. $self["@outerContext"]=aContext;
  81. return self;
  82. },
  83. //>>excludeStart("ide", pragmas.excludeIdeData);
  84. args: ["aContext", "aNode"],
  85. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  86. referencedClasses: [],
  87. //>>excludeEnd("ide");
  88. messageSends: []
  89. }),
  90. $globals.AIBlockClosure);
  91. $core.addMethod(
  92. $core.method({
  93. selector: "interpreterError",
  94. protocol: "error handling",
  95. fn: function (){
  96. var self=this,$self=this;
  97. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  98. return $core.withContext(function($ctx1) {
  99. //>>excludeEnd("ctx");
  100. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  101. return self;
  102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  103. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  104. //>>excludeEnd("ctx");
  105. },
  106. //>>excludeStart("ide", pragmas.excludeIdeData);
  107. args: [],
  108. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  109. referencedClasses: ["ASTInterpreterError"],
  110. //>>excludeEnd("ide");
  111. messageSends: ["signal:"]
  112. }),
  113. $globals.AIBlockClosure);
  114. $core.addMethod(
  115. $core.method({
  116. selector: "numArgs",
  117. protocol: "accessing",
  118. fn: function (){
  119. var self=this,$self=this;
  120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  121. return $core.withContext(function($ctx1) {
  122. //>>excludeEnd("ctx");
  123. return $recv($recv($self["@node"])._temps())._size();
  124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  125. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  126. //>>excludeEnd("ctx");
  127. },
  128. //>>excludeStart("ide", pragmas.excludeIdeData);
  129. args: [],
  130. source: "numArgs\x0a\x09^ node temps size",
  131. referencedClasses: [],
  132. //>>excludeEnd("ide");
  133. messageSends: ["size", "temps"]
  134. }),
  135. $globals.AIBlockClosure);
  136. $core.addMethod(
  137. $core.method({
  138. selector: "value",
  139. protocol: "evaluating",
  140. fn: function (){
  141. var self=this,$self=this;
  142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  143. return $core.withContext(function($ctx1) {
  144. //>>excludeEnd("ctx");
  145. return $self._valueWithPossibleArguments_([]);
  146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  147. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  148. //>>excludeEnd("ctx");
  149. },
  150. //>>excludeStart("ide", pragmas.excludeIdeData);
  151. args: [],
  152. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  153. referencedClasses: [],
  154. //>>excludeEnd("ide");
  155. messageSends: ["valueWithPossibleArguments:"]
  156. }),
  157. $globals.AIBlockClosure);
  158. $core.addMethod(
  159. $core.method({
  160. selector: "value:",
  161. protocol: "evaluating",
  162. fn: function (anArgument){
  163. var self=this,$self=this;
  164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  165. return $core.withContext(function($ctx1) {
  166. //>>excludeEnd("ctx");
  167. return $self._valueWithPossibleArguments_([anArgument]);
  168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  169. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  170. //>>excludeEnd("ctx");
  171. },
  172. //>>excludeStart("ide", pragmas.excludeIdeData);
  173. args: ["anArgument"],
  174. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  175. referencedClasses: [],
  176. //>>excludeEnd("ide");
  177. messageSends: ["valueWithPossibleArguments:"]
  178. }),
  179. $globals.AIBlockClosure);
  180. $core.addMethod(
  181. $core.method({
  182. selector: "value:value:",
  183. protocol: "evaluating",
  184. fn: function (firstArgument,secondArgument){
  185. var self=this,$self=this;
  186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  187. return $core.withContext(function($ctx1) {
  188. //>>excludeEnd("ctx");
  189. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  191. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  192. //>>excludeEnd("ctx");
  193. },
  194. //>>excludeStart("ide", pragmas.excludeIdeData);
  195. args: ["firstArgument", "secondArgument"],
  196. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  197. referencedClasses: [],
  198. //>>excludeEnd("ide");
  199. messageSends: ["valueWithPossibleArguments:"]
  200. }),
  201. $globals.AIBlockClosure);
  202. $core.addMethod(
  203. $core.method({
  204. selector: "value:value:value:",
  205. protocol: "evaluating",
  206. fn: function (firstArgument,secondArgument,thirdArgument){
  207. var self=this,$self=this;
  208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  209. return $core.withContext(function($ctx1) {
  210. //>>excludeEnd("ctx");
  211. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  213. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  214. //>>excludeEnd("ctx");
  215. },
  216. //>>excludeStart("ide", pragmas.excludeIdeData);
  217. args: ["firstArgument", "secondArgument", "thirdArgument"],
  218. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  219. referencedClasses: [],
  220. //>>excludeEnd("ide");
  221. messageSends: ["valueWithPossibleArguments:"]
  222. }),
  223. $globals.AIBlockClosure);
  224. $core.addMethod(
  225. $core.method({
  226. selector: "valueWithPossibleArguments:",
  227. protocol: "evaluating",
  228. fn: function (aCollection){
  229. var self=this,$self=this;
  230. var context,sequenceNode;
  231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  232. return $core.withContext(function($ctx1) {
  233. //>>excludeEnd("ctx");
  234. var $1,$2,$3;
  235. context=$recv($self["@outerContext"])._newInnerContext();
  236. $1=$recv($recv($recv($self["@node"])._dagChildren())._first())._copy();
  237. $recv($1)._parent_(nil);
  238. sequenceNode=$recv($1)._yourself();
  239. $recv($recv(sequenceNode)._temps())._do_((function(each){
  240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  241. return $core.withContext(function($ctx2) {
  242. //>>excludeEnd("ctx");
  243. return $recv(context)._defineLocal_(each);
  244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  245. $ctx2.sendIdx["defineLocal:"]=1;
  246. //>>excludeEnd("ctx");
  247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  248. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  249. //>>excludeEnd("ctx");
  250. }));
  251. $recv($recv($self["@node"])._parameters())._withIndexDo_((function(each,index){
  252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  253. return $core.withContext(function($ctx2) {
  254. //>>excludeEnd("ctx");
  255. $recv(context)._defineLocal_(each);
  256. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  257. return nil;
  258. })));
  259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  260. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  261. //>>excludeEnd("ctx");
  262. }));
  263. $2=$recv(context)._interpreter();
  264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  265. $ctx1.sendIdx["interpreter"]=1;
  266. //>>excludeEnd("ctx");
  267. $recv($2)._node_(sequenceNode);
  268. $recv($2)._enterNode();
  269. $recv($2)._proceed();
  270. $3=$recv($self["@outerContext"])._interpreter();
  271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  272. $ctx1.sendIdx["interpreter"]=2;
  273. //>>excludeEnd("ctx");
  274. $recv($3)._setNonLocalReturnFromContext_(context);
  275. return $recv($recv(context)._interpreter())._pop();
  276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  277. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  278. //>>excludeEnd("ctx");
  279. },
  280. //>>excludeStart("ide", pragmas.excludeIdeData);
  281. args: ["aCollection"],
  282. source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newInnerContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node dagChildren first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals in the context\x22\x0a\x09sequenceNode temps do: [ :each |\x0a\x09\x09context defineLocal: each ].\x0a\x09\x09\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context defineLocal: each.\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
  283. referencedClasses: [],
  284. //>>excludeEnd("ide");
  285. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  286. }),
  287. $globals.AIBlockClosure);
  288. $core.addMethod(
  289. $core.method({
  290. selector: "forContext:node:",
  291. protocol: "instance creation",
  292. fn: function (aContext,aNode){
  293. var self=this,$self=this;
  294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  295. return $core.withContext(function($ctx1) {
  296. //>>excludeEnd("ctx");
  297. var $1;
  298. $1=$self._new();
  299. $recv($1)._initializeWithContext_node_(aContext,aNode);
  300. return $recv($1)._yourself();
  301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  302. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.a$cls)});
  303. //>>excludeEnd("ctx");
  304. },
  305. //>>excludeStart("ide", pragmas.excludeIdeData);
  306. args: ["aContext", "aNode"],
  307. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  308. referencedClasses: [],
  309. //>>excludeEnd("ide");
  310. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  311. }),
  312. $globals.AIBlockClosure.a$cls);
  313. $core.addClass("AIContext", $globals.MethodContext, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  314. //>>excludeStart("ide", pragmas.excludeIdeData);
  315. $globals.AIContext.comment="I am like a `MethodContext`, used by the `ASTInterpreter`.\x0aUnlike a `MethodContext`, my instances are not read-only.\x0a\x0aWhen debugging, my instances are created by copying the current `MethodContext` (thisContext)";
  316. //>>excludeEnd("ide");
  317. $core.addMethod(
  318. $core.method({
  319. selector: "arguments",
  320. protocol: "interpreting",
  321. fn: function (){
  322. var self=this,$self=this;
  323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  324. return $core.withContext(function($ctx1) {
  325. //>>excludeEnd("ctx");
  326. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  328. return $core.withContext(function($ctx2) {
  329. //>>excludeEnd("ctx");
  330. return $self._localAt_ifAbsent_(each,(function(){
  331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  332. return $core.withContext(function($ctx3) {
  333. //>>excludeEnd("ctx");
  334. return $self._error_("Argument not in context");
  335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  336. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  337. //>>excludeEnd("ctx");
  338. }));
  339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  340. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  341. //>>excludeEnd("ctx");
  342. }));
  343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  344. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  345. //>>excludeEnd("ctx");
  346. },
  347. //>>excludeStart("ide", pragmas.excludeIdeData);
  348. args: [],
  349. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  350. referencedClasses: [],
  351. //>>excludeEnd("ide");
  352. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  353. }),
  354. $globals.AIContext);
  355. $core.addMethod(
  356. $core.method({
  357. selector: "ast",
  358. protocol: "interpreting",
  359. fn: function (){
  360. var self=this,$self=this;
  361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  362. return $core.withContext(function($ctx1) {
  363. //>>excludeEnd("ctx");
  364. var $1,$2,$3,$receiver;
  365. $1=$self._isBlockContext();
  366. if($core.assert($1)){
  367. $2=$self._outerContext();
  368. if(($receiver = $2) == null || $receiver.a$nil){
  369. return $2;
  370. } else {
  371. var context;
  372. context=$receiver;
  373. return $recv(context)._ast();
  374. }
  375. }
  376. $3=$self["@ast"];
  377. if(($receiver = $3) == null || $receiver.a$nil){
  378. $self._initializeAST();
  379. } else {
  380. $3;
  381. }
  382. return $self["@ast"];
  383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  384. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  385. //>>excludeEnd("ctx");
  386. },
  387. //>>excludeStart("ide", pragmas.excludeIdeData);
  388. args: [],
  389. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  390. referencedClasses: [],
  391. //>>excludeEnd("ide");
  392. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  393. }),
  394. $globals.AIContext);
  395. $core.addMethod(
  396. $core.method({
  397. selector: "basicLocalAt:",
  398. protocol: "private",
  399. fn: function (aString){
  400. var self=this,$self=this;
  401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  402. return $core.withContext(function($ctx1) {
  403. //>>excludeEnd("ctx");
  404. return $recv($self._locals())._at_(aString);
  405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  406. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  407. //>>excludeEnd("ctx");
  408. },
  409. //>>excludeStart("ide", pragmas.excludeIdeData);
  410. args: ["aString"],
  411. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  412. referencedClasses: [],
  413. //>>excludeEnd("ide");
  414. messageSends: ["at:", "locals"]
  415. }),
  416. $globals.AIContext);
  417. $core.addMethod(
  418. $core.method({
  419. selector: "basicLocalAt:put:",
  420. protocol: "private",
  421. fn: function (aString,anObject){
  422. var self=this,$self=this;
  423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  424. return $core.withContext(function($ctx1) {
  425. //>>excludeEnd("ctx");
  426. $recv($self._locals())._at_put_(aString,anObject);
  427. return self;
  428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  429. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  430. //>>excludeEnd("ctx");
  431. },
  432. //>>excludeStart("ide", pragmas.excludeIdeData);
  433. args: ["aString", "anObject"],
  434. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  435. referencedClasses: [],
  436. //>>excludeEnd("ide");
  437. messageSends: ["at:put:", "locals"]
  438. }),
  439. $globals.AIContext);
  440. $core.addMethod(
  441. $core.method({
  442. selector: "basicReceiver",
  443. protocol: "interpreting",
  444. fn: function (){
  445. var self=this,$self=this;
  446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  447. return $core.withContext(function($ctx1) {
  448. //>>excludeEnd("ctx");
  449. return $self._localAt_("self");
  450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  451. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  452. //>>excludeEnd("ctx");
  453. },
  454. //>>excludeStart("ide", pragmas.excludeIdeData);
  455. args: [],
  456. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  457. referencedClasses: [],
  458. //>>excludeEnd("ide");
  459. messageSends: ["localAt:"]
  460. }),
  461. $globals.AIContext);
  462. $core.addMethod(
  463. $core.method({
  464. selector: "defineLocal:",
  465. protocol: "accessing",
  466. fn: function (aString){
  467. var self=this,$self=this;
  468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  469. return $core.withContext(function($ctx1) {
  470. //>>excludeEnd("ctx");
  471. $recv($self._locals())._at_put_(aString,nil);
  472. return self;
  473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  474. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  475. //>>excludeEnd("ctx");
  476. },
  477. //>>excludeStart("ide", pragmas.excludeIdeData);
  478. args: ["aString"],
  479. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  480. referencedClasses: [],
  481. //>>excludeEnd("ide");
  482. messageSends: ["at:put:", "locals"]
  483. }),
  484. $globals.AIContext);
  485. $core.addMethod(
  486. $core.method({
  487. selector: "evaluate:on:",
  488. protocol: "evaluating",
  489. fn: function (aString,anEvaluator){
  490. var self=this,$self=this;
  491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  492. return $core.withContext(function($ctx1) {
  493. //>>excludeEnd("ctx");
  494. return $recv(anEvaluator)._evaluate_context_(aString,self);
  495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  496. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  497. //>>excludeEnd("ctx");
  498. },
  499. //>>excludeStart("ide", pragmas.excludeIdeData);
  500. args: ["aString", "anEvaluator"],
  501. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  502. referencedClasses: [],
  503. //>>excludeEnd("ide");
  504. messageSends: ["evaluate:context:"]
  505. }),
  506. $globals.AIContext);
  507. $core.addMethod(
  508. $core.method({
  509. selector: "evaluateNode:",
  510. protocol: "evaluating",
  511. fn: function (aNode){
  512. var self=this,$self=this;
  513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  514. return $core.withContext(function($ctx1) {
  515. //>>excludeEnd("ctx");
  516. var $1;
  517. $1=$recv($globals.ASTInterpreter)._new();
  518. $recv($1)._context_(self);
  519. $recv($1)._node_(aNode);
  520. $recv($1)._enterNode();
  521. $recv($1)._proceed();
  522. return $recv($1)._result();
  523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  524. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  525. //>>excludeEnd("ctx");
  526. },
  527. //>>excludeStart("ide", pragmas.excludeIdeData);
  528. args: ["aNode"],
  529. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  530. referencedClasses: ["ASTInterpreter"],
  531. //>>excludeEnd("ide");
  532. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  533. }),
  534. $globals.AIContext);
  535. $core.addMethod(
  536. $core.method({
  537. selector: "evaluatedSelector",
  538. protocol: "accessing",
  539. fn: function (){
  540. var self=this,$self=this;
  541. return $self["@evaluatedSelector"];
  542. },
  543. //>>excludeStart("ide", pragmas.excludeIdeData);
  544. args: [],
  545. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  546. referencedClasses: [],
  547. //>>excludeEnd("ide");
  548. messageSends: []
  549. }),
  550. $globals.AIContext);
  551. $core.addMethod(
  552. $core.method({
  553. selector: "evaluatedSelector:",
  554. protocol: "accessing",
  555. fn: function (aString){
  556. var self=this,$self=this;
  557. $self["@evaluatedSelector"]=aString;
  558. return self;
  559. },
  560. //>>excludeStart("ide", pragmas.excludeIdeData);
  561. args: ["aString"],
  562. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  563. referencedClasses: [],
  564. //>>excludeEnd("ide");
  565. messageSends: []
  566. }),
  567. $globals.AIContext);
  568. $core.addMethod(
  569. $core.method({
  570. selector: "index",
  571. protocol: "accessing",
  572. fn: function (){
  573. var self=this,$self=this;
  574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  575. return $core.withContext(function($ctx1) {
  576. //>>excludeEnd("ctx");
  577. var $1,$receiver;
  578. $1=$self["@index"];
  579. if(($receiver = $1) == null || $receiver.a$nil){
  580. return (0);
  581. } else {
  582. return $1;
  583. }
  584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  585. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  586. //>>excludeEnd("ctx");
  587. },
  588. //>>excludeStart("ide", pragmas.excludeIdeData);
  589. args: [],
  590. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  591. referencedClasses: [],
  592. //>>excludeEnd("ide");
  593. messageSends: ["ifNil:"]
  594. }),
  595. $globals.AIContext);
  596. $core.addMethod(
  597. $core.method({
  598. selector: "index:",
  599. protocol: "accessing",
  600. fn: function (anInteger){
  601. var self=this,$self=this;
  602. $self["@index"]=anInteger;
  603. return self;
  604. },
  605. //>>excludeStart("ide", pragmas.excludeIdeData);
  606. args: ["anInteger"],
  607. source: "index: anInteger\x0a\x09index := anInteger",
  608. referencedClasses: [],
  609. //>>excludeEnd("ide");
  610. messageSends: []
  611. }),
  612. $globals.AIContext);
  613. $core.addMethod(
  614. $core.method({
  615. selector: "initializeAST",
  616. protocol: "initialization",
  617. fn: function (){
  618. var self=this,$self=this;
  619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  620. return $core.withContext(function($ctx1) {
  621. //>>excludeEnd("ctx");
  622. var $1;
  623. $1=$self._method();
  624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  625. $ctx1.sendIdx["method"]=1;
  626. //>>excludeEnd("ctx");
  627. $self["@ast"]=$recv($1)._ast();
  628. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._methodClass()))._visit_($self["@ast"]);
  629. return self;
  630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  631. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  632. //>>excludeEnd("ctx");
  633. },
  634. //>>excludeStart("ide", pragmas.excludeIdeData);
  635. args: [],
  636. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  637. referencedClasses: ["SemanticAnalyzer"],
  638. //>>excludeEnd("ide");
  639. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  640. }),
  641. $globals.AIContext);
  642. $core.addMethod(
  643. $core.method({
  644. selector: "initializeFromMethodContext:",
  645. protocol: "initialization",
  646. fn: function (aMethodContext){
  647. var self=this,$self=this;
  648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  649. return $core.withContext(function($ctx1) {
  650. //>>excludeEnd("ctx");
  651. var $1,$2,$3,$receiver;
  652. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  653. $self._index_($recv(aMethodContext)._index());
  654. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  655. $self._receiver_($recv(aMethodContext)._receiver());
  656. $self._supercall_($recv(aMethodContext)._supercall());
  657. $self._selector_($recv(aMethodContext)._selector());
  658. $1=$recv(aMethodContext)._outerContext();
  659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  660. $ctx1.sendIdx["outerContext"]=1;
  661. //>>excludeEnd("ctx");
  662. if(($receiver = $1) == null || $receiver.a$nil){
  663. $1;
  664. } else {
  665. var outer;
  666. outer=$receiver;
  667. $2=$recv(outer)._methodContext();
  668. if(($receiver = $2) == null || $receiver.a$nil){
  669. $2;
  670. } else {
  671. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  672. }
  673. $3=$recv(aMethodContext)._locals();
  674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  675. $ctx1.sendIdx["locals"]=1;
  676. //>>excludeEnd("ctx");
  677. $recv($3)._keysAndValuesDo_((function(key,value){
  678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  679. return $core.withContext(function($ctx2) {
  680. //>>excludeEnd("ctx");
  681. return $recv($self._locals())._at_put_(key,value);
  682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  683. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  684. //>>excludeEnd("ctx");
  685. }));
  686. }
  687. return self;
  688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  689. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  690. //>>excludeEnd("ctx");
  691. },
  692. //>>excludeStart("ide", pragmas.excludeIdeData);
  693. args: ["aMethodContext"],
  694. source: "initializeFromMethodContext: aMethodContext\x0a\x0a\x09self\x0a\x09\x09evaluatedSelector: aMethodContext evaluatedSelector;\x0a\x09\x09index: aMethodContext index;\x0a\x09\x09sendIndexes: aMethodContext sendIndexes;\x0a\x09\x09receiver: aMethodContext receiver;\x0a\x09\x09supercall: aMethodContext supercall;\x0a\x09\x09selector: aMethodContext selector.\x0a\x09\x09\x0a\x09aMethodContext outerContext ifNotNil: [ :outer |\x0a\x09\x09\x22If the method context is nil, the block was defined in JS, so ignore it\x22\x0a\x09\x09outer methodContext ifNotNil: [\x0a\x09\x09\x09self outerContext: (self class fromMethodContext: aMethodContext outerContext) ].\x0a\x09\x09\x09aMethodContext locals keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09\x09self locals at: key put: value ] ]",
  695. referencedClasses: [],
  696. //>>excludeEnd("ide");
  697. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  698. }),
  699. $globals.AIContext);
  700. $core.addMethod(
  701. $core.method({
  702. selector: "initializeInterpreter",
  703. protocol: "initialization",
  704. fn: function (){
  705. var self=this,$self=this;
  706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  707. return $core.withContext(function($ctx1) {
  708. //>>excludeEnd("ctx");
  709. var $1,$2,$receiver;
  710. $1=$recv($globals.ASTInterpreter)._new();
  711. $recv($1)._context_(self);
  712. $self["@interpreter"]=$recv($1)._yourself();
  713. $2=$self._innerContext();
  714. if(($receiver = $2) == null || $receiver.a$nil){
  715. $2;
  716. } else {
  717. $self._setupInterpreter_($self["@interpreter"]);
  718. }
  719. return self;
  720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  721. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  722. //>>excludeEnd("ctx");
  723. },
  724. //>>excludeStart("ide", pragmas.excludeIdeData);
  725. args: [],
  726. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  727. referencedClasses: ["ASTInterpreter"],
  728. //>>excludeEnd("ide");
  729. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  730. }),
  731. $globals.AIContext);
  732. $core.addMethod(
  733. $core.method({
  734. selector: "initializeLocals",
  735. protocol: "initialization",
  736. fn: function (){
  737. var self=this,$self=this;
  738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  739. return $core.withContext(function($ctx1) {
  740. //>>excludeEnd("ctx");
  741. $self["@locals"]=$recv($globals.Dictionary)._new();
  742. $recv($self["@locals"])._at_put_("thisContext",self);
  743. return self;
  744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  745. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  746. //>>excludeEnd("ctx");
  747. },
  748. //>>excludeStart("ide", pragmas.excludeIdeData);
  749. args: [],
  750. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  751. referencedClasses: ["Dictionary"],
  752. //>>excludeEnd("ide");
  753. messageSends: ["new", "at:put:"]
  754. }),
  755. $globals.AIContext);
  756. $core.addMethod(
  757. $core.method({
  758. selector: "innerContext",
  759. protocol: "accessing",
  760. fn: function (){
  761. var self=this,$self=this;
  762. return $self["@innerContext"];
  763. },
  764. //>>excludeStart("ide", pragmas.excludeIdeData);
  765. args: [],
  766. source: "innerContext\x0a\x09^ innerContext",
  767. referencedClasses: [],
  768. //>>excludeEnd("ide");
  769. messageSends: []
  770. }),
  771. $globals.AIContext);
  772. $core.addMethod(
  773. $core.method({
  774. selector: "innerContext:",
  775. protocol: "accessing",
  776. fn: function (anAIContext){
  777. var self=this,$self=this;
  778. $self["@innerContext"]=anAIContext;
  779. return self;
  780. },
  781. //>>excludeStart("ide", pragmas.excludeIdeData);
  782. args: ["anAIContext"],
  783. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  784. referencedClasses: [],
  785. //>>excludeEnd("ide");
  786. messageSends: []
  787. }),
  788. $globals.AIContext);
  789. $core.addMethod(
  790. $core.method({
  791. selector: "interpreter",
  792. protocol: "interpreting",
  793. fn: function (){
  794. var self=this,$self=this;
  795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  796. return $core.withContext(function($ctx1) {
  797. //>>excludeEnd("ctx");
  798. var $1,$receiver;
  799. $1=$self["@interpreter"];
  800. if(($receiver = $1) == null || $receiver.a$nil){
  801. $self._initializeInterpreter();
  802. } else {
  803. $1;
  804. }
  805. return $self["@interpreter"];
  806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  807. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  808. //>>excludeEnd("ctx");
  809. },
  810. //>>excludeStart("ide", pragmas.excludeIdeData);
  811. args: [],
  812. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  813. referencedClasses: [],
  814. //>>excludeEnd("ide");
  815. messageSends: ["ifNil:", "initializeInterpreter"]
  816. }),
  817. $globals.AIContext);
  818. $core.addMethod(
  819. $core.method({
  820. selector: "interpreter:",
  821. protocol: "interpreting",
  822. fn: function (anInterpreter){
  823. var self=this,$self=this;
  824. $self["@interpreter"]=anInterpreter;
  825. return self;
  826. },
  827. //>>excludeStart("ide", pragmas.excludeIdeData);
  828. args: ["anInterpreter"],
  829. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  830. referencedClasses: [],
  831. //>>excludeEnd("ide");
  832. messageSends: []
  833. }),
  834. $globals.AIContext);
  835. $core.addMethod(
  836. $core.method({
  837. selector: "isTopContext",
  838. protocol: "testing",
  839. fn: function (){
  840. var self=this,$self=this;
  841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  842. return $core.withContext(function($ctx1) {
  843. //>>excludeEnd("ctx");
  844. return $recv($self._innerContext())._isNil();
  845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  846. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  847. //>>excludeEnd("ctx");
  848. },
  849. //>>excludeStart("ide", pragmas.excludeIdeData);
  850. args: [],
  851. source: "isTopContext\x0a\x09^ self innerContext isNil",
  852. referencedClasses: [],
  853. //>>excludeEnd("ide");
  854. messageSends: ["isNil", "innerContext"]
  855. }),
  856. $globals.AIContext);
  857. $core.addMethod(
  858. $core.method({
  859. selector: "localAt:",
  860. protocol: "accessing",
  861. fn: function (aString){
  862. var self=this,$self=this;
  863. var context;
  864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  865. return $core.withContext(function($ctx1) {
  866. //>>excludeEnd("ctx");
  867. context=$self._lookupContextForLocal_(aString);
  868. return $recv(context)._basicLocalAt_(aString);
  869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  870. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  871. //>>excludeEnd("ctx");
  872. },
  873. //>>excludeStart("ide", pragmas.excludeIdeData);
  874. args: ["aString"],
  875. source: "localAt: aString\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09^ context basicLocalAt: aString",
  876. referencedClasses: [],
  877. //>>excludeEnd("ide");
  878. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  879. }),
  880. $globals.AIContext);
  881. $core.addMethod(
  882. $core.method({
  883. selector: "localAt:ifAbsent:",
  884. protocol: "accessing",
  885. fn: function (aString,aBlock){
  886. var self=this,$self=this;
  887. var context;
  888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  889. return $core.withContext(function($ctx1) {
  890. //>>excludeEnd("ctx");
  891. var $early={};
  892. try {
  893. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  895. return $core.withContext(function($ctx2) {
  896. //>>excludeEnd("ctx");
  897. throw $early=[$recv(aBlock)._value()];
  898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  900. //>>excludeEnd("ctx");
  901. }));
  902. return $recv(context)._basicLocalAt_(aString);
  903. }
  904. catch(e) {if(e===$early)return e[0]; throw e}
  905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  906. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  907. //>>excludeEnd("ctx");
  908. },
  909. //>>excludeStart("ide", pragmas.excludeIdeData);
  910. args: ["aString", "aBlock"],
  911. source: "localAt: aString ifAbsent: aBlock\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self \x09\x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ ^ aBlock value ].\x0a\x09\x0a\x09^ context basicLocalAt: aString",
  912. referencedClasses: [],
  913. //>>excludeEnd("ide");
  914. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  915. }),
  916. $globals.AIContext);
  917. $core.addMethod(
  918. $core.method({
  919. selector: "localAt:put:",
  920. protocol: "accessing",
  921. fn: function (aString,anObject){
  922. var self=this,$self=this;
  923. var context;
  924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  925. return $core.withContext(function($ctx1) {
  926. //>>excludeEnd("ctx");
  927. context=$self._lookupContextForLocal_(aString);
  928. $recv(context)._basicLocalAt_put_(aString,anObject);
  929. return self;
  930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  931. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  932. //>>excludeEnd("ctx");
  933. },
  934. //>>excludeStart("ide", pragmas.excludeIdeData);
  935. args: ["aString", "anObject"],
  936. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  937. referencedClasses: [],
  938. //>>excludeEnd("ide");
  939. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  940. }),
  941. $globals.AIContext);
  942. $core.addMethod(
  943. $core.method({
  944. selector: "locals",
  945. protocol: "accessing",
  946. fn: function (){
  947. var self=this,$self=this;
  948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  949. return $core.withContext(function($ctx1) {
  950. //>>excludeEnd("ctx");
  951. var $1,$receiver;
  952. $1=$self["@locals"];
  953. if(($receiver = $1) == null || $receiver.a$nil){
  954. $self._initializeLocals();
  955. } else {
  956. $1;
  957. }
  958. return $self["@locals"];
  959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  960. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  961. //>>excludeEnd("ctx");
  962. },
  963. //>>excludeStart("ide", pragmas.excludeIdeData);
  964. args: [],
  965. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  966. referencedClasses: [],
  967. //>>excludeEnd("ide");
  968. messageSends: ["ifNil:", "initializeLocals"]
  969. }),
  970. $globals.AIContext);
  971. $core.addMethod(
  972. $core.method({
  973. selector: "lookupContextForLocal:",
  974. protocol: "private",
  975. fn: function (aString){
  976. var self=this,$self=this;
  977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  978. return $core.withContext(function($ctx1) {
  979. //>>excludeEnd("ctx");
  980. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  982. return $core.withContext(function($ctx2) {
  983. //>>excludeEnd("ctx");
  984. return $self._variableNotFound();
  985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  987. //>>excludeEnd("ctx");
  988. }));
  989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  990. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  991. //>>excludeEnd("ctx");
  992. },
  993. //>>excludeStart("ide", pragmas.excludeIdeData);
  994. args: ["aString"],
  995. source: "lookupContextForLocal: aString\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self \x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ self variableNotFound ]",
  996. referencedClasses: [],
  997. //>>excludeEnd("ide");
  998. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  999. }),
  1000. $globals.AIContext);
  1001. $core.addMethod(
  1002. $core.method({
  1003. selector: "lookupContextForLocal:ifNone:",
  1004. protocol: "private",
  1005. fn: function (aString,aBlock){
  1006. var self=this,$self=this;
  1007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1008. return $core.withContext(function($ctx1) {
  1009. //>>excludeEnd("ctx");
  1010. var $1;
  1011. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  1012. return self;
  1013. }),(function(){
  1014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1015. return $core.withContext(function($ctx2) {
  1016. //>>excludeEnd("ctx");
  1017. $1=$self._outerContext();
  1018. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  1019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1020. return $core.withContext(function($ctx3) {
  1021. //>>excludeEnd("ctx");
  1022. return $recv(context)._lookupContextForLocal_(aString);
  1023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1024. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  1025. //>>excludeEnd("ctx");
  1026. }));
  1027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  1029. //>>excludeEnd("ctx");
  1030. }));
  1031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1032. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  1033. //>>excludeEnd("ctx");
  1034. },
  1035. //>>excludeStart("ide", pragmas.excludeIdeData);
  1036. args: ["aString", "aBlock"],
  1037. source: "lookupContextForLocal: aString ifNone: aBlock\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self locals \x0a\x09\x09at: aString\x0a\x09\x09ifPresent: [ self ]\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09self outerContext \x0a\x09\x09\x09\x09ifNil: aBlock\x0a\x09\x09\x09\x09ifNotNil: [ :context | \x0a\x09\x09\x09\x09\x09context lookupContextForLocal: aString ] ]",
  1038. referencedClasses: [],
  1039. //>>excludeEnd("ide");
  1040. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  1041. }),
  1042. $globals.AIContext);
  1043. $core.addMethod(
  1044. $core.method({
  1045. selector: "newInnerContext",
  1046. protocol: "factory",
  1047. fn: function (){
  1048. var self=this,$self=this;
  1049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1050. return $core.withContext(function($ctx1) {
  1051. //>>excludeEnd("ctx");
  1052. var $1;
  1053. $1=$recv($self._class())._new();
  1054. $recv($1)._outerContext_(self);
  1055. return $recv($1)._yourself();
  1056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1057. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  1058. //>>excludeEnd("ctx");
  1059. },
  1060. //>>excludeStart("ide", pragmas.excludeIdeData);
  1061. args: [],
  1062. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  1063. referencedClasses: [],
  1064. //>>excludeEnd("ide");
  1065. messageSends: ["outerContext:", "new", "class", "yourself"]
  1066. }),
  1067. $globals.AIContext);
  1068. $core.addMethod(
  1069. $core.method({
  1070. selector: "outerContext",
  1071. protocol: "accessing",
  1072. fn: function (){
  1073. var self=this,$self=this;
  1074. return $self["@outerContext"];
  1075. },
  1076. //>>excludeStart("ide", pragmas.excludeIdeData);
  1077. args: [],
  1078. source: "outerContext\x0a\x09^ outerContext",
  1079. referencedClasses: [],
  1080. //>>excludeEnd("ide");
  1081. messageSends: []
  1082. }),
  1083. $globals.AIContext);
  1084. $core.addMethod(
  1085. $core.method({
  1086. selector: "outerContext:",
  1087. protocol: "accessing",
  1088. fn: function (anAIContext){
  1089. var self=this,$self=this;
  1090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1091. return $core.withContext(function($ctx1) {
  1092. //>>excludeEnd("ctx");
  1093. var $1,$receiver;
  1094. $self["@outerContext"]=anAIContext;
  1095. $1=$self["@outerContext"];
  1096. if(($receiver = $1) == null || $receiver.a$nil){
  1097. $1;
  1098. } else {
  1099. var context;
  1100. context=$receiver;
  1101. $recv(context)._innerContext_(self);
  1102. }
  1103. return self;
  1104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1105. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  1106. //>>excludeEnd("ctx");
  1107. },
  1108. //>>excludeStart("ide", pragmas.excludeIdeData);
  1109. args: ["anAIContext"],
  1110. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  1111. referencedClasses: [],
  1112. //>>excludeEnd("ide");
  1113. messageSends: ["ifNotNil:", "innerContext:"]
  1114. }),
  1115. $globals.AIContext);
  1116. $core.addMethod(
  1117. $core.method({
  1118. selector: "receiver:",
  1119. protocol: "interpreting",
  1120. fn: function (anObject){
  1121. var self=this,$self=this;
  1122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1123. return $core.withContext(function($ctx1) {
  1124. //>>excludeEnd("ctx");
  1125. $recv($self._locals())._at_put_("self",anObject);
  1126. return self;
  1127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1128. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  1129. //>>excludeEnd("ctx");
  1130. },
  1131. //>>excludeStart("ide", pragmas.excludeIdeData);
  1132. args: ["anObject"],
  1133. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  1134. referencedClasses: [],
  1135. //>>excludeEnd("ide");
  1136. messageSends: ["at:put:", "locals"]
  1137. }),
  1138. $globals.AIContext);
  1139. $core.addMethod(
  1140. $core.method({
  1141. selector: "selector",
  1142. protocol: "accessing",
  1143. fn: function (){
  1144. var self=this,$self=this;
  1145. return $self["@selector"];
  1146. },
  1147. //>>excludeStart("ide", pragmas.excludeIdeData);
  1148. args: [],
  1149. source: "selector\x0a\x09^ selector",
  1150. referencedClasses: [],
  1151. //>>excludeEnd("ide");
  1152. messageSends: []
  1153. }),
  1154. $globals.AIContext);
  1155. $core.addMethod(
  1156. $core.method({
  1157. selector: "selector:",
  1158. protocol: "accessing",
  1159. fn: function (aString){
  1160. var self=this,$self=this;
  1161. $self["@selector"]=aString;
  1162. return self;
  1163. },
  1164. //>>excludeStart("ide", pragmas.excludeIdeData);
  1165. args: ["aString"],
  1166. source: "selector: aString\x0a\x09selector := aString",
  1167. referencedClasses: [],
  1168. //>>excludeEnd("ide");
  1169. messageSends: []
  1170. }),
  1171. $globals.AIContext);
  1172. $core.addMethod(
  1173. $core.method({
  1174. selector: "sendIndexAt:",
  1175. protocol: "accessing",
  1176. fn: function (aString){
  1177. var self=this,$self=this;
  1178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1179. return $core.withContext(function($ctx1) {
  1180. //>>excludeEnd("ctx");
  1181. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  1182. return (0);
  1183. }));
  1184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1185. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  1186. //>>excludeEnd("ctx");
  1187. },
  1188. //>>excludeStart("ide", pragmas.excludeIdeData);
  1189. args: ["aString"],
  1190. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  1191. referencedClasses: [],
  1192. //>>excludeEnd("ide");
  1193. messageSends: ["at:ifAbsent:", "sendIndexes"]
  1194. }),
  1195. $globals.AIContext);
  1196. $core.addMethod(
  1197. $core.method({
  1198. selector: "sendIndexes",
  1199. protocol: "accessing",
  1200. fn: function (){
  1201. var self=this,$self=this;
  1202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1203. return $core.withContext(function($ctx1) {
  1204. //>>excludeEnd("ctx");
  1205. var $1,$receiver;
  1206. $1=$self["@sendIndexes"];
  1207. if(($receiver = $1) == null || $receiver.a$nil){
  1208. return $recv($globals.Dictionary)._new();
  1209. } else {
  1210. return $1;
  1211. }
  1212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1213. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  1214. //>>excludeEnd("ctx");
  1215. },
  1216. //>>excludeStart("ide", pragmas.excludeIdeData);
  1217. args: [],
  1218. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  1219. referencedClasses: ["Dictionary"],
  1220. //>>excludeEnd("ide");
  1221. messageSends: ["ifNil:", "new"]
  1222. }),
  1223. $globals.AIContext);
  1224. $core.addMethod(
  1225. $core.method({
  1226. selector: "sendIndexes:",
  1227. protocol: "accessing",
  1228. fn: function (aDictionary){
  1229. var self=this,$self=this;
  1230. $self["@sendIndexes"]=aDictionary;
  1231. return self;
  1232. },
  1233. //>>excludeStart("ide", pragmas.excludeIdeData);
  1234. args: ["aDictionary"],
  1235. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  1236. referencedClasses: [],
  1237. //>>excludeEnd("ide");
  1238. messageSends: []
  1239. }),
  1240. $globals.AIContext);
  1241. $core.addMethod(
  1242. $core.method({
  1243. selector: "setupInterpreter:",
  1244. protocol: "interpreting",
  1245. fn: function (anInterpreter){
  1246. var self=this,$self=this;
  1247. var currentNode;
  1248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1249. return $core.withContext(function($ctx1) {
  1250. //>>excludeEnd("ctx");
  1251. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  1252. $1=$recv($globals.ASTPCNodeVisitor)._new();
  1253. $2=$self._evaluatedSelector();
  1254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1255. $ctx1.sendIdx["evaluatedSelector"]=1;
  1256. //>>excludeEnd("ctx");
  1257. $recv($1)._selector_($2);
  1258. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  1259. $3=$self._ast();
  1260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1261. $ctx1.sendIdx["ast"]=1;
  1262. //>>excludeEnd("ctx");
  1263. $recv($1)._visit_($3);
  1264. currentNode=$recv($1)._currentNode();
  1265. $4=$recv($self._ast())._sequenceNode();
  1266. if(($receiver = $4) == null || $receiver.a$nil){
  1267. $4;
  1268. } else {
  1269. var sequence;
  1270. sequence=$receiver;
  1271. $recv($recv(sequence)._temps())._do_((function(each){
  1272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1273. return $core.withContext(function($ctx2) {
  1274. //>>excludeEnd("ctx");
  1275. return $self._defineLocal_(each);
  1276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1277. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  1278. //>>excludeEnd("ctx");
  1279. }));
  1280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1281. $ctx1.sendIdx["do:"]=1;
  1282. //>>excludeEnd("ctx");
  1283. }
  1284. $recv(anInterpreter)._node_(currentNode);
  1285. $7=$self._innerContext();
  1286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1287. $ctx1.sendIdx["innerContext"]=1;
  1288. //>>excludeEnd("ctx");
  1289. $6=$recv($7)._arguments();
  1290. $5=$recv($6)._reversed();
  1291. $recv($5)._do_((function(each){
  1292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1293. return $core.withContext(function($ctx2) {
  1294. //>>excludeEnd("ctx");
  1295. return $recv(anInterpreter)._push_(each);
  1296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1297. $ctx2.sendIdx["push:"]=1;
  1298. //>>excludeEnd("ctx");
  1299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1300. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  1301. //>>excludeEnd("ctx");
  1302. }));
  1303. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  1304. return self;
  1305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1306. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  1307. //>>excludeEnd("ctx");
  1308. },
  1309. //>>excludeStart("ide", pragmas.excludeIdeData);
  1310. args: ["anInterpreter"],
  1311. source: "setupInterpreter: anInterpreter\x0a\x09| currentNode |\x0a\x09\x0a\x09\x22Retrieve the current node\x22\x0a\x09currentNode := ASTPCNodeVisitor new\x0a\x09\x09\x09selector: self evaluatedSelector;\x0a\x09\x09\x09index: (self sendIndexAt: self evaluatedSelector);\x0a\x09\x09\x09visit: self ast;\x0a\x09\x09\x09currentNode.\x0a\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09self ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09self defineLocal: each ] ].\x0a\x09\x0a\x09anInterpreter node: currentNode.\x0a\x0a\x09\x22Push the send args and receiver to the interpreter stack\x22\x09\x0a\x09self innerContext arguments reversed do: [ :each | \x0a\x09\x09anInterpreter push: each ].\x0a\x09\x09\x0a\x09anInterpreter push: (self innerContext receiver)",
  1312. referencedClasses: ["ASTPCNodeVisitor"],
  1313. //>>excludeEnd("ide");
  1314. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  1315. }),
  1316. $globals.AIContext);
  1317. $core.addMethod(
  1318. $core.method({
  1319. selector: "supercall",
  1320. protocol: "interpreting",
  1321. fn: function (){
  1322. var self=this,$self=this;
  1323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1324. return $core.withContext(function($ctx1) {
  1325. //>>excludeEnd("ctx");
  1326. var $1,$receiver;
  1327. $1=$self["@supercall"];
  1328. if(($receiver = $1) == null || $receiver.a$nil){
  1329. return false;
  1330. } else {
  1331. return $1;
  1332. }
  1333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1334. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  1335. //>>excludeEnd("ctx");
  1336. },
  1337. //>>excludeStart("ide", pragmas.excludeIdeData);
  1338. args: [],
  1339. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  1340. referencedClasses: [],
  1341. //>>excludeEnd("ide");
  1342. messageSends: ["ifNil:"]
  1343. }),
  1344. $globals.AIContext);
  1345. $core.addMethod(
  1346. $core.method({
  1347. selector: "supercall:",
  1348. protocol: "interpreting",
  1349. fn: function (aBoolean){
  1350. var self=this,$self=this;
  1351. $self["@supercall"]=aBoolean;
  1352. return self;
  1353. },
  1354. //>>excludeStart("ide", pragmas.excludeIdeData);
  1355. args: ["aBoolean"],
  1356. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  1357. referencedClasses: [],
  1358. //>>excludeEnd("ide");
  1359. messageSends: []
  1360. }),
  1361. $globals.AIContext);
  1362. $core.addMethod(
  1363. $core.method({
  1364. selector: "variableNotFound",
  1365. protocol: "error handling",
  1366. fn: function (){
  1367. var self=this,$self=this;
  1368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1369. return $core.withContext(function($ctx1) {
  1370. //>>excludeEnd("ctx");
  1371. $self._error_("Variable missing");
  1372. return self;
  1373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1374. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  1375. //>>excludeEnd("ctx");
  1376. },
  1377. //>>excludeStart("ide", pragmas.excludeIdeData);
  1378. args: [],
  1379. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  1380. referencedClasses: [],
  1381. //>>excludeEnd("ide");
  1382. messageSends: ["error:"]
  1383. }),
  1384. $globals.AIContext);
  1385. $core.addMethod(
  1386. $core.method({
  1387. selector: "fromMethodContext:",
  1388. protocol: "instance creation",
  1389. fn: function (aMethodContext){
  1390. var self=this,$self=this;
  1391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1392. return $core.withContext(function($ctx1) {
  1393. //>>excludeEnd("ctx");
  1394. var $1;
  1395. $1=$self._new();
  1396. $recv($1)._initializeFromMethodContext_(aMethodContext);
  1397. return $recv($1)._yourself();
  1398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1399. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.a$cls)});
  1400. //>>excludeEnd("ctx");
  1401. },
  1402. //>>excludeStart("ide", pragmas.excludeIdeData);
  1403. args: ["aMethodContext"],
  1404. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  1405. referencedClasses: [],
  1406. //>>excludeEnd("ide");
  1407. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  1408. }),
  1409. $globals.AIContext.a$cls);
  1410. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  1411. //>>excludeStart("ide", pragmas.excludeIdeData);
  1412. $globals.AISemanticAnalyzer.comment="I perform the same semantic analysis than `SemanticAnalyzer`, with the difference that provided an `AIContext` context, variables are bound with the context variables.";
  1413. //>>excludeEnd("ide");
  1414. $core.addMethod(
  1415. $core.method({
  1416. selector: "context",
  1417. protocol: "accessing",
  1418. fn: function (){
  1419. var self=this,$self=this;
  1420. return $self["@context"];
  1421. },
  1422. //>>excludeStart("ide", pragmas.excludeIdeData);
  1423. args: [],
  1424. source: "context\x0a\x09^ context",
  1425. referencedClasses: [],
  1426. //>>excludeEnd("ide");
  1427. messageSends: []
  1428. }),
  1429. $globals.AISemanticAnalyzer);
  1430. $core.addMethod(
  1431. $core.method({
  1432. selector: "context:",
  1433. protocol: "accessing",
  1434. fn: function (anAIContext){
  1435. var self=this,$self=this;
  1436. $self["@context"]=anAIContext;
  1437. return self;
  1438. },
  1439. //>>excludeStart("ide", pragmas.excludeIdeData);
  1440. args: ["anAIContext"],
  1441. source: "context: anAIContext\x0a\x09context := anAIContext",
  1442. referencedClasses: [],
  1443. //>>excludeEnd("ide");
  1444. messageSends: []
  1445. }),
  1446. $globals.AISemanticAnalyzer);
  1447. $core.addMethod(
  1448. $core.method({
  1449. selector: "visitVariableNode:",
  1450. protocol: "visiting",
  1451. fn: function (aNode){
  1452. var self=this,$self=this;
  1453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1454. return $core.withContext(function($ctx1) {
  1455. //>>excludeEnd("ctx");
  1456. var $1;
  1457. var $early={};
  1458. try {
  1459. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  1460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1461. return $core.withContext(function($ctx2) {
  1462. //>>excludeEnd("ctx");
  1463. $1=(
  1464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1465. $ctx2.supercall = true,
  1466. //>>excludeEnd("ctx");
  1467. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
  1468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1469. $ctx2.supercall = false;
  1470. //>>excludeEnd("ctx");;
  1471. throw $early=[$1];
  1472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1474. //>>excludeEnd("ctx");
  1475. }));
  1476. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  1477. return self;
  1478. }
  1479. catch(e) {if(e===$early)return e[0]; throw e}
  1480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1481. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  1482. //>>excludeEnd("ctx");
  1483. },
  1484. //>>excludeStart("ide", pragmas.excludeIdeData);
  1485. args: ["aNode"],
  1486. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  1487. referencedClasses: ["ASTContextVar"],
  1488. //>>excludeEnd("ide");
  1489. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  1490. }),
  1491. $globals.AISemanticAnalyzer);
  1492. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  1493. //>>excludeStart("ide", pragmas.excludeIdeData);
  1494. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  1495. //>>excludeEnd("ide");
  1496. $core.addMethod(
  1497. $core.method({
  1498. selector: "context",
  1499. protocol: "accessing",
  1500. fn: function (){
  1501. var self=this,$self=this;
  1502. return $self["@context"];
  1503. },
  1504. //>>excludeStart("ide", pragmas.excludeIdeData);
  1505. args: [],
  1506. source: "context\x0a\x09^ context",
  1507. referencedClasses: [],
  1508. //>>excludeEnd("ide");
  1509. messageSends: []
  1510. }),
  1511. $globals.ASTContextVar);
  1512. $core.addMethod(
  1513. $core.method({
  1514. selector: "context:",
  1515. protocol: "accessing",
  1516. fn: function (anObject){
  1517. var self=this,$self=this;
  1518. $self["@context"]=anObject;
  1519. return self;
  1520. },
  1521. //>>excludeStart("ide", pragmas.excludeIdeData);
  1522. args: ["anObject"],
  1523. source: "context: anObject\x0a\x09context := anObject",
  1524. referencedClasses: [],
  1525. //>>excludeEnd("ide");
  1526. messageSends: []
  1527. }),
  1528. $globals.ASTContextVar);
  1529. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  1530. //>>excludeStart("ide", pragmas.excludeIdeData);
  1531. $globals.ASTDebugger.comment="I am a stepping debugger interface for Amber code.\x0aI internally use an instance of `ASTInterpreter` to actually step through node and interpret them.\x0a\x0aMy instances are created from an `AIContext` with `ASTDebugger class >> context:`.\x0aThey hold an `AIContext` instance internally, recursive copy of the `MethodContext`.\x0a\x0a## API\x0a\x0aUse the methods of the `'stepping'` protocol to do stepping.";
  1532. //>>excludeEnd("ide");
  1533. $core.addMethod(
  1534. $core.method({
  1535. selector: "atEnd",
  1536. protocol: "testing",
  1537. fn: function (){
  1538. var self=this,$self=this;
  1539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1540. return $core.withContext(function($ctx1) {
  1541. //>>excludeEnd("ctx");
  1542. var $1,$receiver;
  1543. $1=$self._context();
  1544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1545. $ctx1.sendIdx["context"]=1;
  1546. //>>excludeEnd("ctx");
  1547. if(($receiver = $1) == null || $receiver.a$nil){
  1548. return true;
  1549. } else {
  1550. $1;
  1551. }
  1552. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  1553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1554. return $core.withContext(function($ctx2) {
  1555. //>>excludeEnd("ctx");
  1556. return $recv($self._context())._isTopContext();
  1557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1558. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  1559. //>>excludeEnd("ctx");
  1560. }));
  1561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1562. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  1563. //>>excludeEnd("ctx");
  1564. },
  1565. //>>excludeStart("ide", pragmas.excludeIdeData);
  1566. args: [],
  1567. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  1568. referencedClasses: [],
  1569. //>>excludeEnd("ide");
  1570. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  1571. }),
  1572. $globals.ASTDebugger);
  1573. $core.addMethod(
  1574. $core.method({
  1575. selector: "context",
  1576. protocol: "accessing",
  1577. fn: function (){
  1578. var self=this,$self=this;
  1579. return $self["@context"];
  1580. },
  1581. //>>excludeStart("ide", pragmas.excludeIdeData);
  1582. args: [],
  1583. source: "context\x0a\x09^ context",
  1584. referencedClasses: [],
  1585. //>>excludeEnd("ide");
  1586. messageSends: []
  1587. }),
  1588. $globals.ASTDebugger);
  1589. $core.addMethod(
  1590. $core.method({
  1591. selector: "context:",
  1592. protocol: "accessing",
  1593. fn: function (aContext){
  1594. var self=this,$self=this;
  1595. $self["@context"]=aContext;
  1596. return self;
  1597. },
  1598. //>>excludeStart("ide", pragmas.excludeIdeData);
  1599. args: ["aContext"],
  1600. source: "context: aContext\x0a\x09context := aContext",
  1601. referencedClasses: [],
  1602. //>>excludeEnd("ide");
  1603. messageSends: []
  1604. }),
  1605. $globals.ASTDebugger);
  1606. $core.addMethod(
  1607. $core.method({
  1608. selector: "flushInnerContexts",
  1609. protocol: "actions",
  1610. fn: function (){
  1611. var self=this,$self=this;
  1612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1613. return $core.withContext(function($ctx1) {
  1614. //>>excludeEnd("ctx");
  1615. var $1,$receiver;
  1616. $1=$self._context();
  1617. if(($receiver = $1) == null || $receiver.a$nil){
  1618. $1;
  1619. } else {
  1620. var cxt;
  1621. cxt=$receiver;
  1622. $recv(cxt)._innerContext_(nil);
  1623. }
  1624. return self;
  1625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1626. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  1627. //>>excludeEnd("ctx");
  1628. },
  1629. //>>excludeStart("ide", pragmas.excludeIdeData);
  1630. args: [],
  1631. source: "flushInnerContexts\x0a\x09\x22When stepping, the inner contexts are not relevent anymore,\x0a\x09and can be flushed\x22\x0a\x09\x0a\x09self context ifNotNil: [ :cxt | \x0a\x09\x09cxt innerContext: nil ]",
  1632. referencedClasses: [],
  1633. //>>excludeEnd("ide");
  1634. messageSends: ["ifNotNil:", "context", "innerContext:"]
  1635. }),
  1636. $globals.ASTDebugger);
  1637. $core.addMethod(
  1638. $core.method({
  1639. selector: "interpreter",
  1640. protocol: "accessing",
  1641. fn: function (){
  1642. var self=this,$self=this;
  1643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1644. return $core.withContext(function($ctx1) {
  1645. //>>excludeEnd("ctx");
  1646. var $1,$receiver;
  1647. $1=$self._context();
  1648. if(($receiver = $1) == null || $receiver.a$nil){
  1649. return $1;
  1650. } else {
  1651. var ctx;
  1652. ctx=$receiver;
  1653. return $recv(ctx)._interpreter();
  1654. }
  1655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1656. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  1657. //>>excludeEnd("ctx");
  1658. },
  1659. //>>excludeStart("ide", pragmas.excludeIdeData);
  1660. args: [],
  1661. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  1662. referencedClasses: [],
  1663. //>>excludeEnd("ide");
  1664. messageSends: ["ifNotNil:", "context", "interpreter"]
  1665. }),
  1666. $globals.ASTDebugger);
  1667. $core.addMethod(
  1668. $core.method({
  1669. selector: "method",
  1670. protocol: "accessing",
  1671. fn: function (){
  1672. var self=this,$self=this;
  1673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1674. return $core.withContext(function($ctx1) {
  1675. //>>excludeEnd("ctx");
  1676. return $recv($self._context())._method();
  1677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1678. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  1679. //>>excludeEnd("ctx");
  1680. },
  1681. //>>excludeStart("ide", pragmas.excludeIdeData);
  1682. args: [],
  1683. source: "method\x0a\x09^ self context method",
  1684. referencedClasses: [],
  1685. //>>excludeEnd("ide");
  1686. messageSends: ["method", "context"]
  1687. }),
  1688. $globals.ASTDebugger);
  1689. $core.addMethod(
  1690. $core.method({
  1691. selector: "node",
  1692. protocol: "accessing",
  1693. fn: function (){
  1694. var self=this,$self=this;
  1695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1696. return $core.withContext(function($ctx1) {
  1697. //>>excludeEnd("ctx");
  1698. var $1,$receiver;
  1699. $1=$self._interpreter();
  1700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1701. $ctx1.sendIdx["interpreter"]=1;
  1702. //>>excludeEnd("ctx");
  1703. if(($receiver = $1) == null || $receiver.a$nil){
  1704. return $1;
  1705. } else {
  1706. return $recv($self._interpreter())._node();
  1707. }
  1708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1709. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  1710. //>>excludeEnd("ctx");
  1711. },
  1712. //>>excludeStart("ide", pragmas.excludeIdeData);
  1713. args: [],
  1714. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  1715. referencedClasses: [],
  1716. //>>excludeEnd("ide");
  1717. messageSends: ["ifNotNil:", "interpreter", "node"]
  1718. }),
  1719. $globals.ASTDebugger);
  1720. $core.addMethod(
  1721. $core.method({
  1722. selector: "onStep",
  1723. protocol: "private",
  1724. fn: function (){
  1725. var self=this,$self=this;
  1726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1727. return $core.withContext(function($ctx1) {
  1728. //>>excludeEnd("ctx");
  1729. var $1,$3,$2,$4,$6,$5,$receiver;
  1730. $1=$self._interpreter();
  1731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1732. $ctx1.sendIdx["interpreter"]=1;
  1733. //>>excludeEnd("ctx");
  1734. $self["@result"]=$recv($1)._result();
  1735. $3=$self._interpreter();
  1736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1737. $ctx1.sendIdx["interpreter"]=2;
  1738. //>>excludeEnd("ctx");
  1739. $2=$recv($3)._atEnd();
  1740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1741. $ctx1.sendIdx["atEnd"]=1;
  1742. //>>excludeEnd("ctx");
  1743. if($core.assert($2)){
  1744. $4=$recv($self._context())._outerContext();
  1745. if(($receiver = $4) == null || $receiver.a$nil){
  1746. $4;
  1747. } else {
  1748. var outerContext;
  1749. outerContext=$receiver;
  1750. $self._context_(outerContext);
  1751. }
  1752. $6=$self._interpreter();
  1753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1754. $ctx1.sendIdx["interpreter"]=3;
  1755. //>>excludeEnd("ctx");
  1756. $5=$recv($6)._atEnd();
  1757. if(!$core.assert($5)){
  1758. $recv($self._interpreter())._skip();
  1759. }
  1760. }
  1761. $self._flushInnerContexts();
  1762. return self;
  1763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1764. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  1765. //>>excludeEnd("ctx");
  1766. },
  1767. //>>excludeStart("ide", pragmas.excludeIdeData);
  1768. args: [],
  1769. source: "onStep\x0a\x09\x22After each step, check if the interpreter is at the end,\x0a\x09and if it is move to its outer context if any, skipping its \x0a\x09current node (which was just evaluated by the current \x0a\x09interpreter).\x0a\x09\x0a\x09After each step we also flush inner contexts.\x22\x0a\x09\x0a\x09result := self interpreter result.\x0a\x09\x0a\x09self interpreter atEnd ifTrue: [\x0a\x09\x09self context outerContext ifNotNil: [ :outerContext | \x0a\x09\x09\x09self context: outerContext ].\x0a\x09\x09self interpreter atEnd ifFalse: [ self interpreter skip ] ].\x0a\x09\x09\x0a\x09self flushInnerContexts",
  1770. referencedClasses: [],
  1771. //>>excludeEnd("ide");
  1772. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  1773. }),
  1774. $globals.ASTDebugger);
  1775. $core.addMethod(
  1776. $core.method({
  1777. selector: "proceed",
  1778. protocol: "stepping",
  1779. fn: function (){
  1780. var self=this,$self=this;
  1781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1782. return $core.withContext(function($ctx1) {
  1783. //>>excludeEnd("ctx");
  1784. $recv((function(){
  1785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1786. return $core.withContext(function($ctx2) {
  1787. //>>excludeEnd("ctx");
  1788. return $self._atEnd();
  1789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1791. //>>excludeEnd("ctx");
  1792. }))._whileFalse_((function(){
  1793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1794. return $core.withContext(function($ctx2) {
  1795. //>>excludeEnd("ctx");
  1796. return $self._stepOver();
  1797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1798. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  1799. //>>excludeEnd("ctx");
  1800. }));
  1801. return self;
  1802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1803. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  1804. //>>excludeEnd("ctx");
  1805. },
  1806. //>>excludeStart("ide", pragmas.excludeIdeData);
  1807. args: [],
  1808. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  1809. referencedClasses: [],
  1810. //>>excludeEnd("ide");
  1811. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  1812. }),
  1813. $globals.ASTDebugger);
  1814. $core.addMethod(
  1815. $core.method({
  1816. selector: "restart",
  1817. protocol: "stepping",
  1818. fn: function (){
  1819. var self=this,$self=this;
  1820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1821. return $core.withContext(function($ctx1) {
  1822. //>>excludeEnd("ctx");
  1823. $recv($self._interpreter())._restart();
  1824. $self._flushInnerContexts();
  1825. return self;
  1826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1827. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  1828. //>>excludeEnd("ctx");
  1829. },
  1830. //>>excludeStart("ide", pragmas.excludeIdeData);
  1831. args: [],
  1832. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  1833. referencedClasses: [],
  1834. //>>excludeEnd("ide");
  1835. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  1836. }),
  1837. $globals.ASTDebugger);
  1838. $core.addMethod(
  1839. $core.method({
  1840. selector: "result",
  1841. protocol: "accessing",
  1842. fn: function (){
  1843. var self=this,$self=this;
  1844. return $self["@result"];
  1845. },
  1846. //>>excludeStart("ide", pragmas.excludeIdeData);
  1847. args: [],
  1848. source: "result\x0a\x09^ result",
  1849. referencedClasses: [],
  1850. //>>excludeEnd("ide");
  1851. messageSends: []
  1852. }),
  1853. $globals.ASTDebugger);
  1854. $core.addMethod(
  1855. $core.method({
  1856. selector: "stepInto",
  1857. protocol: "stepping",
  1858. fn: function (){
  1859. var self=this,$self=this;
  1860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1861. return $core.withContext(function($ctx1) {
  1862. //>>excludeEnd("ctx");
  1863. $self._shouldBeImplemented();
  1864. return self;
  1865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1866. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  1867. //>>excludeEnd("ctx");
  1868. },
  1869. //>>excludeStart("ide", pragmas.excludeIdeData);
  1870. args: [],
  1871. source: "stepInto\x0a\x09self shouldBeImplemented",
  1872. referencedClasses: [],
  1873. //>>excludeEnd("ide");
  1874. messageSends: ["shouldBeImplemented"]
  1875. }),
  1876. $globals.ASTDebugger);
  1877. $core.addMethod(
  1878. $core.method({
  1879. selector: "stepOver",
  1880. protocol: "stepping",
  1881. fn: function (){
  1882. var self=this,$self=this;
  1883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1884. return $core.withContext(function($ctx1) {
  1885. //>>excludeEnd("ctx");
  1886. var $1,$2;
  1887. $1=$recv($self._context())._isTopContext();
  1888. if($core.assert($1)){
  1889. $recv($self._interpreter())._stepOver();
  1890. } else {
  1891. $2=$self._interpreter();
  1892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1893. $ctx1.sendIdx["interpreter"]=1;
  1894. //>>excludeEnd("ctx");
  1895. $recv($2)._skip();
  1896. }
  1897. $self._onStep();
  1898. return self;
  1899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1900. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  1901. //>>excludeEnd("ctx");
  1902. },
  1903. //>>excludeStart("ide", pragmas.excludeIdeData);
  1904. args: [],
  1905. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  1906. referencedClasses: [],
  1907. //>>excludeEnd("ide");
  1908. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  1909. }),
  1910. $globals.ASTDebugger);
  1911. $core.addMethod(
  1912. $core.method({
  1913. selector: "context:",
  1914. protocol: "instance creation",
  1915. fn: function (aContext){
  1916. var self=this,$self=this;
  1917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1918. return $core.withContext(function($ctx1) {
  1919. //>>excludeEnd("ctx");
  1920. var $1;
  1921. $1=$self._new();
  1922. $recv($1)._context_(aContext);
  1923. return $recv($1)._yourself();
  1924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1925. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.a$cls)});
  1926. //>>excludeEnd("ctx");
  1927. },
  1928. //>>excludeStart("ide", pragmas.excludeIdeData);
  1929. args: ["aContext"],
  1930. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  1931. referencedClasses: [],
  1932. //>>excludeEnd("ide");
  1933. messageSends: ["context:", "new", "yourself"]
  1934. }),
  1935. $globals.ASTDebugger.a$cls);
  1936. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  1937. $core.addMethod(
  1938. $core.method({
  1939. selector: "interpreter",
  1940. protocol: "accessing",
  1941. fn: function (){
  1942. var self=this,$self=this;
  1943. return $self["@interpreter"];
  1944. },
  1945. //>>excludeStart("ide", pragmas.excludeIdeData);
  1946. args: [],
  1947. source: "interpreter\x0a\x09^ interpreter",
  1948. referencedClasses: [],
  1949. //>>excludeEnd("ide");
  1950. messageSends: []
  1951. }),
  1952. $globals.ASTEnterNode);
  1953. $core.addMethod(
  1954. $core.method({
  1955. selector: "interpreter:",
  1956. protocol: "accessing",
  1957. fn: function (anObject){
  1958. var self=this,$self=this;
  1959. $self["@interpreter"]=anObject;
  1960. return self;
  1961. },
  1962. //>>excludeStart("ide", pragmas.excludeIdeData);
  1963. args: ["anObject"],
  1964. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  1965. referencedClasses: [],
  1966. //>>excludeEnd("ide");
  1967. messageSends: []
  1968. }),
  1969. $globals.ASTEnterNode);
  1970. $core.addMethod(
  1971. $core.method({
  1972. selector: "visitBlockNode:",
  1973. protocol: "visiting",
  1974. fn: function (aNode){
  1975. var self=this,$self=this;
  1976. return aNode;
  1977. },
  1978. //>>excludeStart("ide", pragmas.excludeIdeData);
  1979. args: ["aNode"],
  1980. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  1981. referencedClasses: [],
  1982. //>>excludeEnd("ide");
  1983. messageSends: []
  1984. }),
  1985. $globals.ASTEnterNode);
  1986. $core.addMethod(
  1987. $core.method({
  1988. selector: "visitDagNode:",
  1989. protocol: "visiting",
  1990. fn: function (aNode){
  1991. var self=this,$self=this;
  1992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1993. return $core.withContext(function($ctx1) {
  1994. //>>excludeEnd("ctx");
  1995. var $early={};
  1996. try {
  1997. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  1998. throw $early=[aNode];
  1999. }),(function(nodes){
  2000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2001. return $core.withContext(function($ctx2) {
  2002. //>>excludeEnd("ctx");
  2003. throw $early=[$self._visit_($recv(nodes)._first())];
  2004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2005. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  2006. //>>excludeEnd("ctx");
  2007. }));
  2008. return self;
  2009. }
  2010. catch(e) {if(e===$early)return e[0]; throw e}
  2011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2012. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  2013. //>>excludeEnd("ctx");
  2014. },
  2015. //>>excludeStart("ide", pragmas.excludeIdeData);
  2016. args: ["aNode"],
  2017. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  2018. referencedClasses: [],
  2019. //>>excludeEnd("ide");
  2020. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  2021. }),
  2022. $globals.ASTEnterNode);
  2023. $core.addMethod(
  2024. $core.method({
  2025. selector: "visitSequenceNode:",
  2026. protocol: "visiting",
  2027. fn: function (aNode){
  2028. var self=this,$self=this;
  2029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2030. return $core.withContext(function($ctx1) {
  2031. //>>excludeEnd("ctx");
  2032. var $1;
  2033. $recv($recv(aNode)._temps())._do_((function(each){
  2034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2035. return $core.withContext(function($ctx2) {
  2036. //>>excludeEnd("ctx");
  2037. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  2038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2039. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2040. //>>excludeEnd("ctx");
  2041. }));
  2042. $1=(
  2043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2044. $ctx1.supercall = true,
  2045. //>>excludeEnd("ctx");
  2046. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  2047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2048. $ctx1.supercall = false;
  2049. //>>excludeEnd("ctx");;
  2050. return $1;
  2051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2052. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  2053. //>>excludeEnd("ctx");
  2054. },
  2055. //>>excludeStart("ide", pragmas.excludeIdeData);
  2056. args: ["aNode"],
  2057. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  2058. referencedClasses: [],
  2059. //>>excludeEnd("ide");
  2060. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  2061. }),
  2062. $globals.ASTEnterNode);
  2063. $core.addMethod(
  2064. $core.method({
  2065. selector: "on:",
  2066. protocol: "instance creation",
  2067. fn: function (anInterpreter){
  2068. var self=this,$self=this;
  2069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2070. return $core.withContext(function($ctx1) {
  2071. //>>excludeEnd("ctx");
  2072. var $1;
  2073. $1=$self._new();
  2074. $recv($1)._interpreter_(anInterpreter);
  2075. return $recv($1)._yourself();
  2076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2077. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.a$cls)});
  2078. //>>excludeEnd("ctx");
  2079. },
  2080. //>>excludeStart("ide", pragmas.excludeIdeData);
  2081. args: ["anInterpreter"],
  2082. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  2083. referencedClasses: [],
  2084. //>>excludeEnd("ide");
  2085. messageSends: ["interpreter:", "new", "yourself"]
  2086. }),
  2087. $globals.ASTEnterNode.a$cls);
  2088. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  2089. //>>excludeStart("ide", pragmas.excludeIdeData);
  2090. $globals.ASTInterpreter.comment="I visit an AST, interpreting (evaluating) nodes one after the other, using a small stack machine.\x0a\x0a## API\x0a\x0aWhile my instances should be used from within an `ASTDebugger`, which provides a more high level interface,\x0ayou can use methods from the `interpreting` protocol:\x0a\x0a- `#step` evaluates the current `node` only\x0a- `#stepOver` evaluates the AST from the current `node` up to the next stepping node (most likely the next send node)\x0a- `#proceed` evaluates eagerly the AST\x0a- `#restart` select the first node of the AST\x0a- `#skip` skips the current node, moving to the next one if any";
  2091. //>>excludeEnd("ide");
  2092. $core.addMethod(
  2093. $core.method({
  2094. selector: "assign:to:",
  2095. protocol: "private",
  2096. fn: function (aNode,anObject){
  2097. var self=this,$self=this;
  2098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2099. return $core.withContext(function($ctx1) {
  2100. //>>excludeEnd("ctx");
  2101. var $1,$3,$2,$4;
  2102. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  2103. if($core.assert($1)){
  2104. $3=$self._context();
  2105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2106. $ctx1.sendIdx["context"]=1;
  2107. //>>excludeEnd("ctx");
  2108. $2=$recv($3)._receiver();
  2109. $4=$recv(aNode)._value();
  2110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2111. $ctx1.sendIdx["value"]=1;
  2112. //>>excludeEnd("ctx");
  2113. $recv($2)._instVarAt_put_($4,anObject);
  2114. } else {
  2115. $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
  2116. }
  2117. return self;
  2118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2119. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  2120. //>>excludeEnd("ctx");
  2121. },
  2122. //>>excludeStart("ide", pragmas.excludeIdeData);
  2123. args: ["aNode", "anObject"],
  2124. source: "assign: aNode to: anObject\x0a\x09aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]\x0a\x09\x09ifFalse: [ self context localAt: aNode value put: anObject ]",
  2125. referencedClasses: [],
  2126. //>>excludeEnd("ide");
  2127. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  2128. }),
  2129. $globals.ASTInterpreter);
  2130. $core.addMethod(
  2131. $core.method({
  2132. selector: "atEnd",
  2133. protocol: "testing",
  2134. fn: function (){
  2135. var self=this,$self=this;
  2136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2137. return $core.withContext(function($ctx1) {
  2138. //>>excludeEnd("ctx");
  2139. var $1;
  2140. $1=$self["@forceAtEnd"];
  2141. if($core.assert($1)){
  2142. return true;
  2143. }
  2144. return $recv($self._hasReturned())._or_((function(){
  2145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2146. return $core.withContext(function($ctx2) {
  2147. //>>excludeEnd("ctx");
  2148. return $recv($self._node())._isNil();
  2149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2150. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2151. //>>excludeEnd("ctx");
  2152. }));
  2153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2154. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  2155. //>>excludeEnd("ctx");
  2156. },
  2157. //>>excludeStart("ide", pragmas.excludeIdeData);
  2158. args: [],
  2159. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  2160. referencedClasses: [],
  2161. //>>excludeEnd("ide");
  2162. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  2163. }),
  2164. $globals.ASTInterpreter);
  2165. $core.addMethod(
  2166. $core.method({
  2167. selector: "context",
  2168. protocol: "accessing",
  2169. fn: function (){
  2170. var self=this,$self=this;
  2171. return $self["@context"];
  2172. },
  2173. //>>excludeStart("ide", pragmas.excludeIdeData);
  2174. args: [],
  2175. source: "context\x0a\x09^ context",
  2176. referencedClasses: [],
  2177. //>>excludeEnd("ide");
  2178. messageSends: []
  2179. }),
  2180. $globals.ASTInterpreter);
  2181. $core.addMethod(
  2182. $core.method({
  2183. selector: "context:",
  2184. protocol: "accessing",
  2185. fn: function (aContext){
  2186. var self=this,$self=this;
  2187. $self["@context"]=aContext;
  2188. return self;
  2189. },
  2190. //>>excludeStart("ide", pragmas.excludeIdeData);
  2191. args: ["aContext"],
  2192. source: "context: aContext\x0a\x09context := aContext",
  2193. referencedClasses: [],
  2194. //>>excludeEnd("ide");
  2195. messageSends: []
  2196. }),
  2197. $globals.ASTInterpreter);
  2198. $core.addMethod(
  2199. $core.method({
  2200. selector: "enterNode",
  2201. protocol: "interpreting",
  2202. fn: function (){
  2203. var self=this,$self=this;
  2204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2205. return $core.withContext(function($ctx1) {
  2206. //>>excludeEnd("ctx");
  2207. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  2208. return self;
  2209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2210. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  2211. //>>excludeEnd("ctx");
  2212. },
  2213. //>>excludeStart("ide", pragmas.excludeIdeData);
  2214. args: [],
  2215. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  2216. referencedClasses: ["ASTEnterNode"],
  2217. //>>excludeEnd("ide");
  2218. messageSends: ["node:", "visit:", "on:", "node"]
  2219. }),
  2220. $globals.ASTInterpreter);
  2221. $core.addMethod(
  2222. $core.method({
  2223. selector: "eval:",
  2224. protocol: "private",
  2225. fn: function (aString){
  2226. var self=this,$self=this;
  2227. var source,function_;
  2228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2229. return $core.withContext(function($ctx1) {
  2230. //>>excludeEnd("ctx");
  2231. var $3,$2,$1;
  2232. source=$recv($globals.String)._streamContents_((function(str){
  2233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2234. return $core.withContext(function($ctx2) {
  2235. //>>excludeEnd("ctx");
  2236. $recv(str)._nextPutAll_("0,(function(");
  2237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2238. $ctx2.sendIdx["nextPutAll:"]=1;
  2239. //>>excludeEnd("ctx");
  2240. $3=$self._context();
  2241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2242. $ctx2.sendIdx["context"]=1;
  2243. //>>excludeEnd("ctx");
  2244. $2=$recv($3)._locals();
  2245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2246. $ctx2.sendIdx["locals"]=1;
  2247. //>>excludeEnd("ctx");
  2248. $1=$recv($2)._keys();
  2249. $recv($1)._do_separatedBy_((function(each){
  2250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2251. return $core.withContext(function($ctx3) {
  2252. //>>excludeEnd("ctx");
  2253. return $recv(str)._nextPutAll_(each);
  2254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2255. $ctx3.sendIdx["nextPutAll:"]=2;
  2256. //>>excludeEnd("ctx");
  2257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2258. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  2259. //>>excludeEnd("ctx");
  2260. }),(function(){
  2261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2262. return $core.withContext(function($ctx3) {
  2263. //>>excludeEnd("ctx");
  2264. return $recv(str)._nextPutAll_(",");
  2265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2266. $ctx3.sendIdx["nextPutAll:"]=3;
  2267. //>>excludeEnd("ctx");
  2268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2269. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  2270. //>>excludeEnd("ctx");
  2271. }));
  2272. $recv(str)._nextPutAll_("){ return (function() {");
  2273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2274. $ctx2.sendIdx["nextPutAll:"]=4;
  2275. //>>excludeEnd("ctx");
  2276. $recv(str)._nextPutAll_(aString);
  2277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2278. $ctx2.sendIdx["nextPutAll:"]=5;
  2279. //>>excludeEnd("ctx");
  2280. return $recv(str)._nextPutAll_("})()})");
  2281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2282. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  2283. //>>excludeEnd("ctx");
  2284. }));
  2285. function_=$recv($globals.Compiler)._eval_(source);
  2286. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  2287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2288. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  2289. //>>excludeEnd("ctx");
  2290. },
  2291. //>>excludeStart("ide", pragmas.excludeIdeData);
  2292. args: ["aString"],
  2293. source: "eval: aString\x0a\x09\x22Evaluate aString as JS source inside an JS function.\x0a\x09aString is not sandboxed.\x22\x0a\x09\x0a\x09| source function |\x0a\x09\x0a\x09source := String streamContents: [ :str |\x0a\x09\x09str nextPutAll: '0,(function('.\x0a\x09\x09self context locals keys\x0a\x09\x09\x09do: [ :each | str nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ str nextPutAll: ',' ].\x0a\x09\x09str\x0a\x09\x09\x09nextPutAll: '){ return (function() {';\x0a\x09\x09\x09nextPutAll: aString;\x0a\x09\x09\x09nextPutAll: '})()})' ].\x0a\x09\x09\x09\x0a\x09function := Compiler eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values",
  2294. referencedClasses: ["String", "Compiler"],
  2295. //>>excludeEnd("ide");
  2296. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
  2297. }),
  2298. $globals.ASTInterpreter);
  2299. $core.addMethod(
  2300. $core.method({
  2301. selector: "hasReturned",
  2302. protocol: "testing",
  2303. fn: function (){
  2304. var self=this,$self=this;
  2305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2306. return $core.withContext(function($ctx1) {
  2307. //>>excludeEnd("ctx");
  2308. var $1,$receiver;
  2309. $1=$self["@returned"];
  2310. if(($receiver = $1) == null || $receiver.a$nil){
  2311. return false;
  2312. } else {
  2313. return $1;
  2314. }
  2315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2316. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  2317. //>>excludeEnd("ctx");
  2318. },
  2319. //>>excludeStart("ide", pragmas.excludeIdeData);
  2320. args: [],
  2321. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  2322. referencedClasses: [],
  2323. //>>excludeEnd("ide");
  2324. messageSends: ["ifNil:"]
  2325. }),
  2326. $globals.ASTInterpreter);
  2327. $core.addMethod(
  2328. $core.method({
  2329. selector: "initialize",
  2330. protocol: "initialization",
  2331. fn: function (){
  2332. var self=this,$self=this;
  2333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2334. return $core.withContext(function($ctx1) {
  2335. //>>excludeEnd("ctx");
  2336. (
  2337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2338. $ctx1.supercall = true,
  2339. //>>excludeEnd("ctx");
  2340. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  2341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2342. $ctx1.supercall = false;
  2343. //>>excludeEnd("ctx");;
  2344. $self["@forceAtEnd"]=false;
  2345. return self;
  2346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2347. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  2348. //>>excludeEnd("ctx");
  2349. },
  2350. //>>excludeStart("ide", pragmas.excludeIdeData);
  2351. args: [],
  2352. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  2353. referencedClasses: [],
  2354. //>>excludeEnd("ide");
  2355. messageSends: ["initialize"]
  2356. }),
  2357. $globals.ASTInterpreter);
  2358. $core.addMethod(
  2359. $core.method({
  2360. selector: "interpret",
  2361. protocol: "interpreting",
  2362. fn: function (){
  2363. var self=this,$self=this;
  2364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2365. return $core.withContext(function($ctx1) {
  2366. //>>excludeEnd("ctx");
  2367. $self._visit_($self._node());
  2368. return self;
  2369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2370. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  2371. //>>excludeEnd("ctx");
  2372. },
  2373. //>>excludeStart("ide", pragmas.excludeIdeData);
  2374. args: [],
  2375. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  2376. referencedClasses: [],
  2377. //>>excludeEnd("ide");
  2378. messageSends: ["visit:", "node"]
  2379. }),
  2380. $globals.ASTInterpreter);
  2381. $core.addMethod(
  2382. $core.method({
  2383. selector: "messageFromSendNode:arguments:",
  2384. protocol: "private",
  2385. fn: function (aSendNode,aCollection){
  2386. var self=this,$self=this;
  2387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2388. return $core.withContext(function($ctx1) {
  2389. //>>excludeEnd("ctx");
  2390. var $1;
  2391. $1=$recv($globals.Message)._new();
  2392. $recv($1)._selector_($recv(aSendNode)._selector());
  2393. $recv($1)._arguments_(aCollection);
  2394. return $recv($1)._yourself();
  2395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2396. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  2397. //>>excludeEnd("ctx");
  2398. },
  2399. //>>excludeStart("ide", pragmas.excludeIdeData);
  2400. args: ["aSendNode", "aCollection"],
  2401. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  2402. referencedClasses: ["Message"],
  2403. //>>excludeEnd("ide");
  2404. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  2405. }),
  2406. $globals.ASTInterpreter);
  2407. $core.addMethod(
  2408. $core.method({
  2409. selector: "messageNotUnderstood:receiver:",
  2410. protocol: "private",
  2411. fn: function (aMessage,anObject){
  2412. var self=this,$self=this;
  2413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2414. return $core.withContext(function($ctx1) {
  2415. //>>excludeEnd("ctx");
  2416. var $1;
  2417. $1=$recv($globals.MessageNotUnderstood)._new();
  2418. $recv($1)._message_(aMessage);
  2419. $recv($1)._receiver_(anObject);
  2420. $recv($1)._signal();
  2421. return self;
  2422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2423. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  2424. //>>excludeEnd("ctx");
  2425. },
  2426. //>>excludeStart("ide", pragmas.excludeIdeData);
  2427. args: ["aMessage", "anObject"],
  2428. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  2429. referencedClasses: ["MessageNotUnderstood"],
  2430. //>>excludeEnd("ide");
  2431. messageSends: ["message:", "new", "receiver:", "signal"]
  2432. }),
  2433. $globals.ASTInterpreter);
  2434. $core.addMethod(
  2435. $core.method({
  2436. selector: "next",
  2437. protocol: "interpreting",
  2438. fn: function (){
  2439. var self=this,$self=this;
  2440. var nd,nextNode;
  2441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2442. return $core.withContext(function($ctx1) {
  2443. //>>excludeEnd("ctx");
  2444. var $1,$2,$receiver;
  2445. nd=$self._node();
  2446. $1=$recv(nd)._parent();
  2447. if(($receiver = $1) == null || $receiver.a$nil){
  2448. nextNode=$1;
  2449. } else {
  2450. var parent;
  2451. parent=$receiver;
  2452. $2=$recv(parent)._nextSiblingNode_(nd);
  2453. if(($receiver = $2) == null || $receiver.a$nil){
  2454. nextNode=parent;
  2455. } else {
  2456. var sibling;
  2457. sibling=$receiver;
  2458. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  2459. }
  2460. }
  2461. $self._node_(nextNode);
  2462. return self;
  2463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2464. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  2465. //>>excludeEnd("ctx");
  2466. },
  2467. //>>excludeStart("ide", pragmas.excludeIdeData);
  2468. args: [],
  2469. source: "next\x0a\x09| nd nextNode |\x0a\x09nd := self node.\x0a\x09nextNode := nd parent ifNotNil: [ :parent |\x0a\x09\x09(parent nextSiblingNode: nd)\x0a\x09\x09\x09ifNil: [ parent ]\x0a\x09\x09\x09ifNotNil: [ :sibling | (ASTEnterNode on: self) visit: sibling ] ].\x0a\x09self node: nextNode",
  2470. referencedClasses: ["ASTEnterNode"],
  2471. //>>excludeEnd("ide");
  2472. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  2473. }),
  2474. $globals.ASTInterpreter);
  2475. $core.addMethod(
  2476. $core.method({
  2477. selector: "node",
  2478. protocol: "accessing",
  2479. fn: function (){
  2480. var self=this,$self=this;
  2481. return $self["@node"];
  2482. },
  2483. //>>excludeStart("ide", pragmas.excludeIdeData);
  2484. args: [],
  2485. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  2486. referencedClasses: [],
  2487. //>>excludeEnd("ide");
  2488. messageSends: []
  2489. }),
  2490. $globals.ASTInterpreter);
  2491. $core.addMethod(
  2492. $core.method({
  2493. selector: "node:",
  2494. protocol: "accessing",
  2495. fn: function (aNode){
  2496. var self=this,$self=this;
  2497. $self["@node"]=aNode;
  2498. return self;
  2499. },
  2500. //>>excludeStart("ide", pragmas.excludeIdeData);
  2501. args: ["aNode"],
  2502. source: "node: aNode\x0a\x09node := aNode",
  2503. referencedClasses: [],
  2504. //>>excludeEnd("ide");
  2505. messageSends: []
  2506. }),
  2507. $globals.ASTInterpreter);
  2508. $core.addMethod(
  2509. $core.method({
  2510. selector: "peek",
  2511. protocol: "stack",
  2512. fn: function (){
  2513. var self=this,$self=this;
  2514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2515. return $core.withContext(function($ctx1) {
  2516. //>>excludeEnd("ctx");
  2517. var $1;
  2518. var $early={};
  2519. try {
  2520. $1=$self._stack();
  2521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2522. $ctx1.sendIdx["stack"]=1;
  2523. //>>excludeEnd("ctx");
  2524. $recv($1)._ifEmpty_((function(){
  2525. throw $early=[nil];
  2526. }));
  2527. return $recv($self._stack())._last();
  2528. }
  2529. catch(e) {if(e===$early)return e[0]; throw e}
  2530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2531. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  2532. //>>excludeEnd("ctx");
  2533. },
  2534. //>>excludeStart("ide", pragmas.excludeIdeData);
  2535. args: [],
  2536. source: "peek\x0a\x09\x22Peek the top object of the context stack\x22\x0a\x09\x0a\x09self stack ifEmpty: [ ^ nil ].\x0a\x09\x0a\x09^ self stack last",
  2537. referencedClasses: [],
  2538. //>>excludeEnd("ide");
  2539. messageSends: ["ifEmpty:", "stack", "last"]
  2540. }),
  2541. $globals.ASTInterpreter);
  2542. $core.addMethod(
  2543. $core.method({
  2544. selector: "pop",
  2545. protocol: "stack",
  2546. fn: function (){
  2547. var self=this,$self=this;
  2548. var peekedValue;
  2549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2550. return $core.withContext(function($ctx1) {
  2551. //>>excludeEnd("ctx");
  2552. peekedValue=$self._peek();
  2553. $recv($self._stack())._removeLast();
  2554. return peekedValue;
  2555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2556. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  2557. //>>excludeEnd("ctx");
  2558. },
  2559. //>>excludeStart("ide", pragmas.excludeIdeData);
  2560. args: [],
  2561. source: "pop\x0a\x09\x22Pop an object from the context stack\x22\x0a\x09\x0a\x09| peekedValue |\x0a\x09\x0a\x09peekedValue := self peek.\x0a\x09self stack removeLast.\x0a\x09^ peekedValue",
  2562. referencedClasses: [],
  2563. //>>excludeEnd("ide");
  2564. messageSends: ["peek", "removeLast", "stack"]
  2565. }),
  2566. $globals.ASTInterpreter);
  2567. $core.addMethod(
  2568. $core.method({
  2569. selector: "proceed",
  2570. protocol: "interpreting",
  2571. fn: function (){
  2572. var self=this,$self=this;
  2573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2574. return $core.withContext(function($ctx1) {
  2575. //>>excludeEnd("ctx");
  2576. $recv((function(){
  2577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2578. return $core.withContext(function($ctx2) {
  2579. //>>excludeEnd("ctx");
  2580. return $self._atEnd();
  2581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2582. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2583. //>>excludeEnd("ctx");
  2584. }))._whileFalse_((function(){
  2585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2586. return $core.withContext(function($ctx2) {
  2587. //>>excludeEnd("ctx");
  2588. return $self._step();
  2589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2591. //>>excludeEnd("ctx");
  2592. }));
  2593. return self;
  2594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2595. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  2596. //>>excludeEnd("ctx");
  2597. },
  2598. //>>excludeStart("ide", pragmas.excludeIdeData);
  2599. args: [],
  2600. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  2601. referencedClasses: [],
  2602. //>>excludeEnd("ide");
  2603. messageSends: ["whileFalse:", "atEnd", "step"]
  2604. }),
  2605. $globals.ASTInterpreter);
  2606. $core.addMethod(
  2607. $core.method({
  2608. selector: "push:",
  2609. protocol: "stack",
  2610. fn: function (anObject){
  2611. var self=this,$self=this;
  2612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2613. return $core.withContext(function($ctx1) {
  2614. //>>excludeEnd("ctx");
  2615. return $recv($self._stack())._add_(anObject);
  2616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2617. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  2618. //>>excludeEnd("ctx");
  2619. },
  2620. //>>excludeStart("ide", pragmas.excludeIdeData);
  2621. args: ["anObject"],
  2622. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  2623. referencedClasses: [],
  2624. //>>excludeEnd("ide");
  2625. messageSends: ["add:", "stack"]
  2626. }),
  2627. $globals.ASTInterpreter);
  2628. $core.addMethod(
  2629. $core.method({
  2630. selector: "restart",
  2631. protocol: "interpreting",
  2632. fn: function (){
  2633. var self=this,$self=this;
  2634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2635. return $core.withContext(function($ctx1) {
  2636. //>>excludeEnd("ctx");
  2637. $self._node_($recv($self._context())._ast());
  2638. $self._enterNode();
  2639. return self;
  2640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2641. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  2642. //>>excludeEnd("ctx");
  2643. },
  2644. //>>excludeStart("ide", pragmas.excludeIdeData);
  2645. args: [],
  2646. source: "restart\x0a\x09self node: self context ast; enterNode",
  2647. referencedClasses: [],
  2648. //>>excludeEnd("ide");
  2649. messageSends: ["node:", "ast", "context", "enterNode"]
  2650. }),
  2651. $globals.ASTInterpreter);
  2652. $core.addMethod(
  2653. $core.method({
  2654. selector: "result",
  2655. protocol: "accessing",
  2656. fn: function (){
  2657. var self=this,$self=this;
  2658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2659. return $core.withContext(function($ctx1) {
  2660. //>>excludeEnd("ctx");
  2661. var $1;
  2662. $1=$self._hasReturned();
  2663. if($core.assert($1)){
  2664. return $self._returnValue();
  2665. } else {
  2666. return $recv($self._context())._receiver();
  2667. }
  2668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2669. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  2670. //>>excludeEnd("ctx");
  2671. },
  2672. //>>excludeStart("ide", pragmas.excludeIdeData);
  2673. args: [],
  2674. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  2675. referencedClasses: [],
  2676. //>>excludeEnd("ide");
  2677. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  2678. }),
  2679. $globals.ASTInterpreter);
  2680. $core.addMethod(
  2681. $core.method({
  2682. selector: "returnValue",
  2683. protocol: "accessing",
  2684. fn: function (){
  2685. var self=this,$self=this;
  2686. return $self["@returnValue"];
  2687. },
  2688. //>>excludeStart("ide", pragmas.excludeIdeData);
  2689. args: [],
  2690. source: "returnValue\x0a\x09^ returnValue",
  2691. referencedClasses: [],
  2692. //>>excludeEnd("ide");
  2693. messageSends: []
  2694. }),
  2695. $globals.ASTInterpreter);
  2696. $core.addMethod(
  2697. $core.method({
  2698. selector: "returnValue:",
  2699. protocol: "accessing",
  2700. fn: function (anObject){
  2701. var self=this,$self=this;
  2702. $self["@returnValue"]=anObject;
  2703. return self;
  2704. },
  2705. //>>excludeStart("ide", pragmas.excludeIdeData);
  2706. args: ["anObject"],
  2707. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  2708. referencedClasses: [],
  2709. //>>excludeEnd("ide");
  2710. messageSends: []
  2711. }),
  2712. $globals.ASTInterpreter);
  2713. $core.addMethod(
  2714. $core.method({
  2715. selector: "sendMessage:to:superSend:",
  2716. protocol: "private",
  2717. fn: function (aMessage,anObject,aBoolean){
  2718. var self=this,$self=this;
  2719. var method;
  2720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2721. return $core.withContext(function($ctx1) {
  2722. //>>excludeEnd("ctx");
  2723. var $2,$1,$3,$receiver;
  2724. var $early={};
  2725. try {
  2726. if(!$core.assert(aBoolean)){
  2727. return $recv(aMessage)._sendTo_(anObject);
  2728. }
  2729. $2=$recv(anObject)._class();
  2730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2731. $ctx1.sendIdx["class"]=1;
  2732. //>>excludeEnd("ctx");
  2733. $1=$recv($2)._superclass();
  2734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2735. $ctx1.sendIdx["superclass"]=1;
  2736. //>>excludeEnd("ctx");
  2737. if(($receiver = $1) == null || $receiver.a$nil){
  2738. $3=$self._messageNotUnderstood_receiver_(aMessage,anObject);
  2739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2740. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  2741. //>>excludeEnd("ctx");
  2742. return $3;
  2743. } else {
  2744. $1;
  2745. }
  2746. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  2747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2748. return $core.withContext(function($ctx2) {
  2749. //>>excludeEnd("ctx");
  2750. throw $early=[$self._messageNotUnderstood_receiver_(aMessage,anObject)];
  2751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  2753. //>>excludeEnd("ctx");
  2754. }));
  2755. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  2756. }
  2757. catch(e) {if(e===$early)return e[0]; throw e}
  2758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2759. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  2760. //>>excludeEnd("ctx");
  2761. },
  2762. //>>excludeStart("ide", pragmas.excludeIdeData);
  2763. args: ["aMessage", "anObject", "aBoolean"],
  2764. source: "sendMessage: aMessage to: anObject superSend: aBoolean\x0a\x09| method |\x0a\x09\x0a\x09aBoolean ifFalse: [ ^ aMessage sendTo: anObject ].\x0a\x09anObject class superclass ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09method := anObject class superclass methodDictionary\x0a\x09\x09at: aMessage selector\x0a\x09\x09ifAbsent: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ method sendTo: anObject arguments: aMessage arguments",
  2765. referencedClasses: [],
  2766. //>>excludeEnd("ide");
  2767. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  2768. }),
  2769. $globals.ASTInterpreter);
  2770. $core.addMethod(
  2771. $core.method({
  2772. selector: "setNonLocalReturnFromContext:",
  2773. protocol: "interpreting",
  2774. fn: function (aContext){
  2775. var self=this,$self=this;
  2776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2777. return $core.withContext(function($ctx1) {
  2778. //>>excludeEnd("ctx");
  2779. var $2,$1;
  2780. $2=$recv(aContext)._interpreter();
  2781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2782. $ctx1.sendIdx["interpreter"]=1;
  2783. //>>excludeEnd("ctx");
  2784. $1=$recv($2)._hasReturned();
  2785. if($core.assert($1)){
  2786. $self["@returned"]=true;
  2787. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  2788. }
  2789. return self;
  2790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2791. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  2792. //>>excludeEnd("ctx");
  2793. },
  2794. //>>excludeStart("ide", pragmas.excludeIdeData);
  2795. args: ["aContext"],
  2796. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  2797. referencedClasses: [],
  2798. //>>excludeEnd("ide");
  2799. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  2800. }),
  2801. $globals.ASTInterpreter);
  2802. $core.addMethod(
  2803. $core.method({
  2804. selector: "skip",
  2805. protocol: "interpreting",
  2806. fn: function (){
  2807. var self=this,$self=this;
  2808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2809. return $core.withContext(function($ctx1) {
  2810. //>>excludeEnd("ctx");
  2811. $self._next();
  2812. return self;
  2813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2814. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  2815. //>>excludeEnd("ctx");
  2816. },
  2817. //>>excludeStart("ide", pragmas.excludeIdeData);
  2818. args: [],
  2819. source: "skip\x0a\x09self next",
  2820. referencedClasses: [],
  2821. //>>excludeEnd("ide");
  2822. messageSends: ["next"]
  2823. }),
  2824. $globals.ASTInterpreter);
  2825. $core.addMethod(
  2826. $core.method({
  2827. selector: "stack",
  2828. protocol: "accessing",
  2829. fn: function (){
  2830. var self=this,$self=this;
  2831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2832. return $core.withContext(function($ctx1) {
  2833. //>>excludeEnd("ctx");
  2834. var $1,$receiver;
  2835. $1=$self["@stack"];
  2836. if(($receiver = $1) == null || $receiver.a$nil){
  2837. $self["@stack"]=$recv($globals.OrderedCollection)._new();
  2838. return $self["@stack"];
  2839. } else {
  2840. return $1;
  2841. }
  2842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2843. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  2844. //>>excludeEnd("ctx");
  2845. },
  2846. //>>excludeStart("ide", pragmas.excludeIdeData);
  2847. args: [],
  2848. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  2849. referencedClasses: ["OrderedCollection"],
  2850. //>>excludeEnd("ide");
  2851. messageSends: ["ifNil:", "new"]
  2852. }),
  2853. $globals.ASTInterpreter);
  2854. $core.addMethod(
  2855. $core.method({
  2856. selector: "step",
  2857. protocol: "interpreting",
  2858. fn: function (){
  2859. var self=this,$self=this;
  2860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2861. return $core.withContext(function($ctx1) {
  2862. //>>excludeEnd("ctx");
  2863. $self._interpret();
  2864. $self._next();
  2865. return self;
  2866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2867. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  2868. //>>excludeEnd("ctx");
  2869. },
  2870. //>>excludeStart("ide", pragmas.excludeIdeData);
  2871. args: [],
  2872. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  2873. referencedClasses: [],
  2874. //>>excludeEnd("ide");
  2875. messageSends: ["interpret", "next"]
  2876. }),
  2877. $globals.ASTInterpreter);
  2878. $core.addMethod(
  2879. $core.method({
  2880. selector: "stepOver",
  2881. protocol: "interpreting",
  2882. fn: function (){
  2883. var self=this,$self=this;
  2884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2885. return $core.withContext(function($ctx1) {
  2886. //>>excludeEnd("ctx");
  2887. var $2,$1;
  2888. $self._step();
  2889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2890. $ctx1.sendIdx["step"]=1;
  2891. //>>excludeEnd("ctx");
  2892. $recv((function(){
  2893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2894. return $core.withContext(function($ctx2) {
  2895. //>>excludeEnd("ctx");
  2896. $2=$self._node();
  2897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2898. $ctx2.sendIdx["node"]=1;
  2899. //>>excludeEnd("ctx");
  2900. $1=$recv($2)._isNil();
  2901. return $recv($1)._or_((function(){
  2902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2903. return $core.withContext(function($ctx3) {
  2904. //>>excludeEnd("ctx");
  2905. return $recv($self._node())._isSteppingNode();
  2906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2907. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  2908. //>>excludeEnd("ctx");
  2909. }));
  2910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2912. //>>excludeEnd("ctx");
  2913. }))._whileFalse_((function(){
  2914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2915. return $core.withContext(function($ctx2) {
  2916. //>>excludeEnd("ctx");
  2917. return $self._step();
  2918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  2920. //>>excludeEnd("ctx");
  2921. }));
  2922. return self;
  2923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2924. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  2925. //>>excludeEnd("ctx");
  2926. },
  2927. //>>excludeStart("ide", pragmas.excludeIdeData);
  2928. args: [],
  2929. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  2930. referencedClasses: [],
  2931. //>>excludeEnd("ide");
  2932. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  2933. }),
  2934. $globals.ASTInterpreter);
  2935. $core.addMethod(
  2936. $core.method({
  2937. selector: "visit:",
  2938. protocol: "visiting",
  2939. fn: function (aNode){
  2940. var self=this,$self=this;
  2941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2942. return $core.withContext(function($ctx1) {
  2943. //>>excludeEnd("ctx");
  2944. var $1;
  2945. $1=$self._hasReturned();
  2946. if(!$core.assert($1)){
  2947. (
  2948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2949. $ctx1.supercall = true,
  2950. //>>excludeEnd("ctx");
  2951. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  2952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2953. $ctx1.supercall = false;
  2954. //>>excludeEnd("ctx");;
  2955. }
  2956. return self;
  2957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2958. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  2959. //>>excludeEnd("ctx");
  2960. },
  2961. //>>excludeStart("ide", pragmas.excludeIdeData);
  2962. args: ["aNode"],
  2963. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  2964. referencedClasses: [],
  2965. //>>excludeEnd("ide");
  2966. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  2967. }),
  2968. $globals.ASTInterpreter);
  2969. $core.addMethod(
  2970. $core.method({
  2971. selector: "visitAssignmentNode:",
  2972. protocol: "visiting",
  2973. fn: function (aNode){
  2974. var self=this,$self=this;
  2975. var poppedValue;
  2976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2977. return $core.withContext(function($ctx1) {
  2978. //>>excludeEnd("ctx");
  2979. poppedValue=$self._pop();
  2980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2981. $ctx1.sendIdx["pop"]=1;
  2982. //>>excludeEnd("ctx");
  2983. $self._pop();
  2984. $self._push_(poppedValue);
  2985. $self._assign_to_($recv(aNode)._left(),poppedValue);
  2986. return self;
  2987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2988. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  2989. //>>excludeEnd("ctx");
  2990. },
  2991. //>>excludeStart("ide", pragmas.excludeIdeData);
  2992. args: ["aNode"],
  2993. source: "visitAssignmentNode: aNode\x0a\x09| poppedValue |\x0a\x09\x0a\x09poppedValue := self pop.\x0a\x09\x0a\x09\x22Pop the left side of the assignment.\x0a\x09It already has been visited, and we don't need its value.\x22\x0a\x09self pop.\x0a\x09\x0a\x09self push: poppedValue.\x0a\x09self assign: aNode left to: poppedValue",
  2994. referencedClasses: [],
  2995. //>>excludeEnd("ide");
  2996. messageSends: ["pop", "push:", "assign:to:", "left"]
  2997. }),
  2998. $globals.ASTInterpreter);
  2999. $core.addMethod(
  3000. $core.method({
  3001. selector: "visitBlockNode:",
  3002. protocol: "visiting",
  3003. fn: function (aNode){
  3004. var self=this,$self=this;
  3005. var block;
  3006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3007. return $core.withContext(function($ctx1) {
  3008. //>>excludeEnd("ctx");
  3009. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  3010. $self._push_(block);
  3011. return self;
  3012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3013. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  3014. //>>excludeEnd("ctx");
  3015. },
  3016. //>>excludeStart("ide", pragmas.excludeIdeData);
  3017. args: ["aNode"],
  3018. source: "visitBlockNode: aNode\x0a\x09\x22Do not evaluate the block node.\x0a\x09Instead, put all instructions into a block that we push to the stack for later evaluation\x22\x0a\x09\x0a\x09| block |\x0a\x09\x0a\x09block := AIBlockClosure forContext: self context node: aNode.\x0a\x09\x0a\x09self push: block",
  3019. referencedClasses: ["AIBlockClosure"],
  3020. //>>excludeEnd("ide");
  3021. messageSends: ["forContext:node:", "context", "push:"]
  3022. }),
  3023. $globals.ASTInterpreter);
  3024. $core.addMethod(
  3025. $core.method({
  3026. selector: "visitBlockSequenceNode:",
  3027. protocol: "visiting",
  3028. fn: function (aNode){
  3029. var self=this,$self=this;
  3030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3031. return $core.withContext(function($ctx1) {
  3032. //>>excludeEnd("ctx");
  3033. (
  3034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3035. $ctx1.supercall = true,
  3036. //>>excludeEnd("ctx");
  3037. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
  3038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3039. $ctx1.supercall = false;
  3040. //>>excludeEnd("ctx");;
  3041. $self["@forceAtEnd"]=true;
  3042. return self;
  3043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3044. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  3045. //>>excludeEnd("ctx");
  3046. },
  3047. //>>excludeStart("ide", pragmas.excludeIdeData);
  3048. args: ["aNode"],
  3049. source: "visitBlockSequenceNode: aNode\x0a\x09\x22If the receiver is actually visiting a BlockSequenceNode,\x0a\x09it means the the context is a block context. Evaluation should \x0a\x09stop right after evaluating the block sequence and the outer\x0a\x09context's interpreter should take over. \x0a\x09Therefore we force #atEnd.\x22\x0a\x09\x0a\x09super visitBlockSequenceNode: aNode.\x0a\x09forceAtEnd := true",
  3050. referencedClasses: [],
  3051. //>>excludeEnd("ide");
  3052. messageSends: ["visitBlockSequenceNode:"]
  3053. }),
  3054. $globals.ASTInterpreter);
  3055. $core.addMethod(
  3056. $core.method({
  3057. selector: "visitDagNode:",
  3058. protocol: "visiting",
  3059. fn: function (aNode){
  3060. var self=this,$self=this;
  3061. return self;
  3062. },
  3063. //>>excludeStart("ide", pragmas.excludeIdeData);
  3064. args: ["aNode"],
  3065. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  3066. referencedClasses: [],
  3067. //>>excludeEnd("ide");
  3068. messageSends: []
  3069. }),
  3070. $globals.ASTInterpreter);
  3071. $core.addMethod(
  3072. $core.method({
  3073. selector: "visitDynamicArrayNode:",
  3074. protocol: "visiting",
  3075. fn: function (aNode){
  3076. var self=this,$self=this;
  3077. var array;
  3078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3079. return $core.withContext(function($ctx1) {
  3080. //>>excludeEnd("ctx");
  3081. array=[];
  3082. $recv($recv(aNode)._dagChildren())._do_((function(each){
  3083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3084. return $core.withContext(function($ctx2) {
  3085. //>>excludeEnd("ctx");
  3086. return $recv(array)._addFirst_($self._pop());
  3087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3088. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3089. //>>excludeEnd("ctx");
  3090. }));
  3091. $self._push_(array);
  3092. return self;
  3093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3094. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  3095. //>>excludeEnd("ctx");
  3096. },
  3097. //>>excludeStart("ide", pragmas.excludeIdeData);
  3098. args: ["aNode"],
  3099. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09\x0a\x09array := #().\x0a\x09aNode dagChildren do: [ :each |\x0a\x09\x09array addFirst: self pop ].\x0a\x09\x0a\x09self push: array",
  3100. referencedClasses: [],
  3101. //>>excludeEnd("ide");
  3102. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  3103. }),
  3104. $globals.ASTInterpreter);
  3105. $core.addMethod(
  3106. $core.method({
  3107. selector: "visitDynamicDictionaryNode:",
  3108. protocol: "visiting",
  3109. fn: function (aNode){
  3110. var self=this,$self=this;
  3111. var keyValueList;
  3112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3113. return $core.withContext(function($ctx1) {
  3114. //>>excludeEnd("ctx");
  3115. keyValueList=$recv($globals.OrderedCollection)._new();
  3116. $recv($recv(aNode)._dagChildren())._do_((function(each){
  3117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3118. return $core.withContext(function($ctx2) {
  3119. //>>excludeEnd("ctx");
  3120. return $recv(keyValueList)._add_($self._pop());
  3121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3122. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3123. //>>excludeEnd("ctx");
  3124. }));
  3125. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  3126. return self;
  3127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3128. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  3129. //>>excludeEnd("ctx");
  3130. },
  3131. //>>excludeStart("ide", pragmas.excludeIdeData);
  3132. args: ["aNode"],
  3133. source: "visitDynamicDictionaryNode: aNode\x0a\x09| keyValueList |\x0a\x09\x0a\x09keyValueList := OrderedCollection new.\x0a\x09\x0a\x09aNode dagChildren do: [ :each | \x0a\x09\x09keyValueList add: self pop ].\x0a\x09\x0a\x09self push: (HashedCollection newFromPairs: keyValueList reversed)",
  3134. referencedClasses: ["OrderedCollection", "HashedCollection"],
  3135. //>>excludeEnd("ide");
  3136. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  3137. }),
  3138. $globals.ASTInterpreter);
  3139. $core.addMethod(
  3140. $core.method({
  3141. selector: "visitJSStatementNode:",
  3142. protocol: "visiting",
  3143. fn: function (aNode){
  3144. var self=this,$self=this;
  3145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3146. return $core.withContext(function($ctx1) {
  3147. //>>excludeEnd("ctx");
  3148. $self["@returned"]=true;
  3149. $self._returnValue_($self._eval_($recv(aNode)._source()));
  3150. return self;
  3151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3152. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  3153. //>>excludeEnd("ctx");
  3154. },
  3155. //>>excludeStart("ide", pragmas.excludeIdeData);
  3156. args: ["aNode"],
  3157. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  3158. referencedClasses: [],
  3159. //>>excludeEnd("ide");
  3160. messageSends: ["returnValue:", "eval:", "source"]
  3161. }),
  3162. $globals.ASTInterpreter);
  3163. $core.addMethod(
  3164. $core.method({
  3165. selector: "visitReturnNode:",
  3166. protocol: "visiting",
  3167. fn: function (aNode){
  3168. var self=this,$self=this;
  3169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3170. return $core.withContext(function($ctx1) {
  3171. //>>excludeEnd("ctx");
  3172. $self["@returned"]=true;
  3173. $self._returnValue_($self._pop());
  3174. return self;
  3175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3176. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  3177. //>>excludeEnd("ctx");
  3178. },
  3179. //>>excludeStart("ide", pragmas.excludeIdeData);
  3180. args: ["aNode"],
  3181. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  3182. referencedClasses: [],
  3183. //>>excludeEnd("ide");
  3184. messageSends: ["returnValue:", "pop"]
  3185. }),
  3186. $globals.ASTInterpreter);
  3187. $core.addMethod(
  3188. $core.method({
  3189. selector: "visitSendNode:",
  3190. protocol: "visiting",
  3191. fn: function (aNode){
  3192. var self=this,$self=this;
  3193. var receiver,args,message,result;
  3194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3195. return $core.withContext(function($ctx1) {
  3196. //>>excludeEnd("ctx");
  3197. var $1;
  3198. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  3199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3200. return $core.withContext(function($ctx2) {
  3201. //>>excludeEnd("ctx");
  3202. return $self._pop();
  3203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3204. $ctx2.sendIdx["pop"]=1;
  3205. //>>excludeEnd("ctx");
  3206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3207. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3208. //>>excludeEnd("ctx");
  3209. }));
  3210. receiver=$self._peek();
  3211. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  3212. result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  3213. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  3214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3215. return $core.withContext(function($ctx2) {
  3216. //>>excludeEnd("ctx");
  3217. return $recv($recv(aNode)._isLastChild())._not();
  3218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3219. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3220. //>>excludeEnd("ctx");
  3221. }));
  3222. if(!$core.assert($1)){
  3223. $self._pop();
  3224. $self._push_(result);
  3225. }
  3226. return self;
  3227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3228. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  3229. //>>excludeEnd("ctx");
  3230. },
  3231. //>>excludeStart("ide", pragmas.excludeIdeData);
  3232. args: ["aNode"],
  3233. source: "visitSendNode: aNode\x0a\x09| receiver args message result |\x0a\x09\x0a\x09args := aNode arguments collect: [ :each | self pop ].\x0a\x09receiver := self peek.\x0a\x09\x0a\x09message := self\x0a\x09\x09messageFromSendNode: aNode\x0a\x09\x09arguments: args reversed.\x0a\x09\x0a\x09result := self sendMessage: message to: receiver superSend: aNode superSend.\x0a\x09\x0a\x09\x22For cascade sends, push the reciever if the send is not the last one\x22\x0a\x09(aNode isCascadeSendNode and: [ aNode isLastChild not ])\x0a\x09\x09ifFalse: [ self pop; push: result ]",
  3234. referencedClasses: [],
  3235. //>>excludeEnd("ide");
  3236. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  3237. }),
  3238. $globals.ASTInterpreter);
  3239. $core.addMethod(
  3240. $core.method({
  3241. selector: "visitValueNode:",
  3242. protocol: "visiting",
  3243. fn: function (aNode){
  3244. var self=this,$self=this;
  3245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3246. return $core.withContext(function($ctx1) {
  3247. //>>excludeEnd("ctx");
  3248. $self._push_($recv(aNode)._value());
  3249. return self;
  3250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3251. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  3252. //>>excludeEnd("ctx");
  3253. },
  3254. //>>excludeStart("ide", pragmas.excludeIdeData);
  3255. args: ["aNode"],
  3256. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  3257. referencedClasses: [],
  3258. //>>excludeEnd("ide");
  3259. messageSends: ["push:", "value"]
  3260. }),
  3261. $globals.ASTInterpreter);
  3262. $core.addMethod(
  3263. $core.method({
  3264. selector: "visitVariableNode:",
  3265. protocol: "visiting",
  3266. fn: function (aNode){
  3267. var self=this,$self=this;
  3268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3269. return $core.withContext(function($ctx1) {
  3270. //>>excludeEnd("ctx");
  3271. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  3272. $2=$recv(aNode)._binding();
  3273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3274. $ctx1.sendIdx["binding"]=1;
  3275. //>>excludeEnd("ctx");
  3276. $1=$recv($2)._isUnknownVar();
  3277. if($core.assert($1)){
  3278. $5=$recv($globals.Platform)._globals();
  3279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3280. $ctx1.sendIdx["globals"]=1;
  3281. //>>excludeEnd("ctx");
  3282. $6=$recv(aNode)._value();
  3283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3284. $ctx1.sendIdx["value"]=1;
  3285. //>>excludeEnd("ctx");
  3286. $4=$recv($5)._at_ifAbsent_($6,(function(){
  3287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3288. return $core.withContext(function($ctx2) {
  3289. //>>excludeEnd("ctx");
  3290. return $self._error_("Unknown variable");
  3291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3293. //>>excludeEnd("ctx");
  3294. }));
  3295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3296. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3297. //>>excludeEnd("ctx");
  3298. $3=$self._push_($4);
  3299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3300. $ctx1.sendIdx["push:"]=1;
  3301. //>>excludeEnd("ctx");
  3302. return $3;
  3303. }
  3304. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  3305. if($core.assert($8)){
  3306. $10=$self._context();
  3307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3308. $ctx1.sendIdx["context"]=1;
  3309. //>>excludeEnd("ctx");
  3310. $9=$recv($10)._receiver();
  3311. $11=$recv(aNode)._value();
  3312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3313. $ctx1.sendIdx["value"]=2;
  3314. //>>excludeEnd("ctx");
  3315. $7=$recv($9)._instVarAt_($11);
  3316. } else {
  3317. $12=$self._context();
  3318. $13=$recv(aNode)._value();
  3319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3320. $ctx1.sendIdx["value"]=3;
  3321. //>>excludeEnd("ctx");
  3322. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  3323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3324. return $core.withContext(function($ctx2) {
  3325. //>>excludeEnd("ctx");
  3326. $15=$recv(aNode)._value();
  3327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3328. $ctx2.sendIdx["value"]=4;
  3329. //>>excludeEnd("ctx");
  3330. $14=$recv($15)._isCapitalized();
  3331. if($core.assert($14)){
  3332. $16=$recv($globals.Smalltalk)._globals();
  3333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3334. $ctx2.sendIdx["globals"]=2;
  3335. //>>excludeEnd("ctx");
  3336. $17=$recv(aNode)._value();
  3337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3338. $ctx2.sendIdx["value"]=5;
  3339. //>>excludeEnd("ctx");
  3340. return $recv($16)._at_ifAbsent_($17,(function(){
  3341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3342. return $core.withContext(function($ctx3) {
  3343. //>>excludeEnd("ctx");
  3344. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  3345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3346. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  3347. //>>excludeEnd("ctx");
  3348. }));
  3349. }
  3350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3351. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  3352. //>>excludeEnd("ctx");
  3353. }));
  3354. }
  3355. $self._push_($7);
  3356. return self;
  3357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3358. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  3359. //>>excludeEnd("ctx");
  3360. },
  3361. //>>excludeStart("ide", pragmas.excludeIdeData);
  3362. args: ["aNode"],
  3363. source: "visitVariableNode: aNode\x0a\x09aNode binding isUnknownVar ifTrue: [\x0a\x09\x09^ self push: (Platform globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].\x0a\x09\x09\x0a\x09self push: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context \x0a\x09\x09\x09localAt: aNode value\x0a\x09\x09\x09ifAbsent: [\x0a\x09\x09\x09\x09aNode value isCapitalized\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09Smalltalk globals \x0a\x09\x09\x09\x09\x09\x09\x09at: aNode value \x0a\x09\x09\x09\x09\x09\x09\x09ifAbsent: [ Platform globals at: aNode value ] ] ] ])",
  3364. referencedClasses: ["Platform", "Smalltalk"],
  3365. //>>excludeEnd("ide");
  3366. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  3367. }),
  3368. $globals.ASTInterpreter);
  3369. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  3370. //>>excludeStart("ide", pragmas.excludeIdeData);
  3371. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  3372. //>>excludeEnd("ide");
  3373. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  3374. //>>excludeStart("ide", pragmas.excludeIdeData);
  3375. $globals.ASTPCNodeVisitor.comment="I visit an AST until I get to the current node for the `context` and answer it.\x0a\x0a## API\x0a\x0aMy instances must be filled with a context object using `#context:`.\x0a\x0aAfter visiting the AST the current node is answered by `#currentNode`";
  3376. //>>excludeEnd("ide");
  3377. $core.addMethod(
  3378. $core.method({
  3379. selector: "currentNode",
  3380. protocol: "accessing",
  3381. fn: function (){
  3382. var self=this,$self=this;
  3383. return $self["@currentNode"];
  3384. },
  3385. //>>excludeStart("ide", pragmas.excludeIdeData);
  3386. args: [],
  3387. source: "currentNode\x0a\x09^ currentNode",
  3388. referencedClasses: [],
  3389. //>>excludeEnd("ide");
  3390. messageSends: []
  3391. }),
  3392. $globals.ASTPCNodeVisitor);
  3393. $core.addMethod(
  3394. $core.method({
  3395. selector: "increaseTrackedIndex",
  3396. protocol: "accessing",
  3397. fn: function (){
  3398. var self=this,$self=this;
  3399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3400. return $core.withContext(function($ctx1) {
  3401. //>>excludeEnd("ctx");
  3402. $self["@trackedIndex"]=$recv($self._trackedIndex()).__plus((1));
  3403. return self;
  3404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3405. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  3406. //>>excludeEnd("ctx");
  3407. },
  3408. //>>excludeStart("ide", pragmas.excludeIdeData);
  3409. args: [],
  3410. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  3411. referencedClasses: [],
  3412. //>>excludeEnd("ide");
  3413. messageSends: ["+", "trackedIndex"]
  3414. }),
  3415. $globals.ASTPCNodeVisitor);
  3416. $core.addMethod(
  3417. $core.method({
  3418. selector: "index",
  3419. protocol: "accessing",
  3420. fn: function (){
  3421. var self=this,$self=this;
  3422. return $self["@index"];
  3423. },
  3424. //>>excludeStart("ide", pragmas.excludeIdeData);
  3425. args: [],
  3426. source: "index\x0a\x09^ index",
  3427. referencedClasses: [],
  3428. //>>excludeEnd("ide");
  3429. messageSends: []
  3430. }),
  3431. $globals.ASTPCNodeVisitor);
  3432. $core.addMethod(
  3433. $core.method({
  3434. selector: "index:",
  3435. protocol: "accessing",
  3436. fn: function (aNumber){
  3437. var self=this,$self=this;
  3438. $self["@index"]=aNumber;
  3439. return self;
  3440. },
  3441. //>>excludeStart("ide", pragmas.excludeIdeData);
  3442. args: ["aNumber"],
  3443. source: "index: aNumber\x0a\x09index := aNumber",
  3444. referencedClasses: [],
  3445. //>>excludeEnd("ide");
  3446. messageSends: []
  3447. }),
  3448. $globals.ASTPCNodeVisitor);
  3449. $core.addMethod(
  3450. $core.method({
  3451. selector: "selector",
  3452. protocol: "accessing",
  3453. fn: function (){
  3454. var self=this,$self=this;
  3455. return $self["@selector"];
  3456. },
  3457. //>>excludeStart("ide", pragmas.excludeIdeData);
  3458. args: [],
  3459. source: "selector\x0a\x09^ selector",
  3460. referencedClasses: [],
  3461. //>>excludeEnd("ide");
  3462. messageSends: []
  3463. }),
  3464. $globals.ASTPCNodeVisitor);
  3465. $core.addMethod(
  3466. $core.method({
  3467. selector: "selector:",
  3468. protocol: "accessing",
  3469. fn: function (aString){
  3470. var self=this,$self=this;
  3471. $self["@selector"]=aString;
  3472. return self;
  3473. },
  3474. //>>excludeStart("ide", pragmas.excludeIdeData);
  3475. args: ["aString"],
  3476. source: "selector: aString\x0a\x09selector := aString",
  3477. referencedClasses: [],
  3478. //>>excludeEnd("ide");
  3479. messageSends: []
  3480. }),
  3481. $globals.ASTPCNodeVisitor);
  3482. $core.addMethod(
  3483. $core.method({
  3484. selector: "trackedIndex",
  3485. protocol: "accessing",
  3486. fn: function (){
  3487. var self=this,$self=this;
  3488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3489. return $core.withContext(function($ctx1) {
  3490. //>>excludeEnd("ctx");
  3491. var $1,$receiver;
  3492. $1=$self["@trackedIndex"];
  3493. if(($receiver = $1) == null || $receiver.a$nil){
  3494. $self["@trackedIndex"]=(0);
  3495. return $self["@trackedIndex"];
  3496. } else {
  3497. return $1;
  3498. }
  3499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3500. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  3501. //>>excludeEnd("ctx");
  3502. },
  3503. //>>excludeStart("ide", pragmas.excludeIdeData);
  3504. args: [],
  3505. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  3506. referencedClasses: [],
  3507. //>>excludeEnd("ide");
  3508. messageSends: ["ifNil:"]
  3509. }),
  3510. $globals.ASTPCNodeVisitor);
  3511. $core.addMethod(
  3512. $core.method({
  3513. selector: "visitJSStatementNode:",
  3514. protocol: "visiting",
  3515. fn: function (aNode){
  3516. var self=this,$self=this;
  3517. $self["@currentNode"]=aNode;
  3518. return self;
  3519. },
  3520. //>>excludeStart("ide", pragmas.excludeIdeData);
  3521. args: ["aNode"],
  3522. source: "visitJSStatementNode: aNode\x0a\x09\x22If a JSStatementNode is encountered, it always is the current node.\x0a\x09Stop visiting the AST there\x22\x0a\x09\x0a\x09currentNode := aNode",
  3523. referencedClasses: [],
  3524. //>>excludeEnd("ide");
  3525. messageSends: []
  3526. }),
  3527. $globals.ASTPCNodeVisitor);
  3528. $core.addMethod(
  3529. $core.method({
  3530. selector: "visitSendNode:",
  3531. protocol: "visiting",
  3532. fn: function (aNode){
  3533. var self=this,$self=this;
  3534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3535. return $core.withContext(function($ctx1) {
  3536. //>>excludeEnd("ctx");
  3537. var $2,$1,$3;
  3538. (
  3539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3540. $ctx1.supercall = true,
  3541. //>>excludeEnd("ctx");
  3542. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  3543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3544. $ctx1.supercall = false;
  3545. //>>excludeEnd("ctx");;
  3546. $2=$self._selector();
  3547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3548. $ctx1.sendIdx["selector"]=1;
  3549. //>>excludeEnd("ctx");
  3550. $1=$recv($2).__eq($recv(aNode)._selector());
  3551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3552. $ctx1.sendIdx["="]=1;
  3553. //>>excludeEnd("ctx");
  3554. if($core.assert($1)){
  3555. $3=$recv($self._trackedIndex()).__eq($self._index());
  3556. if($core.assert($3)){
  3557. $self["@currentNode"]=aNode;
  3558. $self["@currentNode"];
  3559. }
  3560. $self._increaseTrackedIndex();
  3561. }
  3562. return self;
  3563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3564. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  3565. //>>excludeEnd("ctx");
  3566. },
  3567. //>>excludeStart("ide", pragmas.excludeIdeData);
  3568. args: ["aNode"],
  3569. source: "visitSendNode: aNode\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self selector = aNode selector ifTrue: [\x0a\x09\x09self trackedIndex = self index ifTrue: [ currentNode := aNode ].\x0a\x09\x09self increaseTrackedIndex ]",
  3570. referencedClasses: [],
  3571. //>>excludeEnd("ide");
  3572. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  3573. }),
  3574. $globals.ASTPCNodeVisitor);
  3575. $core.addMethod(
  3576. $core.method({
  3577. selector: "isLastChild",
  3578. protocol: "*Compiler-Interpreter",
  3579. fn: function (){
  3580. var self=this,$self=this;
  3581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3582. return $core.withContext(function($ctx1) {
  3583. //>>excludeEnd("ctx");
  3584. return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
  3585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3586. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  3587. //>>excludeEnd("ctx");
  3588. },
  3589. //>>excludeStart("ide", pragmas.excludeIdeData);
  3590. args: [],
  3591. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  3592. referencedClasses: [],
  3593. //>>excludeEnd("ide");
  3594. messageSends: ["=", "last", "dagChildren", "parent"]
  3595. }),
  3596. $globals.ASTNode);
  3597. $core.addMethod(
  3598. $core.method({
  3599. selector: "isSteppingNode",
  3600. protocol: "*Compiler-Interpreter",
  3601. fn: function (){
  3602. var self=this,$self=this;
  3603. return false;
  3604. },
  3605. //>>excludeStart("ide", pragmas.excludeIdeData);
  3606. args: [],
  3607. source: "isSteppingNode\x0a\x09^ false",
  3608. referencedClasses: [],
  3609. //>>excludeEnd("ide");
  3610. messageSends: []
  3611. }),
  3612. $globals.ASTNode);
  3613. $core.addMethod(
  3614. $core.method({
  3615. selector: "nextSiblingNode:",
  3616. protocol: "*Compiler-Interpreter",
  3617. fn: function (aNode){
  3618. var self=this,$self=this;
  3619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3620. return $core.withContext(function($ctx1) {
  3621. //>>excludeEnd("ctx");
  3622. var $1;
  3623. var $early={};
  3624. try {
  3625. $1=$self._dagChildren();
  3626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3627. $ctx1.sendIdx["dagChildren"]=1;
  3628. //>>excludeEnd("ctx");
  3629. return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  3630. throw $early=[nil];
  3631. }));
  3632. }
  3633. catch(e) {if(e===$early)return e[0]; throw e}
  3634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3635. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  3636. //>>excludeEnd("ctx");
  3637. },
  3638. //>>excludeStart("ide", pragmas.excludeIdeData);
  3639. args: ["aNode"],
  3640. source: "nextSiblingNode: aNode\x0a\x09\x22Answer the next node after aNode or nil\x22\x0a\x09\x0a\x09^ self dagChildren \x0a\x09\x09at: (self dagChildren indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ nil ]",
  3641. referencedClasses: [],
  3642. //>>excludeEnd("ide");
  3643. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  3644. }),
  3645. $globals.ASTNode);
  3646. $core.addMethod(
  3647. $core.method({
  3648. selector: "isSteppingNode",
  3649. protocol: "*Compiler-Interpreter",
  3650. fn: function (){
  3651. var self=this,$self=this;
  3652. return true;
  3653. },
  3654. //>>excludeStart("ide", pragmas.excludeIdeData);
  3655. args: [],
  3656. source: "isSteppingNode\x0a\x09^ true",
  3657. referencedClasses: [],
  3658. //>>excludeEnd("ide");
  3659. messageSends: []
  3660. }),
  3661. $globals.AssignmentNode);
  3662. $core.addMethod(
  3663. $core.method({
  3664. selector: "isSteppingNode",
  3665. protocol: "*Compiler-Interpreter",
  3666. fn: function (){
  3667. var self=this,$self=this;
  3668. return true;
  3669. },
  3670. //>>excludeStart("ide", pragmas.excludeIdeData);
  3671. args: [],
  3672. source: "isSteppingNode\x0a\x09^ true",
  3673. referencedClasses: [],
  3674. //>>excludeEnd("ide");
  3675. messageSends: []
  3676. }),
  3677. $globals.BlockNode);
  3678. $core.addMethod(
  3679. $core.method({
  3680. selector: "nextSiblingNode:",
  3681. protocol: "*Compiler-Interpreter",
  3682. fn: function (aNode){
  3683. var self=this,$self=this;
  3684. return nil;
  3685. },
  3686. //>>excludeStart("ide", pragmas.excludeIdeData);
  3687. args: ["aNode"],
  3688. source: "nextSiblingNode: aNode\x0a\x09\x22Answer nil as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09\x22In fact, this should not have been called, ever. IMO. -- herby\x22\x0a\x09\x0a\x09^ nil",
  3689. referencedClasses: [],
  3690. //>>excludeEnd("ide");
  3691. messageSends: []
  3692. }),
  3693. $globals.BlockNode);
  3694. $core.addMethod(
  3695. $core.method({
  3696. selector: "isSteppingNode",
  3697. protocol: "*Compiler-Interpreter",
  3698. fn: function (){
  3699. var self=this,$self=this;
  3700. return true;
  3701. },
  3702. //>>excludeStart("ide", pragmas.excludeIdeData);
  3703. args: [],
  3704. source: "isSteppingNode\x0a\x09^ true",
  3705. referencedClasses: [],
  3706. //>>excludeEnd("ide");
  3707. messageSends: []
  3708. }),
  3709. $globals.DynamicArrayNode);
  3710. $core.addMethod(
  3711. $core.method({
  3712. selector: "isSteppingNode",
  3713. protocol: "*Compiler-Interpreter",
  3714. fn: function (){
  3715. var self=this,$self=this;
  3716. return true;
  3717. },
  3718. //>>excludeStart("ide", pragmas.excludeIdeData);
  3719. args: [],
  3720. source: "isSteppingNode\x0a\x09^ true",
  3721. referencedClasses: [],
  3722. //>>excludeEnd("ide");
  3723. messageSends: []
  3724. }),
  3725. $globals.DynamicDictionaryNode);
  3726. $core.addMethod(
  3727. $core.method({
  3728. selector: "isSteppingNode",
  3729. protocol: "*Compiler-Interpreter",
  3730. fn: function (){
  3731. var self=this,$self=this;
  3732. return true;
  3733. },
  3734. //>>excludeStart("ide", pragmas.excludeIdeData);
  3735. args: [],
  3736. source: "isSteppingNode\x0a\x09^ true",
  3737. referencedClasses: [],
  3738. //>>excludeEnd("ide");
  3739. messageSends: []
  3740. }),
  3741. $globals.JSStatementNode);
  3742. $core.addMethod(
  3743. $core.method({
  3744. selector: "isCascadeSendNode",
  3745. protocol: "*Compiler-Interpreter",
  3746. fn: function (){
  3747. var self=this,$self=this;
  3748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3749. return $core.withContext(function($ctx1) {
  3750. //>>excludeEnd("ctx");
  3751. return $recv($self._parent())._isCascadeNode();
  3752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3753. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  3754. //>>excludeEnd("ctx");
  3755. },
  3756. //>>excludeStart("ide", pragmas.excludeIdeData);
  3757. args: [],
  3758. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  3759. referencedClasses: [],
  3760. //>>excludeEnd("ide");
  3761. messageSends: ["isCascadeNode", "parent"]
  3762. }),
  3763. $globals.SendNode);
  3764. $core.addMethod(
  3765. $core.method({
  3766. selector: "isSteppingNode",
  3767. protocol: "*Compiler-Interpreter",
  3768. fn: function (){
  3769. var self=this,$self=this;
  3770. return true;
  3771. },
  3772. //>>excludeStart("ide", pragmas.excludeIdeData);
  3773. args: [],
  3774. source: "isSteppingNode\x0a\x09^ true",
  3775. referencedClasses: [],
  3776. //>>excludeEnd("ide");
  3777. messageSends: []
  3778. }),
  3779. $globals.SendNode);
  3780. });