123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987 |
- 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";
- if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
- var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
- $core.addPackage("Compiler-Interpreter");
- ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
- ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
- $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $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`).";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "applyTo:arguments:",
- protocol: "evaluating",
- fn: function (anObject,aCollection){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._interpreterError();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject", "aCollection"],
- source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["interpreterError"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "compiledSource",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return "[ AST Block closure ]";
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "currySelf",
- protocol: "converting",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._interpreterError();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "currySelf\x0a\x09self interpreterError",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["interpreterError"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "initializeWithContext:node:",
- protocol: "initialization",
- fn: function (aContext,aNode){
- var self=this,$self=this;
- $self["@node"]=aNode;
- $self["@outerContext"]=aContext;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aContext", "aNode"],
- source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "interpreterError",
- protocol: "error handling",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
- referencedClasses: ["ASTInterpreterError"],
- //>>excludeEnd("ide");
- messageSends: ["signal:"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "numArgs",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($recv($self["@node"])._temps())._size();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "numArgs\x0a\x09^ node temps size",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["size", "temps"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "value",
- protocol: "evaluating",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $self._valueWithPossibleArguments_([]);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["valueWithPossibleArguments:"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "value:",
- protocol: "evaluating",
- fn: function (anArgument){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $self._valueWithPossibleArguments_([anArgument]);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anArgument"],
- source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["valueWithPossibleArguments:"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "value:value:",
- protocol: "evaluating",
- fn: function (firstArgument,secondArgument){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["firstArgument", "secondArgument"],
- source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["valueWithPossibleArguments:"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "value:value:value:",
- protocol: "evaluating",
- fn: function (firstArgument,secondArgument,thirdArgument){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["firstArgument", "secondArgument", "thirdArgument"],
- source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["valueWithPossibleArguments:"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "valueWithPossibleArguments:",
- protocol: "evaluating",
- fn: function (aCollection){
- var self=this,$self=this;
- var context,sequenceNode;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$2,$3;
- context=$recv($self["@outerContext"])._newInnerContext();
- $1=$recv($recv($recv($self["@node"])._dagChildren())._first())._copy();
- $recv($1)._parent_(nil);
- sequenceNode=$recv($1)._yourself();
- $recv($recv(sequenceNode)._temps())._do_((function(each){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv(context)._defineLocal_(each);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx2.sendIdx["defineLocal:"]=1;
- //>>excludeEnd("ctx");
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- $recv($recv($self["@node"])._parameters())._withIndexDo_((function(each,index){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- $recv(context)._defineLocal_(each);
- return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
- return nil;
- })));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
- //>>excludeEnd("ctx");
- }));
- $2=$recv(context)._interpreter();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["interpreter"]=1;
- //>>excludeEnd("ctx");
- $recv($2)._node_(sequenceNode);
- $recv($2)._enterNode();
- $recv($2)._proceed();
- $3=$recv($self["@outerContext"])._interpreter();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["interpreter"]=2;
- //>>excludeEnd("ctx");
- $recv($3)._setNonLocalReturnFromContext_(context);
- return $recv($recv(context)._interpreter())._pop();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aCollection"],
- 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",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
- }),
- $globals.AIBlockClosure);
- $core.addMethod(
- $core.method({
- selector: "forContext:node:",
- protocol: "instance creation",
- fn: function (aContext,aNode){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self._new();
- $recv($1)._initializeWithContext_node_(aContext,aNode);
- return $recv($1)._yourself();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.a$cls)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aContext", "aNode"],
- source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["initializeWithContext:node:", "new", "yourself"]
- }),
- $globals.AIBlockClosure.a$cls);
- $core.addClass("AIContext", $globals.MethodContext, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $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)";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "arguments",
- protocol: "interpreting",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($recv($self._ast())._arguments())._collect_((function(each){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $self._localAt_ifAbsent_(each,(function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx3) {
- //>>excludeEnd("ctx");
- return $self._error_("Argument not in context");
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "ast",
- protocol: "interpreting",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$2,$3,$receiver;
- $1=$self._isBlockContext();
- if($core.assert($1)){
- $2=$self._outerContext();
- if(($receiver = $2) == null || $receiver.a$nil){
- return $2;
- } else {
- var context;
- context=$receiver;
- return $recv(context)._ast();
- }
- }
- $3=$self["@ast"];
- if(($receiver = $3) == null || $receiver.a$nil){
- $self._initializeAST();
- } else {
- $3;
- }
- return $self["@ast"];
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "basicLocalAt:",
- protocol: "private",
- fn: function (aString){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self._locals())._at_(aString);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["at:", "locals"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "basicLocalAt:put:",
- protocol: "private",
- fn: function (aString,anObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv($self._locals())._at_put_(aString,anObject);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString", "anObject"],
- source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["at:put:", "locals"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "basicReceiver",
- protocol: "interpreting",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $self._localAt_("self");
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "basicReceiver\x0a\x09^ self localAt: 'self'",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["localAt:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "defineLocal:",
- protocol: "accessing",
- fn: function (aString){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv($self._locals())._at_put_(aString,nil);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["at:put:", "locals"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "evaluate:on:",
- protocol: "evaluating",
- fn: function (aString,anEvaluator){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv(anEvaluator)._evaluate_context_(aString,self);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString", "anEvaluator"],
- source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["evaluate:context:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "evaluateNode:",
- protocol: "evaluating",
- fn: function (aNode){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$recv($globals.ASTInterpreter)._new();
- $recv($1)._context_(self);
- $recv($1)._node_(aNode);
- $recv($1)._enterNode();
- $recv($1)._proceed();
- return $recv($1)._result();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
- referencedClasses: ["ASTInterpreter"],
- //>>excludeEnd("ide");
- messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "evaluatedSelector",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@evaluatedSelector"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "evaluatedSelector:",
- protocol: "accessing",
- fn: function (aString){
- var self=this,$self=this;
- $self["@evaluatedSelector"]=aString;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "index",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$receiver;
- $1=$self["@index"];
- if(($receiver = $1) == null || $receiver.a$nil){
- return (0);
- } else {
- return $1;
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "index\x0a\x09^ index ifNil: [ 0 ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifNil:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "index:",
- protocol: "accessing",
- fn: function (anInteger){
- var self=this,$self=this;
- $self["@index"]=anInteger;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anInteger"],
- source: "index: anInteger\x0a\x09index := anInteger",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "initializeAST",
- protocol: "initialization",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self._method();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["method"]=1;
- //>>excludeEnd("ctx");
- $self["@ast"]=$recv($1)._ast();
- $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._methodClass()))._visit_($self["@ast"]);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
- referencedClasses: ["SemanticAnalyzer"],
- //>>excludeEnd("ide");
- messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "initializeFromMethodContext:",
- protocol: "initialization",
- fn: function (aMethodContext){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$2,$3,$receiver;
- $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
- $self._index_($recv(aMethodContext)._index());
- $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
- $self._receiver_($recv(aMethodContext)._receiver());
- $self._supercall_($recv(aMethodContext)._supercall());
- $self._selector_($recv(aMethodContext)._selector());
- $1=$recv(aMethodContext)._outerContext();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["outerContext"]=1;
- //>>excludeEnd("ctx");
- if(($receiver = $1) == null || $receiver.a$nil){
- $1;
- } else {
- var outer;
- outer=$receiver;
- $2=$recv(outer)._methodContext();
- if(($receiver = $2) == null || $receiver.a$nil){
- $2;
- } else {
- $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
- }
- $3=$recv(aMethodContext)._locals();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["locals"]=1;
- //>>excludeEnd("ctx");
- $recv($3)._keysAndValuesDo_((function(key,value){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv($self._locals())._at_put_(key,value);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
- //>>excludeEnd("ctx");
- }));
- }
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aMethodContext"],
- 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 ] ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "initializeInterpreter",
- protocol: "initialization",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$2,$receiver;
- $1=$recv($globals.ASTInterpreter)._new();
- $recv($1)._context_(self);
- $self["@interpreter"]=$recv($1)._yourself();
- $2=$self._innerContext();
- if(($receiver = $2) == null || $receiver.a$nil){
- $2;
- } else {
- $self._setupInterpreter_($self["@interpreter"]);
- }
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
- referencedClasses: ["ASTInterpreter"],
- //>>excludeEnd("ide");
- messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "initializeLocals",
- protocol: "initialization",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self["@locals"]=$recv($globals.Dictionary)._new();
- $recv($self["@locals"])._at_put_("thisContext",self);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
- referencedClasses: ["Dictionary"],
- //>>excludeEnd("ide");
- messageSends: ["new", "at:put:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "innerContext",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@innerContext"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "innerContext\x0a\x09^ innerContext",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "innerContext:",
- protocol: "accessing",
- fn: function (anAIContext){
- var self=this,$self=this;
- $self["@innerContext"]=anAIContext;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anAIContext"],
- source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "interpreter",
- protocol: "interpreting",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$receiver;
- $1=$self["@interpreter"];
- if(($receiver = $1) == null || $receiver.a$nil){
- $self._initializeInterpreter();
- } else {
- $1;
- }
- return $self["@interpreter"];
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifNil:", "initializeInterpreter"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "interpreter:",
- protocol: "interpreting",
- fn: function (anInterpreter){
- var self=this,$self=this;
- $self["@interpreter"]=anInterpreter;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anInterpreter"],
- source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "isTopContext",
- protocol: "testing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self._innerContext())._isNil();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isTopContext\x0a\x09^ self innerContext isNil",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["isNil", "innerContext"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "localAt:",
- protocol: "accessing",
- fn: function (aString){
- var self=this,$self=this;
- var context;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- context=$self._lookupContextForLocal_(aString);
- return $recv(context)._basicLocalAt_(aString);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- 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",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "localAt:ifAbsent:",
- protocol: "accessing",
- fn: function (aString,aBlock){
- var self=this,$self=this;
- var context;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $early={};
- try {
- context=$self._lookupContextForLocal_ifNone_(aString,(function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- throw $early=[$recv(aBlock)._value()];
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- return $recv(context)._basicLocalAt_(aString);
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString", "aBlock"],
- 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",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "localAt:put:",
- protocol: "accessing",
- fn: function (aString,anObject){
- var self=this,$self=this;
- var context;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- context=$self._lookupContextForLocal_(aString);
- $recv(context)._basicLocalAt_put_(aString,anObject);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString", "anObject"],
- source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "locals",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$receiver;
- $1=$self["@locals"];
- if(($receiver = $1) == null || $receiver.a$nil){
- $self._initializeLocals();
- } else {
- $1;
- }
- return $self["@locals"];
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifNil:", "initializeLocals"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "lookupContextForLocal:",
- protocol: "private",
- fn: function (aString){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $self._lookupContextForLocal_ifNone_(aString,(function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $self._variableNotFound();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- 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 ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "lookupContextForLocal:ifNone:",
- protocol: "private",
- fn: function (aString,aBlock){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
- return self;
- }),(function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- $1=$self._outerContext();
- return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx3) {
- //>>excludeEnd("ctx");
- return $recv(context)._lookupContextForLocal_(aString);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString", "aBlock"],
- 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 ] ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "newInnerContext",
- protocol: "factory",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$recv($self._class())._new();
- $recv($1)._outerContext_(self);
- return $recv($1)._yourself();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["outerContext:", "new", "class", "yourself"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "outerContext",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@outerContext"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "outerContext\x0a\x09^ outerContext",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "outerContext:",
- protocol: "accessing",
- fn: function (anAIContext){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$receiver;
- $self["@outerContext"]=anAIContext;
- $1=$self["@outerContext"];
- if(($receiver = $1) == null || $receiver.a$nil){
- $1;
- } else {
- var context;
- context=$receiver;
- $recv(context)._innerContext_(self);
- }
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anAIContext"],
- source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifNotNil:", "innerContext:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "receiver:",
- protocol: "interpreting",
- fn: function (anObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv($self._locals())._at_put_("self",anObject);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject"],
- source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["at:put:", "locals"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@selector"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "selector\x0a\x09^ selector",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "selector:",
- protocol: "accessing",
- fn: function (aString){
- var self=this,$self=this;
- $self["@selector"]=aString;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- source: "selector: aString\x0a\x09selector := aString",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "sendIndexAt:",
- protocol: "accessing",
- fn: function (aString){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
- return (0);
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["at:ifAbsent:", "sendIndexes"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "sendIndexes",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$receiver;
- $1=$self["@sendIndexes"];
- if(($receiver = $1) == null || $receiver.a$nil){
- return $recv($globals.Dictionary)._new();
- } else {
- return $1;
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
- referencedClasses: ["Dictionary"],
- //>>excludeEnd("ide");
- messageSends: ["ifNil:", "new"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "sendIndexes:",
- protocol: "accessing",
- fn: function (aDictionary){
- var self=this,$self=this;
- $self["@sendIndexes"]=aDictionary;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aDictionary"],
- source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "setupInterpreter:",
- protocol: "interpreting",
- fn: function (anInterpreter){
- var self=this,$self=this;
- var currentNode;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$2,$3,$4,$7,$6,$5,$receiver;
- $1=$recv($globals.ASTPCNodeVisitor)._new();
- $2=$self._evaluatedSelector();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["evaluatedSelector"]=1;
- //>>excludeEnd("ctx");
- $recv($1)._selector_($2);
- $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
- $3=$self._ast();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["ast"]=1;
- //>>excludeEnd("ctx");
- $recv($1)._visit_($3);
- currentNode=$recv($1)._currentNode();
- $4=$recv($self._ast())._sequenceNode();
- if(($receiver = $4) == null || $receiver.a$nil){
- $4;
- } else {
- var sequence;
- sequence=$receiver;
- $recv($recv(sequence)._temps())._do_((function(each){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $self._defineLocal_(each);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["do:"]=1;
- //>>excludeEnd("ctx");
- }
- $recv(anInterpreter)._node_(currentNode);
- $7=$self._innerContext();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["innerContext"]=1;
- //>>excludeEnd("ctx");
- $6=$recv($7)._arguments();
- $5=$recv($6)._reversed();
- $recv($5)._do_((function(each){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv(anInterpreter)._push_(each);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx2.sendIdx["push:"]=1;
- //>>excludeEnd("ctx");
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
- //>>excludeEnd("ctx");
- }));
- $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anInterpreter"],
- 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)",
- referencedClasses: ["ASTPCNodeVisitor"],
- //>>excludeEnd("ide");
- messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "supercall",
- protocol: "interpreting",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$receiver;
- $1=$self["@supercall"];
- if(($receiver = $1) == null || $receiver.a$nil){
- return false;
- } else {
- return $1;
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifNil:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "supercall:",
- protocol: "interpreting",
- fn: function (aBoolean){
- var self=this,$self=this;
- $self["@supercall"]=aBoolean;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBoolean"],
- source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "variableNotFound",
- protocol: "error handling",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._error_("Variable missing");
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["error:"]
- }),
- $globals.AIContext);
- $core.addMethod(
- $core.method({
- selector: "fromMethodContext:",
- protocol: "instance creation",
- fn: function (aMethodContext){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self._new();
- $recv($1)._initializeFromMethodContext_(aMethodContext);
- return $recv($1)._yourself();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.a$cls)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aMethodContext"],
- source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["initializeFromMethodContext:", "new", "yourself"]
- }),
- $globals.AIContext.a$cls);
- $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $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.";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "context",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@context"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "context\x0a\x09^ context",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.AISemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "context:",
- protocol: "accessing",
- fn: function (anAIContext){
- var self=this,$self=this;
- $self["@context"]=anAIContext;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anAIContext"],
- source: "context: anAIContext\x0a\x09context := anAIContext",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.AISemanticAnalyzer);
- $core.addMethod(
- $core.method({
- selector: "visitVariableNode:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- var $early={};
- try {
- $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- $1=(
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx2.supercall = true,
- //>>excludeEnd("ctx");
- ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx2.supercall = false;
- //>>excludeEnd("ctx");;
- throw $early=[$1];
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
- return self;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
- referencedClasses: ["ASTContextVar"],
- //>>excludeEnd("ide");
- messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
- }),
- $globals.AISemanticAnalyzer);
- $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "context",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@context"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "context\x0a\x09^ context",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTContextVar);
- $core.addMethod(
- $core.method({
- selector: "context:",
- protocol: "accessing",
- fn: function (anObject){
- var self=this,$self=this;
- $self["@context"]=anObject;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject"],
- source: "context: anObject\x0a\x09context := anObject",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTContextVar);
- $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $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.";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "atEnd",
- protocol: "testing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$receiver;
- $1=$self._context();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["context"]=1;
- //>>excludeEnd("ctx");
- if(($receiver = $1) == null || $receiver.a$nil){
- return true;
- } else {
- $1;
- }
- return $recv($recv($self._interpreter())._atEnd())._and_((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv($self._context())._isTopContext();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "context",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@context"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "context\x0a\x09^ context",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "context:",
- protocol: "accessing",
- fn: function (aContext){
- var self=this,$self=this;
- $self["@context"]=aContext;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aContext"],
- source: "context: aContext\x0a\x09context := aContext",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "flushInnerContexts",
- protocol: "actions",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$receiver;
- $1=$self._context();
- if(($receiver = $1) == null || $receiver.a$nil){
- $1;
- } else {
- var cxt;
- cxt=$receiver;
- $recv(cxt)._innerContext_(nil);
- }
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- 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 ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifNotNil:", "context", "innerContext:"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "interpreter",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$receiver;
- $1=$self._context();
- if(($receiver = $1) == null || $receiver.a$nil){
- return $1;
- } else {
- var ctx;
- ctx=$receiver;
- return $recv(ctx)._interpreter();
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifNotNil:", "context", "interpreter"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "method",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self._context())._method();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "method\x0a\x09^ self context method",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["method", "context"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "node",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$receiver;
- $1=$self._interpreter();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["interpreter"]=1;
- //>>excludeEnd("ctx");
- if(($receiver = $1) == null || $receiver.a$nil){
- return $1;
- } else {
- return $recv($self._interpreter())._node();
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifNotNil:", "interpreter", "node"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "onStep",
- protocol: "private",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$3,$2,$4,$6,$5,$receiver;
- $1=$self._interpreter();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["interpreter"]=1;
- //>>excludeEnd("ctx");
- $self["@result"]=$recv($1)._result();
- $3=$self._interpreter();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["interpreter"]=2;
- //>>excludeEnd("ctx");
- $2=$recv($3)._atEnd();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["atEnd"]=1;
- //>>excludeEnd("ctx");
- if($core.assert($2)){
- $4=$recv($self._context())._outerContext();
- if(($receiver = $4) == null || $receiver.a$nil){
- $4;
- } else {
- var outerContext;
- outerContext=$receiver;
- $self._context_(outerContext);
- }
- $6=$self._interpreter();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["interpreter"]=3;
- //>>excludeEnd("ctx");
- $5=$recv($6)._atEnd();
- if(!$core.assert($5)){
- $recv($self._interpreter())._skip();
- }
- }
- $self._flushInnerContexts();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- 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",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "proceed",
- protocol: "stepping",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $self._atEnd();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- //>>excludeEnd("ctx");
- }))._whileFalse_((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $self._stepOver();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- //>>excludeEnd("ctx");
- }));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["whileFalse:", "atEnd", "stepOver"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "restart",
- protocol: "stepping",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv($self._interpreter())._restart();
- $self._flushInnerContexts();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["restart", "interpreter", "flushInnerContexts"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "result",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@result"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "result\x0a\x09^ result",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "stepInto",
- protocol: "stepping",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._shouldBeImplemented();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "stepInto\x0a\x09self shouldBeImplemented",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["shouldBeImplemented"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "stepOver",
- protocol: "stepping",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$2;
- $1=$recv($self._context())._isTopContext();
- if($core.assert($1)){
- $recv($self._interpreter())._stepOver();
- } else {
- $2=$self._interpreter();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["interpreter"]=1;
- //>>excludeEnd("ctx");
- $recv($2)._skip();
- }
- $self._onStep();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
- }),
- $globals.ASTDebugger);
- $core.addMethod(
- $core.method({
- selector: "context:",
- protocol: "instance creation",
- fn: function (aContext){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self._new();
- $recv($1)._context_(aContext);
- return $recv($1)._yourself();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.a$cls)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aContext"],
- source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["context:", "new", "yourself"]
- }),
- $globals.ASTDebugger.a$cls);
- $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
- $core.addMethod(
- $core.method({
- selector: "interpreter",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@interpreter"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "interpreter\x0a\x09^ interpreter",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTEnterNode);
- $core.addMethod(
- $core.method({
- selector: "interpreter:",
- protocol: "accessing",
- fn: function (anObject){
- var self=this,$self=this;
- $self["@interpreter"]=anObject;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject"],
- source: "interpreter: anObject\x0a\x09interpreter := anObject",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTEnterNode);
- $core.addMethod(
- $core.method({
- selector: "visitBlockNode:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- return aNode;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTEnterNode);
- $core.addMethod(
- $core.method({
- selector: "visitDagNode:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $early={};
- try {
- $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
- throw $early=[aNode];
- }),(function(nodes){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- throw $early=[$self._visit_($recv(nodes)._first())];
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
- //>>excludeEnd("ctx");
- }));
- return self;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
- }),
- $globals.ASTEnterNode);
- $core.addMethod(
- $core.method({
- selector: "visitSequenceNode:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $recv($recv(aNode)._temps())._do_((function(each){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv($recv($self._interpreter())._context())._defineLocal_(each);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- $1=(
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = true,
- //>>excludeEnd("ctx");
- ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = false;
- //>>excludeEnd("ctx");;
- return $1;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
- }),
- $globals.ASTEnterNode);
- $core.addMethod(
- $core.method({
- selector: "on:",
- protocol: "instance creation",
- fn: function (anInterpreter){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self._new();
- $recv($1)._interpreter_(anInterpreter);
- return $recv($1)._yourself();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.a$cls)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anInterpreter"],
- source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["interpreter:", "new", "yourself"]
- }),
- $globals.ASTEnterNode.a$cls);
- $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $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";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "assign:to:",
- protocol: "private",
- fn: function (aNode,anObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$3,$2,$4;
- $1=$recv($recv(aNode)._binding())._isInstanceVar();
- if($core.assert($1)){
- $3=$self._context();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["context"]=1;
- //>>excludeEnd("ctx");
- $2=$recv($3)._receiver();
- $4=$recv(aNode)._value();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["value"]=1;
- //>>excludeEnd("ctx");
- $recv($2)._instVarAt_put_($4,anObject);
- } else {
- $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
- }
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode", "anObject"],
- 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 ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "atEnd",
- protocol: "testing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self["@forceAtEnd"];
- if($core.assert($1)){
- return true;
- }
- return $recv($self._hasReturned())._or_((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv($self._node())._isNil();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "context",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@context"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "context\x0a\x09^ context",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "context:",
- protocol: "accessing",
- fn: function (aContext){
- var self=this,$self=this;
- $self["@context"]=aContext;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aContext"],
- source: "context: aContext\x0a\x09context := aContext",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "enterNode",
- protocol: "interpreting",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
- referencedClasses: ["ASTEnterNode"],
- //>>excludeEnd("ide");
- messageSends: ["node:", "visit:", "on:", "node"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "eval:",
- protocol: "private",
- fn: function (aString){
- var self=this,$self=this;
- var source,function_;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $3,$2,$1;
- source=$recv($globals.String)._streamContents_((function(str){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- $recv(str)._nextPutAll_("0,(function(");
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx2.sendIdx["nextPutAll:"]=1;
- //>>excludeEnd("ctx");
- $3=$self._context();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx2.sendIdx["context"]=1;
- //>>excludeEnd("ctx");
- $2=$recv($3)._locals();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx2.sendIdx["locals"]=1;
- //>>excludeEnd("ctx");
- $1=$recv($2)._keys();
- $recv($1)._do_separatedBy_((function(each){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx3) {
- //>>excludeEnd("ctx");
- return $recv(str)._nextPutAll_(each);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx3.sendIdx["nextPutAll:"]=2;
- //>>excludeEnd("ctx");
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
- //>>excludeEnd("ctx");
- }),(function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx3) {
- //>>excludeEnd("ctx");
- return $recv(str)._nextPutAll_(",");
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx3.sendIdx["nextPutAll:"]=3;
- //>>excludeEnd("ctx");
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
- //>>excludeEnd("ctx");
- }));
- $recv(str)._nextPutAll_("){ return (function() {");
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx2.sendIdx["nextPutAll:"]=4;
- //>>excludeEnd("ctx");
- $recv(str)._nextPutAll_(aString);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx2.sendIdx["nextPutAll:"]=5;
- //>>excludeEnd("ctx");
- return $recv(str)._nextPutAll_("})()})");
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- function_=$recv($globals.Compiler)._eval_(source);
- return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- 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",
- referencedClasses: ["String", "Compiler"],
- //>>excludeEnd("ide");
- messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "hasReturned",
- protocol: "testing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$receiver;
- $1=$self["@returned"];
- if(($receiver = $1) == null || $receiver.a$nil){
- return false;
- } else {
- return $1;
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifNil:"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: "initialization",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- (
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = true,
- //>>excludeEnd("ctx");
- ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = false;
- //>>excludeEnd("ctx");;
- $self["@forceAtEnd"]=false;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["initialize"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "interpret",
- protocol: "interpreting",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._visit_($self._node());
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["visit:", "node"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "messageFromSendNode:arguments:",
- protocol: "private",
- fn: function (aSendNode,aCollection){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$recv($globals.Message)._new();
- $recv($1)._selector_($recv(aSendNode)._selector());
- $recv($1)._arguments_(aCollection);
- return $recv($1)._yourself();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aSendNode", "aCollection"],
- source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
- referencedClasses: ["Message"],
- //>>excludeEnd("ide");
- messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "messageNotUnderstood:receiver:",
- protocol: "private",
- fn: function (aMessage,anObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$recv($globals.MessageNotUnderstood)._new();
- $recv($1)._message_(aMessage);
- $recv($1)._receiver_(anObject);
- $recv($1)._signal();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aMessage", "anObject"],
- source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
- referencedClasses: ["MessageNotUnderstood"],
- //>>excludeEnd("ide");
- messageSends: ["message:", "new", "receiver:", "signal"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "next",
- protocol: "interpreting",
- fn: function (){
- var self=this,$self=this;
- var nd,nextNode;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$2,$receiver;
- nd=$self._node();
- $1=$recv(nd)._parent();
- if(($receiver = $1) == null || $receiver.a$nil){
- nextNode=$1;
- } else {
- var parent;
- parent=$receiver;
- $2=$recv(parent)._nextSiblingNode_(nd);
- if(($receiver = $2) == null || $receiver.a$nil){
- nextNode=parent;
- } else {
- var sibling;
- sibling=$receiver;
- nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
- }
- }
- $self._node_(nextNode);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- 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",
- referencedClasses: ["ASTEnterNode"],
- //>>excludeEnd("ide");
- messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "node",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@node"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "node:",
- protocol: "accessing",
- fn: function (aNode){
- var self=this,$self=this;
- $self["@node"]=aNode;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- source: "node: aNode\x0a\x09node := aNode",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "peek",
- protocol: "stack",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- var $early={};
- try {
- $1=$self._stack();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["stack"]=1;
- //>>excludeEnd("ctx");
- $recv($1)._ifEmpty_((function(){
- throw $early=[nil];
- }));
- return $recv($self._stack())._last();
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- 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",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifEmpty:", "stack", "last"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "pop",
- protocol: "stack",
- fn: function (){
- var self=this,$self=this;
- var peekedValue;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- peekedValue=$self._peek();
- $recv($self._stack())._removeLast();
- return peekedValue;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- 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",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["peek", "removeLast", "stack"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "proceed",
- protocol: "interpreting",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $self._atEnd();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- //>>excludeEnd("ctx");
- }))._whileFalse_((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $self._step();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- //>>excludeEnd("ctx");
- }));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["whileFalse:", "atEnd", "step"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "push:",
- protocol: "stack",
- fn: function (anObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self._stack())._add_(anObject);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject"],
- source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["add:", "stack"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "restart",
- protocol: "interpreting",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._node_($recv($self._context())._ast());
- $self._enterNode();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "restart\x0a\x09self node: self context ast; enterNode",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["node:", "ast", "context", "enterNode"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "result",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self._hasReturned();
- if($core.assert($1)){
- return $self._returnValue();
- } else {
- return $recv($self._context())._receiver();
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "returnValue",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@returnValue"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "returnValue\x0a\x09^ returnValue",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "returnValue:",
- protocol: "accessing",
- fn: function (anObject){
- var self=this,$self=this;
- $self["@returnValue"]=anObject;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject"],
- source: "returnValue: anObject\x0a\x09returnValue := anObject",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "sendMessage:to:superSend:",
- protocol: "private",
- fn: function (aMessage,anObject,aBoolean){
- var self=this,$self=this;
- var method;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $2,$1,$3,$receiver;
- var $early={};
- try {
- if(!$core.assert(aBoolean)){
- return $recv(aMessage)._sendTo_(anObject);
- }
- $2=$recv(anObject)._class();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["class"]=1;
- //>>excludeEnd("ctx");
- $1=$recv($2)._superclass();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["superclass"]=1;
- //>>excludeEnd("ctx");
- if(($receiver = $1) == null || $receiver.a$nil){
- $3=$self._messageNotUnderstood_receiver_(aMessage,anObject);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
- //>>excludeEnd("ctx");
- return $3;
- } else {
- $1;
- }
- method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- throw $early=[$self._messageNotUnderstood_receiver_(aMessage,anObject)];
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- //>>excludeEnd("ctx");
- }));
- return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aMessage", "anObject", "aBoolean"],
- 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",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "setNonLocalReturnFromContext:",
- protocol: "interpreting",
- fn: function (aContext){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $2,$1;
- $2=$recv(aContext)._interpreter();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["interpreter"]=1;
- //>>excludeEnd("ctx");
- $1=$recv($2)._hasReturned();
- if($core.assert($1)){
- $self["@returned"]=true;
- $self["@returned"];
- $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
- }
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aContext"],
- source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "skip",
- protocol: "interpreting",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._next();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "skip\x0a\x09self next",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["next"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "stack",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$receiver;
- $1=$self["@stack"];
- if(($receiver = $1) == null || $receiver.a$nil){
- $self["@stack"]=$recv($globals.OrderedCollection)._new();
- return $self["@stack"];
- } else {
- return $1;
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
- referencedClasses: ["OrderedCollection"],
- //>>excludeEnd("ide");
- messageSends: ["ifNil:", "new"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "step",
- protocol: "interpreting",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._interpret();
- $self._next();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["interpret", "next"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "stepOver",
- protocol: "interpreting",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $2,$1;
- $self._step();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["step"]=1;
- //>>excludeEnd("ctx");
- $recv((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- $2=$self._node();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx2.sendIdx["node"]=1;
- //>>excludeEnd("ctx");
- $1=$recv($2)._isNil();
- return $recv($1)._or_((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx3) {
- //>>excludeEnd("ctx");
- return $recv($self._node())._isSteppingNode();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- //>>excludeEnd("ctx");
- }))._whileFalse_((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $self._step();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
- //>>excludeEnd("ctx");
- }));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visit:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self._hasReturned();
- if(!$core.assert($1)){
- (
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = true,
- //>>excludeEnd("ctx");
- ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = false;
- //>>excludeEnd("ctx");;
- }
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifFalse:", "hasReturned", "visit:"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitAssignmentNode:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- var poppedValue;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- poppedValue=$self._pop();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["pop"]=1;
- //>>excludeEnd("ctx");
- $self._pop();
- $self._push_(poppedValue);
- $self._assign_to_($recv(aNode)._left(),poppedValue);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- 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",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["pop", "push:", "assign:to:", "left"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitBlockNode:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- var block;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
- $self._push_(block);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- 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",
- referencedClasses: ["AIBlockClosure"],
- //>>excludeEnd("ide");
- messageSends: ["forContext:node:", "context", "push:"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitBlockSequenceNode:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- (
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = true,
- //>>excludeEnd("ctx");
- ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = false;
- //>>excludeEnd("ctx");;
- $self["@forceAtEnd"]=true;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- 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",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["visitBlockSequenceNode:"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitDagNode:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitDynamicArrayNode:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- var array;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- array=[];
- $recv($recv(aNode)._dagChildren())._do_((function(each){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv(array)._addFirst_($self._pop());
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- $self._push_(array);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- 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",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitDynamicDictionaryNode:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- var keyValueList;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- keyValueList=$recv($globals.OrderedCollection)._new();
- $recv($recv(aNode)._dagChildren())._do_((function(each){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv(keyValueList)._add_($self._pop());
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- 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)",
- referencedClasses: ["OrderedCollection", "HashedCollection"],
- //>>excludeEnd("ide");
- messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitJSStatementNode:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self["@returned"]=true;
- $self._returnValue_($self._eval_($recv(aNode)._source()));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["returnValue:", "eval:", "source"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitReturnNode:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self["@returned"]=true;
- $self._returnValue_($self._pop());
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["returnValue:", "pop"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitSendNode:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- var receiver,args,message,result;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- args=$recv($recv(aNode)._arguments())._collect_((function(each){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $self._pop();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx2.sendIdx["pop"]=1;
- //>>excludeEnd("ctx");
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- receiver=$self._peek();
- message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
- result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
- $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv($recv(aNode)._isLastChild())._not();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- //>>excludeEnd("ctx");
- }));
- if(!$core.assert($1)){
- $self._pop();
- $self._push_(result);
- }
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- 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 ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitValueNode:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._push_($recv(aNode)._value());
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- source: "visitValueNode: aNode\x0a\x09self push: aNode value",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["push:", "value"]
- }),
- $globals.ASTInterpreter);
- $core.addMethod(
- $core.method({
- selector: "visitVariableNode:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
- $2=$recv(aNode)._binding();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["binding"]=1;
- //>>excludeEnd("ctx");
- $1=$recv($2)._isUnknownVar();
- if($core.assert($1)){
- $5=$recv($globals.Platform)._globals();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["globals"]=1;
- //>>excludeEnd("ctx");
- $6=$recv(aNode)._value();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["value"]=1;
- //>>excludeEnd("ctx");
- $4=$recv($5)._at_ifAbsent_($6,(function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $self._error_("Unknown variable");
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["at:ifAbsent:"]=1;
- //>>excludeEnd("ctx");
- $3=$self._push_($4);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["push:"]=1;
- //>>excludeEnd("ctx");
- return $3;
- }
- $8=$recv($recv(aNode)._binding())._isInstanceVar();
- if($core.assert($8)){
- $10=$self._context();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["context"]=1;
- //>>excludeEnd("ctx");
- $9=$recv($10)._receiver();
- $11=$recv(aNode)._value();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["value"]=2;
- //>>excludeEnd("ctx");
- $7=$recv($9)._instVarAt_($11);
- } else {
- $12=$self._context();
- $13=$recv(aNode)._value();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["value"]=3;
- //>>excludeEnd("ctx");
- $7=$recv($12)._localAt_ifAbsent_($13,(function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- $15=$recv(aNode)._value();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx2.sendIdx["value"]=4;
- //>>excludeEnd("ctx");
- $14=$recv($15)._isCapitalized();
- if($core.assert($14)){
- $16=$recv($globals.Smalltalk)._globals();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx2.sendIdx["globals"]=2;
- //>>excludeEnd("ctx");
- $17=$recv(aNode)._value();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx2.sendIdx["value"]=5;
- //>>excludeEnd("ctx");
- return $recv($16)._at_ifAbsent_($17,(function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx3) {
- //>>excludeEnd("ctx");
- return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
- //>>excludeEnd("ctx");
- }));
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
- //>>excludeEnd("ctx");
- }));
- }
- $self._push_($7);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- 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 ] ] ] ])",
- referencedClasses: ["Platform", "Smalltalk"],
- //>>excludeEnd("ide");
- messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
- }),
- $globals.ASTInterpreter);
- $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
- //>>excludeEnd("ide");
- $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $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`";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "currentNode",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@currentNode"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "currentNode\x0a\x09^ currentNode",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "increaseTrackedIndex",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self["@trackedIndex"]=$recv($self._trackedIndex()).__plus((1));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["+", "trackedIndex"]
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "index",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@index"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "index\x0a\x09^ index",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "index:",
- protocol: "accessing",
- fn: function (aNumber){
- var self=this,$self=this;
- $self["@index"]=aNumber;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNumber"],
- source: "index: aNumber\x0a\x09index := aNumber",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- return $self["@selector"];
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "selector\x0a\x09^ selector",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "selector:",
- protocol: "accessing",
- fn: function (aString){
- var self=this,$self=this;
- $self["@selector"]=aString;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- source: "selector: aString\x0a\x09selector := aString",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "trackedIndex",
- protocol: "accessing",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$receiver;
- $1=$self["@trackedIndex"];
- if(($receiver = $1) == null || $receiver.a$nil){
- $self["@trackedIndex"]=(0);
- return $self["@trackedIndex"];
- } else {
- return $1;
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["ifNil:"]
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitJSStatementNode:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- $self["@currentNode"]=aNode;
- return self;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- 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",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "visitSendNode:",
- protocol: "visiting",
- fn: function (aNode){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $2,$1,$3;
- (
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = true,
- //>>excludeEnd("ctx");
- ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = false;
- //>>excludeEnd("ctx");;
- $2=$self._selector();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["selector"]=1;
- //>>excludeEnd("ctx");
- $1=$recv($2).__eq($recv(aNode)._selector());
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["="]=1;
- //>>excludeEnd("ctx");
- if($core.assert($1)){
- $3=$recv($self._trackedIndex()).__eq($self._index());
- if($core.assert($3)){
- $self["@currentNode"]=aNode;
- $self["@currentNode"];
- }
- $self._increaseTrackedIndex();
- }
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- 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 ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
- }),
- $globals.ASTPCNodeVisitor);
- $core.addMethod(
- $core.method({
- selector: "isLastChild",
- protocol: "*Compiler-Interpreter",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["=", "last", "dagChildren", "parent"]
- }),
- $globals.ASTNode);
- $core.addMethod(
- $core.method({
- selector: "isSteppingNode",
- protocol: "*Compiler-Interpreter",
- fn: function (){
- var self=this,$self=this;
- return false;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isSteppingNode\x0a\x09^ false",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.ASTNode);
- $core.addMethod(
- $core.method({
- selector: "nextSiblingNode:",
- protocol: "*Compiler-Interpreter",
- fn: function (aNode){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- var $early={};
- try {
- $1=$self._dagChildren();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.sendIdx["dagChildren"]=1;
- //>>excludeEnd("ctx");
- return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
- throw $early=[nil];
- }));
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- 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 ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
- }),
- $globals.ASTNode);
- $core.addMethod(
- $core.method({
- selector: "isSteppingNode",
- protocol: "*Compiler-Interpreter",
- fn: function (){
- var self=this,$self=this;
- return true;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isSteppingNode\x0a\x09^ true",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.AssignmentNode);
- $core.addMethod(
- $core.method({
- selector: "isSteppingNode",
- protocol: "*Compiler-Interpreter",
- fn: function (){
- var self=this,$self=this;
- return true;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isSteppingNode\x0a\x09^ true",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.BlockNode);
- $core.addMethod(
- $core.method({
- selector: "nextSiblingNode:",
- protocol: "*Compiler-Interpreter",
- fn: function (aNode){
- var self=this,$self=this;
- return nil;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNode"],
- 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",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.BlockNode);
- $core.addMethod(
- $core.method({
- selector: "isSteppingNode",
- protocol: "*Compiler-Interpreter",
- fn: function (){
- var self=this,$self=this;
- return true;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isSteppingNode\x0a\x09^ true",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.DynamicArrayNode);
- $core.addMethod(
- $core.method({
- selector: "isSteppingNode",
- protocol: "*Compiler-Interpreter",
- fn: function (){
- var self=this,$self=this;
- return true;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isSteppingNode\x0a\x09^ true",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.DynamicDictionaryNode);
- $core.addMethod(
- $core.method({
- selector: "isSteppingNode",
- protocol: "*Compiler-Interpreter",
- fn: function (){
- var self=this,$self=this;
- return true;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isSteppingNode\x0a\x09^ true",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.JSStatementNode);
- $core.addMethod(
- $core.method({
- selector: "isCascadeSendNode",
- protocol: "*Compiler-Interpreter",
- fn: function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self._parent())._isCascadeNode();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
- //>>excludeEnd("ctx");
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: ["isCascadeNode", "parent"]
- }),
- $globals.SendNode);
- $core.addMethod(
- $core.method({
- selector: "isSteppingNode",
- protocol: "*Compiler-Interpreter",
- fn: function (){
- var self=this,$self=this;
- return true;
- },
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isSteppingNode\x0a\x09^ true",
- referencedClasses: [],
- //>>excludeEnd("ide");
- messageSends: []
- }),
- $globals.SendNode);
- });
|