Compiler-Interpreter.js 127 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003
  1. define("amber_core/Compiler-Interpreter", ["amber/boot", "amber_core/Kernel-Methods", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects", "amber_core/Compiler-AST", "amber_core/Kernel-Exceptions"], function($boot){"use strict";
  2. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. $core.addPackage('Compiler-Interpreter');
  4. $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  5. $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  6. $core.addClass('AIBlockClosure', $globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $globals.AIBlockClosure.comment="I am a special `BlockClosure` subclass used by an interpreter to interpret a block node.\x0a\x0aWhile I am polymorphic with `BlockClosure`, some methods such as `#new` will raise interpretation errors. Unlike a `BlockClosure`, my instance are not JavaScript functions.\x0a\x0aEvaluating an instance will result in interpreting the `node` instance variable (instance of `BlockNode`).";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "applyTo:arguments:",
  13. protocol: 'evaluating',
  14. fn: function (anObject,aCollection){
  15. var self=this;
  16. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17. return $core.withContext(function($ctx1) {
  18. //>>excludeEnd("ctx");
  19. self._interpreterError();
  20. return self;
  21. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  23. //>>excludeEnd("ctx");
  24. },
  25. //>>excludeStart("ide", pragmas.excludeIdeData);
  26. args: ["anObject", "aCollection"],
  27. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  28. referencedClasses: [],
  29. //>>excludeEnd("ide");
  30. messageSends: ["interpreterError"]
  31. }),
  32. $globals.AIBlockClosure);
  33. $core.addMethod(
  34. $core.method({
  35. selector: "compiledSource",
  36. protocol: 'accessing',
  37. fn: function (){
  38. var self=this;
  39. return "[ AST Block closure ]";
  40. },
  41. //>>excludeStart("ide", pragmas.excludeIdeData);
  42. args: [],
  43. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  44. referencedClasses: [],
  45. //>>excludeEnd("ide");
  46. messageSends: []
  47. }),
  48. $globals.AIBlockClosure);
  49. $core.addMethod(
  50. $core.method({
  51. selector: "currySelf",
  52. protocol: 'converting',
  53. fn: function (){
  54. var self=this;
  55. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56. return $core.withContext(function($ctx1) {
  57. //>>excludeEnd("ctx");
  58. self._interpreterError();
  59. return self;
  60. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  62. //>>excludeEnd("ctx");
  63. },
  64. //>>excludeStart("ide", pragmas.excludeIdeData);
  65. args: [],
  66. source: "currySelf\x0a\x09self interpreterError",
  67. referencedClasses: [],
  68. //>>excludeEnd("ide");
  69. messageSends: ["interpreterError"]
  70. }),
  71. $globals.AIBlockClosure);
  72. $core.addMethod(
  73. $core.method({
  74. selector: "initializeWithContext:node:",
  75. protocol: 'initialization',
  76. fn: function (aContext,aNode){
  77. var self=this;
  78. self["@node"]=aNode;
  79. self["@outerContext"]=aContext;
  80. return self;
  81. },
  82. //>>excludeStart("ide", pragmas.excludeIdeData);
  83. args: ["aContext", "aNode"],
  84. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  85. referencedClasses: [],
  86. //>>excludeEnd("ide");
  87. messageSends: []
  88. }),
  89. $globals.AIBlockClosure);
  90. $core.addMethod(
  91. $core.method({
  92. selector: "interpreterError",
  93. protocol: 'error handling',
  94. fn: function (){
  95. var self=this;
  96. 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_("0,(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: '0,(function('.\x0a\x09\x09self context locals keys\x0a\x09\x09\x09do: [ :each | str nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ str nextPutAll: ',' ].\x0a\x09\x09str\x0a\x09\x09\x09nextPutAll: '){ return (function() {';\x0a\x09\x09\x09nextPutAll: aString;\x0a\x09\x09\x09nextPutAll: '})()})' ].\x0a\x09\x09\x09\x0a\x09function := Compiler new eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values",
  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 $Platform(){return $globals.Platform||(typeof Platform=="undefined"?nil:Platform)}
  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($Platform())._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($Platform())._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: (Platform globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].\x0a\x09\x09\x0a\x09self push: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context \x0a\x09\x09\x09localAt: aNode value\x0a\x09\x09\x09ifAbsent: [\x0a\x09\x09\x09\x09aNode value isCapitalized\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09Smalltalk globals \x0a\x09\x09\x09\x09\x09\x09\x09at: aNode value \x0a\x09\x09\x09\x09\x09\x09\x09ifAbsent: [ Platform globals at: aNode value ] ] ] ])",
  3337. referencedClasses: ["Platform", "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: "nextChild",
  3597. protocol: '*Compiler-Interpreter',
  3598. fn: function (){
  3599. var self=this;
  3600. return self;
  3601. },
  3602. //>>excludeStart("ide", pragmas.excludeIdeData);
  3603. args: [],
  3604. source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  3605. referencedClasses: [],
  3606. //>>excludeEnd("ide");
  3607. messageSends: []
  3608. }),
  3609. $globals.BlockNode);
  3610. $core.addMethod(
  3611. $core.method({
  3612. selector: "nextNode:",
  3613. protocol: '*Compiler-Interpreter',
  3614. fn: function (aNode){
  3615. var self=this;
  3616. return self;
  3617. },
  3618. //>>excludeStart("ide", pragmas.excludeIdeData);
  3619. args: ["aNode"],
  3620. source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  3621. referencedClasses: [],
  3622. //>>excludeEnd("ide");
  3623. messageSends: []
  3624. }),
  3625. $globals.BlockNode);
  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.DynamicArrayNode);
  3642. $core.addMethod(
  3643. $core.method({
  3644. selector: "isSteppingNode",
  3645. protocol: '*Compiler-Interpreter',
  3646. fn: function (){
  3647. var self=this;
  3648. return true;
  3649. },
  3650. //>>excludeStart("ide", pragmas.excludeIdeData);
  3651. args: [],
  3652. source: "isSteppingNode\x0a\x09^ true",
  3653. referencedClasses: [],
  3654. //>>excludeEnd("ide");
  3655. messageSends: []
  3656. }),
  3657. $globals.DynamicDictionaryNode);
  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.JSStatementNode);
  3674. $core.addMethod(
  3675. $core.method({
  3676. selector: "isSteppingNode",
  3677. protocol: '*Compiler-Interpreter',
  3678. fn: function (){
  3679. var self=this;
  3680. return false;
  3681. },
  3682. //>>excludeStart("ide", pragmas.excludeIdeData);
  3683. args: [],
  3684. source: "isSteppingNode\x0a\x09^ false",
  3685. referencedClasses: [],
  3686. //>>excludeEnd("ide");
  3687. messageSends: []
  3688. }),
  3689. $globals.Node);
  3690. $core.addMethod(
  3691. $core.method({
  3692. selector: "nextChild",
  3693. protocol: '*Compiler-Interpreter',
  3694. fn: function (){
  3695. var self=this;
  3696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3697. return $core.withContext(function($ctx1) {
  3698. //>>excludeEnd("ctx");
  3699. var $3,$2,$1;
  3700. $3=self._nodes();
  3701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3702. $ctx1.sendIdx["nodes"]=1;
  3703. //>>excludeEnd("ctx");
  3704. $2=$recv($3)._isEmpty();
  3705. if($core.assert($2)){
  3706. $1=self;
  3707. } else {
  3708. $1=$recv($recv(self._nodes())._first())._nextChild();
  3709. };
  3710. return $1;
  3711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3712. }, function($ctx1) {$ctx1.fill(self,"nextChild",{},$globals.Node)});
  3713. //>>excludeEnd("ctx");
  3714. },
  3715. //>>excludeStart("ide", pragmas.excludeIdeData);
  3716. args: [],
  3717. source: "nextChild\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the receiver to answer the next node to be evaluated\x22\x0a\x09\x0a\x09^ self nodes isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self nodes first nextChild ]",
  3718. referencedClasses: [],
  3719. //>>excludeEnd("ide");
  3720. messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"]
  3721. }),
  3722. $globals.Node);
  3723. $core.addMethod(
  3724. $core.method({
  3725. selector: "nextNode",
  3726. protocol: '*Compiler-Interpreter',
  3727. fn: function (){
  3728. var self=this;
  3729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3730. return $core.withContext(function($ctx1) {
  3731. //>>excludeEnd("ctx");
  3732. var $2,$1,$receiver;
  3733. $2=self._parent();
  3734. if(($receiver = $2) == null || $receiver.isNil){
  3735. $1=$2;
  3736. } else {
  3737. var node;
  3738. node=$receiver;
  3739. $1=$recv(node)._nextNode_(self);
  3740. };
  3741. return $1;
  3742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3743. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},$globals.Node)});
  3744. //>>excludeEnd("ctx");
  3745. },
  3746. //>>excludeStart("ide", pragmas.excludeIdeData);
  3747. args: [],
  3748. source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
  3749. referencedClasses: [],
  3750. //>>excludeEnd("ide");
  3751. messageSends: ["ifNotNil:", "parent", "nextNode:"]
  3752. }),
  3753. $globals.Node);
  3754. $core.addMethod(
  3755. $core.method({
  3756. selector: "nextNode:",
  3757. protocol: '*Compiler-Interpreter',
  3758. fn: function (aNode){
  3759. var self=this;
  3760. var next;
  3761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3762. return $core.withContext(function($ctx1) {
  3763. //>>excludeEnd("ctx");
  3764. var $1,$2;
  3765. var $early={};
  3766. try {
  3767. $1=self._nodes();
  3768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3769. $ctx1.sendIdx["nodes"]=1;
  3770. //>>excludeEnd("ctx");
  3771. next=$recv($1)._at_ifAbsent_($recv($recv(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  3772. throw $early=[self];
  3773. }));
  3774. $2=$recv(next)._nextChild();
  3775. return $2;
  3776. }
  3777. catch(e) {if(e===$early)return e[0]; throw e}
  3778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3779. }, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},$globals.Node)});
  3780. //>>excludeEnd("ctx");
  3781. },
  3782. //>>excludeStart("ide", pragmas.excludeIdeData);
  3783. args: ["aNode"],
  3784. source: "nextNode: aNode\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the next node to answer the next node to be evaluated\x22\x0a\x09\x0a\x09| next |\x0a\x09\x0a\x09next := self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ self ].\x0a\x09\x0a\x09^ next nextChild",
  3785. referencedClasses: [],
  3786. //>>excludeEnd("ide");
  3787. messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"]
  3788. }),
  3789. $globals.Node);
  3790. $core.addMethod(
  3791. $core.method({
  3792. selector: "isSteppingNode",
  3793. protocol: '*Compiler-Interpreter',
  3794. fn: function (){
  3795. var self=this;
  3796. return true;
  3797. },
  3798. //>>excludeStart("ide", pragmas.excludeIdeData);
  3799. args: [],
  3800. source: "isSteppingNode\x0a\x09^ true",
  3801. referencedClasses: [],
  3802. //>>excludeEnd("ide");
  3803. messageSends: []
  3804. }),
  3805. $globals.SendNode);
  3806. });