Compiler-Interpreter.js 114 KB

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