Compiler-Interpreter.js 130 KB

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