Compiler-Interpreter.js 115 KB

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