1
0

Compiler-Interpreter.js 126 KB

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