1
0

Compiler-Interpreter.js 124 KB

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