Compiler-Interpreter.js 123 KB

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