1
0

Compiler-Interpreter.deploy.js 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281
  1. smalltalk.addPackage('Compiler-Interpreter');
  2. smalltalk.addClass('AIContext', smalltalk.NodeVisitor, ['outerContext', 'pc', 'locals', 'method'], 'Compiler-Interpreter');
  3. smalltalk.addMethod(
  4. smalltalk.method({
  5. selector: "initializeFromMethodContext:",
  6. fn: function (aMethodContext){
  7. var self=this;
  8. return smalltalk.withContext(function($ctx1) {
  9. var $1;
  10. _st(self)._pc_(_st(aMethodContext)._pc());
  11. _st(self)._receiver_(_st(aMethodContext)._receiver());
  12. _st(self)._method_(_st(aMethodContext)._method());
  13. $1=_st(aMethodContext)._outerContext();
  14. if(($receiver = $1) == nil || $receiver == undefined){
  15. $1;
  16. } else {
  17. _st(self)._outerContext_(_st(_st(self)._class())._fromMethodContext_(_st(aMethodContext)._outerContext()));
  18. };
  19. _st(_st(aMethodContext)._locals())._keysAndValuesDo_((function(key,value){
  20. return smalltalk.withContext(function($ctx2) {
  21. return _st(_st(self)._locals())._at_put_(key,value);
  22. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  23. return self}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext)})},
  24. messageSends: ["pc:", "pc", "receiver:", "receiver", "method:", "method", "ifNotNil:", "outerContext:", "fromMethodContext:", "outerContext", "class", "keysAndValuesDo:", "at:put:", "locals"]}),
  25. smalltalk.AIContext);
  26. smalltalk.addMethod(
  27. smalltalk.method({
  28. selector: "initializeLocals",
  29. fn: function (){
  30. var self=this;
  31. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  32. return smalltalk.withContext(function($ctx1) {
  33. self["@locals"]=_st($Dictionary())._new();
  34. _st(self["@locals"])._at_put_("thisContext",self);
  35. return self}, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},smalltalk.AIContext)})},
  36. messageSends: ["new", "at:put:"]}),
  37. smalltalk.AIContext);
  38. smalltalk.addMethod(
  39. smalltalk.method({
  40. selector: "localAt:",
  41. fn: function (aString){
  42. var self=this;
  43. return smalltalk.withContext(function($ctx1) {
  44. var $1;
  45. $1=_st(_st(self)._locals())._at_ifAbsent_(aString,(function(){
  46. return smalltalk.withContext(function($ctx2) {
  47. return nil;
  48. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  49. return $1;
  50. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString},smalltalk.AIContext)})},
  51. messageSends: ["at:ifAbsent:", "locals"]}),
  52. smalltalk.AIContext);
  53. smalltalk.addMethod(
  54. smalltalk.method({
  55. selector: "localAt:put:",
  56. fn: function (aString,anObject){
  57. var self=this;
  58. return smalltalk.withContext(function($ctx1) {
  59. _st(_st(self)._locals())._at_put_(aString,anObject);
  60. return self}, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject},smalltalk.AIContext)})},
  61. messageSends: ["at:put:", "locals"]}),
  62. smalltalk.AIContext);
  63. smalltalk.addMethod(
  64. smalltalk.method({
  65. selector: "locals",
  66. fn: function (){
  67. var self=this;
  68. return smalltalk.withContext(function($ctx1) {
  69. var $1,$2;
  70. $1=self["@locals"];
  71. if(($receiver = $1) == nil || $receiver == undefined){
  72. _st(self)._initializeLocals();
  73. } else {
  74. $1;
  75. };
  76. $2=self["@locals"];
  77. return $2;
  78. }, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.AIContext)})},
  79. messageSends: ["ifNil:", "initializeLocals"]}),
  80. smalltalk.AIContext);
  81. smalltalk.addMethod(
  82. smalltalk.method({
  83. selector: "method",
  84. fn: function (){
  85. var self=this;
  86. return smalltalk.withContext(function($ctx1) {
  87. var $1;
  88. $1=self["@method"];
  89. return $1;
  90. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.AIContext)})},
  91. messageSends: []}),
  92. smalltalk.AIContext);
  93. smalltalk.addMethod(
  94. smalltalk.method({
  95. selector: "method:",
  96. fn: function (aCompiledMethod){
  97. var self=this;
  98. return smalltalk.withContext(function($ctx1) {
  99. self["@method"]=aCompiledMethod;
  100. return self}, function($ctx1) {$ctx1.fill(self,"method:",{aCompiledMethod:aCompiledMethod},smalltalk.AIContext)})},
  101. messageSends: []}),
  102. smalltalk.AIContext);
  103. smalltalk.addMethod(
  104. smalltalk.method({
  105. selector: "outerContext",
  106. fn: function (){
  107. var self=this;
  108. return smalltalk.withContext(function($ctx1) {
  109. var $1;
  110. $1=self["@outerContext"];
  111. return $1;
  112. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.AIContext)})},
  113. messageSends: []}),
  114. smalltalk.AIContext);
  115. smalltalk.addMethod(
  116. smalltalk.method({
  117. selector: "outerContext:",
  118. fn: function (anAIContext){
  119. var self=this;
  120. return smalltalk.withContext(function($ctx1) {
  121. self["@outerContext"]=anAIContext;
  122. return self}, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},smalltalk.AIContext)})},
  123. messageSends: []}),
  124. smalltalk.AIContext);
  125. smalltalk.addMethod(
  126. smalltalk.method({
  127. selector: "pc",
  128. fn: function (){
  129. var self=this;
  130. return smalltalk.withContext(function($ctx1) {
  131. var $2,$1;
  132. $2=self["@pc"];
  133. if(($receiver = $2) == nil || $receiver == undefined){
  134. self["@pc"]=(0);
  135. $1=self["@pc"];
  136. } else {
  137. $1=$2;
  138. };
  139. return $1;
  140. }, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.AIContext)})},
  141. messageSends: ["ifNil:"]}),
  142. smalltalk.AIContext);
  143. smalltalk.addMethod(
  144. smalltalk.method({
  145. selector: "pc:",
  146. fn: function (anInteger){
  147. var self=this;
  148. return smalltalk.withContext(function($ctx1) {
  149. self["@pc"]=anInteger;
  150. return self}, function($ctx1) {$ctx1.fill(self,"pc:",{anInteger:anInteger},smalltalk.AIContext)})},
  151. messageSends: []}),
  152. smalltalk.AIContext);
  153. smalltalk.addMethod(
  154. smalltalk.method({
  155. selector: "receiver",
  156. fn: function (){
  157. var self=this;
  158. return smalltalk.withContext(function($ctx1) {
  159. var $1;
  160. $1=_st(self)._localAt_("self");
  161. return $1;
  162. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.AIContext)})},
  163. messageSends: ["localAt:"]}),
  164. smalltalk.AIContext);
  165. smalltalk.addMethod(
  166. smalltalk.method({
  167. selector: "receiver:",
  168. fn: function (anObject){
  169. var self=this;
  170. return smalltalk.withContext(function($ctx1) {
  171. _st(self)._localAt_put_("self",anObject);
  172. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.AIContext)})},
  173. messageSends: ["localAt:put:"]}),
  174. smalltalk.AIContext);
  175. smalltalk.addMethod(
  176. smalltalk.method({
  177. selector: "selector",
  178. fn: function (){
  179. var self=this;
  180. return smalltalk.withContext(function($ctx1) {
  181. var $2,$1;
  182. $2=_st(self)._method();
  183. if(($receiver = $2) == nil || $receiver == undefined){
  184. $1=$2;
  185. } else {
  186. $1=_st(_st(self)._method())._selector();
  187. };
  188. return $1;
  189. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.AIContext)})},
  190. messageSends: ["ifNotNil:", "selector", "method"]}),
  191. smalltalk.AIContext);
  192. smalltalk.addMethod(
  193. smalltalk.method({
  194. selector: "fromMethodContext:",
  195. fn: function (aMethodContext){
  196. var self=this;
  197. return smalltalk.withContext(function($ctx1) {
  198. var $2,$3,$1;
  199. $2=_st(self)._new();
  200. _st($2)._initializeFromMethodContext_(aMethodContext);
  201. $3=_st($2)._yourself();
  202. $1=$3;
  203. return $1;
  204. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext.klass)})},
  205. messageSends: ["initializeFromMethodContext:", "new", "yourself"]}),
  206. smalltalk.AIContext.klass);
  207. smalltalk.addClass('ASTDebugger', smalltalk.Object, ['interpreter', 'context'], 'Compiler-Interpreter');
  208. smalltalk.addMethod(
  209. smalltalk.method({
  210. selector: "buildAST",
  211. fn: function (){
  212. var self=this;
  213. var ast;
  214. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  215. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  216. return smalltalk.withContext(function($ctx1) {
  217. var $1;
  218. ast=_st(_st($Smalltalk())._current())._parse_(_st(_st(self)._method())._source());
  219. _st(_st($SemanticAnalyzer())._on_(_st(_st(_st(self)._context())._receiver())._class()))._visit_(ast);
  220. $1=ast;
  221. return $1;
  222. }, function($ctx1) {$ctx1.fill(self,"buildAST",{ast:ast},smalltalk.ASTDebugger)})},
  223. messageSends: ["parse:", "source", "method", "current", "visit:", "on:", "class", "receiver", "context"]}),
  224. smalltalk.ASTDebugger);
  225. smalltalk.addMethod(
  226. smalltalk.method({
  227. selector: "context",
  228. fn: function (){
  229. var self=this;
  230. return smalltalk.withContext(function($ctx1) {
  231. var $1;
  232. $1=self["@context"];
  233. return $1;
  234. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTDebugger)})},
  235. messageSends: []}),
  236. smalltalk.ASTDebugger);
  237. smalltalk.addMethod(
  238. smalltalk.method({
  239. selector: "context:",
  240. fn: function (aContext){
  241. var self=this;
  242. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  243. return smalltalk.withContext(function($ctx1) {
  244. self["@context"]=_st($AIContext())._new();
  245. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTDebugger)})},
  246. messageSends: ["new"]}),
  247. smalltalk.ASTDebugger);
  248. smalltalk.addMethod(
  249. smalltalk.method({
  250. selector: "defaultInterpreterClass",
  251. fn: function (){
  252. var self=this;
  253. function $ASTSteppingInterpreter(){return smalltalk.ASTSteppingInterpreter||(typeof ASTSteppingInterpreter=="undefined"?nil:ASTSteppingInterpreter)}
  254. return smalltalk.withContext(function($ctx1) {
  255. var $1;
  256. $1=$ASTSteppingInterpreter();
  257. return $1;
  258. }, function($ctx1) {$ctx1.fill(self,"defaultInterpreterClass",{},smalltalk.ASTDebugger)})},
  259. messageSends: []}),
  260. smalltalk.ASTDebugger);
  261. smalltalk.addMethod(
  262. smalltalk.method({
  263. selector: "initializeInterpreter",
  264. fn: function (){
  265. var self=this;
  266. return smalltalk.withContext(function($ctx1) {
  267. _st(_st(self)._interpreter())._interpret_(_st(_st(_st(self)._buildAST())._nodes())._first());
  268. return self}, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},smalltalk.ASTDebugger)})},
  269. messageSends: ["interpret:", "first", "nodes", "buildAST", "interpreter"]}),
  270. smalltalk.ASTDebugger);
  271. smalltalk.addMethod(
  272. smalltalk.method({
  273. selector: "initializeWithContext:",
  274. fn: function (aMethodContext){
  275. var self=this;
  276. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  277. return smalltalk.withContext(function($ctx1) {
  278. _st(self)._context_(_st($AIContext())._fromMethodContext_(aMethodContext));
  279. _st(self)._initializeInterpreter();
  280. return self}, function($ctx1) {$ctx1.fill(self,"initializeWithContext:",{aMethodContext:aMethodContext},smalltalk.ASTDebugger)})},
  281. messageSends: ["context:", "fromMethodContext:", "initializeInterpreter"]}),
  282. smalltalk.ASTDebugger);
  283. smalltalk.addMethod(
  284. smalltalk.method({
  285. selector: "interpreter",
  286. fn: function (){
  287. var self=this;
  288. return smalltalk.withContext(function($ctx1) {
  289. var $2,$1;
  290. $2=self["@interpreter"];
  291. if(($receiver = $2) == nil || $receiver == undefined){
  292. self["@interpreter"]=_st(_st(self)._defaultInterpreterClass())._new();
  293. $1=self["@interpreter"];
  294. } else {
  295. $1=$2;
  296. };
  297. return $1;
  298. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.ASTDebugger)})},
  299. messageSends: ["ifNil:", "new", "defaultInterpreterClass"]}),
  300. smalltalk.ASTDebugger);
  301. smalltalk.addMethod(
  302. smalltalk.method({
  303. selector: "interpreter:",
  304. fn: function (anInterpreter){
  305. var self=this;
  306. return smalltalk.withContext(function($ctx1) {
  307. self["@interpreter"]=anInterpreter;
  308. return self}, function($ctx1) {$ctx1.fill(self,"interpreter:",{anInterpreter:anInterpreter},smalltalk.ASTDebugger)})},
  309. messageSends: []}),
  310. smalltalk.ASTDebugger);
  311. smalltalk.addMethod(
  312. smalltalk.method({
  313. selector: "method",
  314. fn: function (){
  315. var self=this;
  316. return smalltalk.withContext(function($ctx1) {
  317. var $1;
  318. $1=_st(_st(self)._context())._method();
  319. return $1;
  320. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.ASTDebugger)})},
  321. messageSends: ["method", "context"]}),
  322. smalltalk.ASTDebugger);
  323. smalltalk.addMethod(
  324. smalltalk.method({
  325. selector: "restart",
  326. fn: function (){
  327. var self=this;
  328. return smalltalk.withContext(function($ctx1) {
  329. _st(self)._shouldBeImplemented();
  330. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},smalltalk.ASTDebugger)})},
  331. messageSends: ["shouldBeImplemented"]}),
  332. smalltalk.ASTDebugger);
  333. smalltalk.addMethod(
  334. smalltalk.method({
  335. selector: "resume",
  336. fn: function (){
  337. var self=this;
  338. return smalltalk.withContext(function($ctx1) {
  339. _st(self)._shouldBeImplemented();
  340. return self}, function($ctx1) {$ctx1.fill(self,"resume",{},smalltalk.ASTDebugger)})},
  341. messageSends: ["shouldBeImplemented"]}),
  342. smalltalk.ASTDebugger);
  343. smalltalk.addMethod(
  344. smalltalk.method({
  345. selector: "step",
  346. fn: function (){
  347. var self=this;
  348. return smalltalk.withContext(function($ctx1) {
  349. _st((function(){
  350. return smalltalk.withContext(function($ctx2) {
  351. return _st(_st(_st(_st(_st(self)._interpreter())._nextNode())._notNil())._and_((function(){
  352. return smalltalk.withContext(function($ctx3) {
  353. return _st(_st(_st(self)._interpreter())._nextNode())._stopOnStepping();
  354. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})))._or_((function(){
  355. return smalltalk.withContext(function($ctx3) {
  356. return _st(_st(_st(self)._interpreter())._atEnd())._not();
  357. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  358. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  359. return smalltalk.withContext(function($ctx2) {
  360. _st(_st(self)._interpreter())._step();
  361. return _st(self)._step();
  362. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  363. return self}, function($ctx1) {$ctx1.fill(self,"step",{},smalltalk.ASTDebugger)})},
  364. messageSends: ["whileFalse:", "step", "interpreter", "or:", "not", "atEnd", "and:", "stopOnStepping", "nextNode", "notNil"]}),
  365. smalltalk.ASTDebugger);
  366. smalltalk.addMethod(
  367. smalltalk.method({
  368. selector: "stepInto",
  369. fn: function (){
  370. var self=this;
  371. return smalltalk.withContext(function($ctx1) {
  372. _st(self)._shouldBeImplemented();
  373. return self}, function($ctx1) {$ctx1.fill(self,"stepInto",{},smalltalk.ASTDebugger)})},
  374. messageSends: ["shouldBeImplemented"]}),
  375. smalltalk.ASTDebugger);
  376. smalltalk.addMethod(
  377. smalltalk.method({
  378. selector: "stepOver",
  379. fn: function (){
  380. var self=this;
  381. return smalltalk.withContext(function($ctx1) {
  382. _st(self)._step();
  383. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},smalltalk.ASTDebugger)})},
  384. messageSends: ["step"]}),
  385. smalltalk.ASTDebugger);
  386. smalltalk.addMethod(
  387. smalltalk.method({
  388. selector: "context:",
  389. fn: function (aMethodContext){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $2,$3,$1;
  393. $2=_st(self)._new();
  394. _st($2)._initializeWithContext_(aMethodContext);
  395. $3=_st($2)._yourself();
  396. $1=$3;
  397. return $1;
  398. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},smalltalk.ASTDebugger.klass)})},
  399. messageSends: ["initializeWithContext:", "new", "yourself"]}),
  400. smalltalk.ASTDebugger.klass);
  401. smalltalk.addClass('ASTInterpreter', smalltalk.Object, ['currentNode', 'context', 'shouldReturn', 'result'], 'Compiler-Interpreter');
  402. smalltalk.addMethod(
  403. smalltalk.method({
  404. selector: "assign:to:",
  405. fn: function (aNode,anObject){
  406. var self=this;
  407. return smalltalk.withContext(function($ctx1) {
  408. var $2,$1;
  409. $2=_st(_st(aNode)._binding())._isInstanceVar();
  410. if(smalltalk.assert($2)){
  411. $1=_st(_st(_st(self)._context())._receiver())._instVarAt_put_(_st(aNode)._value(),anObject);
  412. } else {
  413. $1=_st(_st(self)._context())._localAt_put_(_st(aNode)._value(),anObject);
  414. };
  415. return $1;
  416. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},smalltalk.ASTInterpreter)})},
  417. messageSends: ["ifTrue:ifFalse:", "instVarAt:put:", "value", "receiver", "context", "localAt:put:", "isInstanceVar", "binding"]}),
  418. smalltalk.ASTInterpreter);
  419. smalltalk.addMethod(
  420. smalltalk.method({
  421. selector: "context",
  422. fn: function (){
  423. var self=this;
  424. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  425. return smalltalk.withContext(function($ctx1) {
  426. var $2,$1;
  427. $2=self["@context"];
  428. if(($receiver = $2) == nil || $receiver == undefined){
  429. self["@context"]=_st($AIContext())._new();
  430. $1=self["@context"];
  431. } else {
  432. $1=$2;
  433. };
  434. return $1;
  435. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTInterpreter)})},
  436. messageSends: ["ifNil:", "new"]}),
  437. smalltalk.ASTInterpreter);
  438. smalltalk.addMethod(
  439. smalltalk.method({
  440. selector: "context:",
  441. fn: function (anAIContext){
  442. var self=this;
  443. return smalltalk.withContext(function($ctx1) {
  444. self["@context"]=anAIContext;
  445. return self}, function($ctx1) {$ctx1.fill(self,"context:",{anAIContext:anAIContext},smalltalk.ASTInterpreter)})},
  446. messageSends: []}),
  447. smalltalk.ASTInterpreter);
  448. smalltalk.addMethod(
  449. smalltalk.method({
  450. selector: "continue:value:",
  451. fn: function (aBlock,anObject){
  452. var self=this;
  453. return smalltalk.withContext(function($ctx1) {
  454. self["@result"]=anObject;
  455. _st(aBlock)._value_(anObject);
  456. return self}, function($ctx1) {$ctx1.fill(self,"continue:value:",{aBlock:aBlock,anObject:anObject},smalltalk.ASTInterpreter)})},
  457. messageSends: ["value:"]}),
  458. smalltalk.ASTInterpreter);
  459. smalltalk.addMethod(
  460. smalltalk.method({
  461. selector: "currentNode",
  462. fn: function (){
  463. var self=this;
  464. return smalltalk.withContext(function($ctx1) {
  465. var $1;
  466. $1=self["@currentNode"];
  467. return $1;
  468. }, function($ctx1) {$ctx1.fill(self,"currentNode",{},smalltalk.ASTInterpreter)})},
  469. messageSends: []}),
  470. smalltalk.ASTInterpreter);
  471. smalltalk.addMethod(
  472. smalltalk.method({
  473. selector: "eval:",
  474. fn: function (aString){
  475. var self=this;
  476. var source,function_;
  477. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  478. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  479. return smalltalk.withContext(function($ctx1) {
  480. var $1,$2,$3;
  481. source=_st($String())._streamContents_((function(str){
  482. return smalltalk.withContext(function($ctx2) {
  483. _st(str)._nextPutAll_("(function(");
  484. _st(_st(_st(_st(self)._context())._locals())._keys())._do_separatedBy_((function(each){
  485. return smalltalk.withContext(function($ctx3) {
  486. return _st(str)._nextPutAll_(each);
  487. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  488. return smalltalk.withContext(function($ctx3) {
  489. return _st(str)._nextPutAll_(",");
  490. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  491. $1=str;
  492. _st($1)._nextPutAll_("){ return (function() {");
  493. _st($1)._nextPutAll_(aString);
  494. $2=_st($1)._nextPutAll_("})() })");
  495. return $2;
  496. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1)})}));
  497. function_=_st(_st($Compiler())._new())._eval_(source);
  498. $3=_st(function_)._valueWithPossibleArguments_(_st(_st(_st(self)._context())._locals())._values());
  499. return $3;
  500. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},smalltalk.ASTInterpreter)})},
  501. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]}),
  502. smalltalk.ASTInterpreter);
  503. smalltalk.addMethod(
  504. smalltalk.method({
  505. selector: "initialize",
  506. fn: function (){
  507. var self=this;
  508. return smalltalk.withContext(function($ctx1) {
  509. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  510. self["@shouldReturn"]=false;
  511. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ASTInterpreter)})},
  512. messageSends: ["initialize"]}),
  513. smalltalk.ASTInterpreter);
  514. smalltalk.addMethod(
  515. smalltalk.method({
  516. selector: "interpret:",
  517. fn: function (aNode){
  518. var self=this;
  519. return smalltalk.withContext(function($ctx1) {
  520. self["@shouldReturn"]=false;
  521. _st(self)._interpret_continue_(aNode,(function(value){
  522. return smalltalk.withContext(function($ctx2) {
  523. self["@result"]=value;
  524. return self["@result"];
  525. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  526. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  527. messageSends: ["interpret:continue:"]}),
  528. smalltalk.ASTInterpreter);
  529. smalltalk.addMethod(
  530. smalltalk.method({
  531. selector: "interpret:continue:",
  532. fn: function (aNode,aBlock){
  533. var self=this;
  534. return smalltalk.withContext(function($ctx1) {
  535. var $1,$2,$3;
  536. $1=self["@shouldReturn"];
  537. if(smalltalk.assert($1)){
  538. $2=self;
  539. return $2;
  540. };
  541. $3=_st(aNode)._isNode();
  542. if(smalltalk.assert($3)){
  543. self["@currentNode"]=aNode;
  544. self["@currentNode"];
  545. _st(self)._interpretNode_continue_(aNode,(function(value){
  546. return smalltalk.withContext(function($ctx2) {
  547. return _st(self)._continue_value_(aBlock,value);
  548. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  549. } else {
  550. _st(self)._continue_value_(aBlock,aNode);
  551. };
  552. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  553. messageSends: ["ifTrue:", "ifTrue:ifFalse:", "interpretNode:continue:", "continue:value:", "isNode"]}),
  554. smalltalk.ASTInterpreter);
  555. smalltalk.addMethod(
  556. smalltalk.method({
  557. selector: "interpretAll:continue:",
  558. fn: function (aCollection,aBlock){
  559. var self=this;
  560. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  561. return smalltalk.withContext(function($ctx1) {
  562. _st(self)._interpretAll_continue_result_(aCollection,aBlock,_st($OrderedCollection())._new());
  563. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:",{aCollection:aCollection,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  564. messageSends: ["interpretAll:continue:result:", "new"]}),
  565. smalltalk.ASTInterpreter);
  566. smalltalk.addMethod(
  567. smalltalk.method({
  568. selector: "interpretAll:continue:result:",
  569. fn: function (nodes,aBlock,aCollection){
  570. var self=this;
  571. return smalltalk.withContext(function($ctx1) {
  572. var $1;
  573. $1=_st(nodes)._isEmpty();
  574. if(smalltalk.assert($1)){
  575. _st(self)._continue_value_(aBlock,aCollection);
  576. } else {
  577. _st(self)._interpret_continue_(_st(nodes)._first(),(function(value){
  578. return smalltalk.withContext(function($ctx2) {
  579. return _st(self)._interpretAll_continue_result_(_st(nodes)._allButFirst(),aBlock,_st(aCollection).__comma([value]));
  580. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  581. };
  582. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:result:",{nodes:nodes,aBlock:aBlock,aCollection:aCollection},smalltalk.ASTInterpreter)})},
  583. messageSends: ["ifTrue:ifFalse:", "continue:value:", "interpret:continue:", "first", "interpretAll:continue:result:", "allButFirst", ",", "isEmpty"]}),
  584. smalltalk.ASTInterpreter);
  585. smalltalk.addMethod(
  586. smalltalk.method({
  587. selector: "interpretAssignmentNode:continue:",
  588. fn: function (aNode,aBlock){
  589. var self=this;
  590. return smalltalk.withContext(function($ctx1) {
  591. _st(self)._interpret_continue_(_st(aNode)._right(),(function(value){
  592. return smalltalk.withContext(function($ctx2) {
  593. return _st(self)._continue_value_(aBlock,_st(self)._assign_to_(_st(aNode)._left(),value));
  594. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  595. return self}, function($ctx1) {$ctx1.fill(self,"interpretAssignmentNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  596. messageSends: ["interpret:continue:", "right", "continue:value:", "assign:to:", "left"]}),
  597. smalltalk.ASTInterpreter);
  598. smalltalk.addMethod(
  599. smalltalk.method({
  600. selector: "interpretBlockNode:continue:",
  601. fn: function (aNode,aBlock){
  602. var self=this;
  603. return smalltalk.withContext(function($ctx1) {
  604. var $1,$2;
  605. _st(self)._continue_value_(aBlock,(function(){
  606. return smalltalk.withContext(function($ctx2) {
  607. return _st(self)._withBlockContext_((function(){
  608. return smalltalk.withContext(function($ctx3) {
  609. $1=self;
  610. _st($1)._interpret_(_st(_st(aNode)._nodes())._first());
  611. $2=_st($1)._result();
  612. return $2;
  613. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  615. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  616. messageSends: ["continue:value:", "withBlockContext:", "interpret:", "first", "nodes", "result"]}),
  617. smalltalk.ASTInterpreter);
  618. smalltalk.addMethod(
  619. smalltalk.method({
  620. selector: "interpretBlockSequenceNode:continue:",
  621. fn: function (aNode,aBlock){
  622. var self=this;
  623. return smalltalk.withContext(function($ctx1) {
  624. _st(self)._interpretSequenceNode_continue_(aNode,aBlock);
  625. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockSequenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  626. messageSends: ["interpretSequenceNode:continue:"]}),
  627. smalltalk.ASTInterpreter);
  628. smalltalk.addMethod(
  629. smalltalk.method({
  630. selector: "interpretCascadeNode:continue:",
  631. fn: function (aNode,aBlock){
  632. var self=this;
  633. return smalltalk.withContext(function($ctx1) {
  634. _st(self)._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  635. return smalltalk.withContext(function($ctx2) {
  636. _st(_st(aNode)._nodes())._do_((function(each){
  637. return smalltalk.withContext(function($ctx3) {
  638. return _st(each)._receiver_(receiver);
  639. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  640. return _st(self)._interpretAll_continue_(_st(_st(aNode)._nodes())._allButLast(),(function(){
  641. return smalltalk.withContext(function($ctx3) {
  642. return _st(self)._interpret_continue_(_st(_st(aNode)._nodes())._last(),(function(val){
  643. return smalltalk.withContext(function($ctx4) {
  644. return _st(self)._continue_value_(aBlock,val);
  645. }, function($ctx4) {$ctx4.fillBlock({val:val},$ctx1)})}));
  646. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  647. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  648. return self}, function($ctx1) {$ctx1.fill(self,"interpretCascadeNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  649. messageSends: ["interpret:continue:", "receiver", "do:", "receiver:", "nodes", "interpretAll:continue:", "allButLast", "last", "continue:value:"]}),
  650. smalltalk.ASTInterpreter);
  651. smalltalk.addMethod(
  652. smalltalk.method({
  653. selector: "interpretClassReferenceNode:continue:",
  654. fn: function (aNode,aBlock){
  655. var self=this;
  656. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  657. return smalltalk.withContext(function($ctx1) {
  658. _st(self)._continue_value_(aBlock,_st(_st($Smalltalk())._current())._at_(_st(aNode)._value()));
  659. return self}, function($ctx1) {$ctx1.fill(self,"interpretClassReferenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  660. messageSends: ["continue:value:", "at:", "value", "current"]}),
  661. smalltalk.ASTInterpreter);
  662. smalltalk.addMethod(
  663. smalltalk.method({
  664. selector: "interpretDynamicArrayNode:continue:",
  665. fn: function (aNode,aBlock){
  666. var self=this;
  667. return smalltalk.withContext(function($ctx1) {
  668. _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  669. return smalltalk.withContext(function($ctx2) {
  670. return _st(self)._continue_value_(aBlock,array);
  671. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  672. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicArrayNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  673. messageSends: ["interpretAll:continue:", "nodes", "continue:value:"]}),
  674. smalltalk.ASTInterpreter);
  675. smalltalk.addMethod(
  676. smalltalk.method({
  677. selector: "interpretDynamicDictionaryNode:continue:",
  678. fn: function (aNode,aBlock){
  679. var self=this;
  680. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  681. return smalltalk.withContext(function($ctx1) {
  682. _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  683. var hashedCollection;
  684. return smalltalk.withContext(function($ctx2) {
  685. hashedCollection=_st($HashedCollection())._new();
  686. hashedCollection;
  687. _st(array)._do_((function(each){
  688. return smalltalk.withContext(function($ctx3) {
  689. return _st(hashedCollection)._add_(each);
  690. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  691. return _st(self)._continue_value_(aBlock,hashedCollection);
  692. }, function($ctx2) {$ctx2.fillBlock({array:array,hashedCollection:hashedCollection},$ctx1)})}));
  693. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicDictionaryNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  694. messageSends: ["interpretAll:continue:", "nodes", "new", "do:", "add:", "continue:value:"]}),
  695. smalltalk.ASTInterpreter);
  696. smalltalk.addMethod(
  697. smalltalk.method({
  698. selector: "interpretJSStatementNode:continue:",
  699. fn: function (aNode,aBlock){
  700. var self=this;
  701. return smalltalk.withContext(function($ctx1) {
  702. self["@shouldReturn"]=true;
  703. _st(self)._continue_value_(aBlock,_st(self)._eval_(_st(aNode)._source()));
  704. return self}, function($ctx1) {$ctx1.fill(self,"interpretJSStatementNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  705. messageSends: ["continue:value:", "eval:", "source"]}),
  706. smalltalk.ASTInterpreter);
  707. smalltalk.addMethod(
  708. smalltalk.method({
  709. selector: "interpretMethodNode:continue:",
  710. fn: function (aNode,aBlock){
  711. var self=this;
  712. return smalltalk.withContext(function($ctx1) {
  713. _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  714. return smalltalk.withContext(function($ctx2) {
  715. return _st(self)._continue_value_(aBlock,_st(array)._first());
  716. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  717. return self}, function($ctx1) {$ctx1.fill(self,"interpretMethodNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  718. messageSends: ["interpretAll:continue:", "nodes", "continue:value:", "first"]}),
  719. smalltalk.ASTInterpreter);
  720. smalltalk.addMethod(
  721. smalltalk.method({
  722. selector: "interpretNode:continue:",
  723. fn: function (aNode,aBlock){
  724. var self=this;
  725. return smalltalk.withContext(function($ctx1) {
  726. _st(aNode)._interpreter_continue_(self,aBlock);
  727. return self}, function($ctx1) {$ctx1.fill(self,"interpretNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  728. messageSends: ["interpreter:continue:"]}),
  729. smalltalk.ASTInterpreter);
  730. smalltalk.addMethod(
  731. smalltalk.method({
  732. selector: "interpretReturnNode:continue:",
  733. fn: function (aNode,aBlock){
  734. var self=this;
  735. return smalltalk.withContext(function($ctx1) {
  736. _st(self)._interpret_continue_(_st(_st(aNode)._nodes())._first(),(function(value){
  737. return smalltalk.withContext(function($ctx2) {
  738. self["@shouldReturn"]=true;
  739. self["@shouldReturn"];
  740. return _st(self)._continue_value_(aBlock,value);
  741. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  742. return self}, function($ctx1) {$ctx1.fill(self,"interpretReturnNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  743. messageSends: ["interpret:continue:", "first", "nodes", "continue:value:"]}),
  744. smalltalk.ASTInterpreter);
  745. smalltalk.addMethod(
  746. smalltalk.method({
  747. selector: "interpretSendNode:continue:",
  748. fn: function (aNode,aBlock){
  749. var self=this;
  750. return smalltalk.withContext(function($ctx1) {
  751. _st(self)._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  752. return smalltalk.withContext(function($ctx2) {
  753. return _st(self)._interpretAll_continue_(_st(aNode)._arguments(),(function(args){
  754. return smalltalk.withContext(function($ctx3) {
  755. return _st(self)._messageFromSendNode_arguments_do_(aNode,args,(function(message){
  756. return smalltalk.withContext(function($ctx4) {
  757. _st(_st(self)._context())._pc_(_st(_st(_st(self)._context())._pc()).__plus((1)));
  758. return _st(self)._continue_value_(aBlock,_st(message)._sendTo_(receiver));
  759. }, function($ctx4) {$ctx4.fillBlock({message:message},$ctx1)})}));
  760. }, function($ctx3) {$ctx3.fillBlock({args:args},$ctx1)})}));
  761. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  762. return self}, function($ctx1) {$ctx1.fill(self,"interpretSendNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  763. messageSends: ["interpret:continue:", "receiver", "interpretAll:continue:", "arguments", "messageFromSendNode:arguments:do:", "pc:", "+", "pc", "context", "continue:value:", "sendTo:"]}),
  764. smalltalk.ASTInterpreter);
  765. smalltalk.addMethod(
  766. smalltalk.method({
  767. selector: "interpretSequenceNode:continue:",
  768. fn: function (aNode,aBlock){
  769. var self=this;
  770. return smalltalk.withContext(function($ctx1) {
  771. _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  772. return smalltalk.withContext(function($ctx2) {
  773. return _st(self)._continue_value_(aBlock,_st(array)._last());
  774. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  775. return self}, function($ctx1) {$ctx1.fill(self,"interpretSequenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  776. messageSends: ["interpretAll:continue:", "nodes", "continue:value:", "last"]}),
  777. smalltalk.ASTInterpreter);
  778. smalltalk.addMethod(
  779. smalltalk.method({
  780. selector: "interpretValueNode:continue:",
  781. fn: function (aNode,aBlock){
  782. var self=this;
  783. return smalltalk.withContext(function($ctx1) {
  784. _st(self)._continue_value_(aBlock,_st(aNode)._value());
  785. return self}, function($ctx1) {$ctx1.fill(self,"interpretValueNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  786. messageSends: ["continue:value:", "value"]}),
  787. smalltalk.ASTInterpreter);
  788. smalltalk.addMethod(
  789. smalltalk.method({
  790. selector: "interpretVariableNode:continue:",
  791. fn: function (aNode,aBlock){
  792. var self=this;
  793. return smalltalk.withContext(function($ctx1) {
  794. var $1,$2,$4,$3;
  795. $1=self;
  796. $2=aBlock;
  797. $4=_st(_st(aNode)._binding())._isInstanceVar();
  798. if(smalltalk.assert($4)){
  799. $3=_st(_st(_st(self)._context())._receiver())._instVarAt_(_st(aNode)._value());
  800. } else {
  801. $3=_st(_st(self)._context())._localAt_(_st(aNode)._value());
  802. };
  803. _st($1)._continue_value_($2,$3);
  804. return self}, function($ctx1) {$ctx1.fill(self,"interpretVariableNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  805. messageSends: ["continue:value:", "ifTrue:ifFalse:", "instVarAt:", "value", "receiver", "context", "localAt:", "isInstanceVar", "binding"]}),
  806. smalltalk.ASTInterpreter);
  807. smalltalk.addMethod(
  808. smalltalk.method({
  809. selector: "messageFromSendNode:arguments:do:",
  810. fn: function (aSendNode,aCollection,aBlock){
  811. var self=this;
  812. function $Message(){return smalltalk.Message||(typeof Message=="undefined"?nil:Message)}
  813. return smalltalk.withContext(function($ctx1) {
  814. var $1,$2;
  815. $1=_st($Message())._new();
  816. _st($1)._selector_(_st(aSendNode)._selector());
  817. _st($1)._arguments_(aCollection);
  818. $2=_st($1)._yourself();
  819. _st(self)._continue_value_(aBlock,$2);
  820. return self}, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:do:",{aSendNode:aSendNode,aCollection:aCollection,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  821. messageSends: ["continue:value:", "selector:", "selector", "new", "arguments:", "yourself"]}),
  822. smalltalk.ASTInterpreter);
  823. smalltalk.addMethod(
  824. smalltalk.method({
  825. selector: "result",
  826. fn: function (){
  827. var self=this;
  828. return smalltalk.withContext(function($ctx1) {
  829. var $1;
  830. $1=self["@result"];
  831. return $1;
  832. }, function($ctx1) {$ctx1.fill(self,"result",{},smalltalk.ASTInterpreter)})},
  833. messageSends: []}),
  834. smalltalk.ASTInterpreter);
  835. smalltalk.addMethod(
  836. smalltalk.method({
  837. selector: "shouldReturn",
  838. fn: function (){
  839. var self=this;
  840. return smalltalk.withContext(function($ctx1) {
  841. var $2,$1;
  842. $2=self["@shouldReturn"];
  843. if(($receiver = $2) == nil || $receiver == undefined){
  844. $1=false;
  845. } else {
  846. $1=$2;
  847. };
  848. return $1;
  849. }, function($ctx1) {$ctx1.fill(self,"shouldReturn",{},smalltalk.ASTInterpreter)})},
  850. messageSends: ["ifNil:"]}),
  851. smalltalk.ASTInterpreter);
  852. smalltalk.addMethod(
  853. smalltalk.method({
  854. selector: "withBlockContext:",
  855. fn: function (aBlock){
  856. var self=this;
  857. var blockResult;
  858. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  859. return smalltalk.withContext(function($ctx1) {
  860. var $1,$2,$3;
  861. $1=_st($AIContext())._new();
  862. _st($1)._outerContext_(_st(self)._context());
  863. $2=_st($1)._yourself();
  864. _st(self)._context_($2);
  865. blockResult=_st(aBlock)._value();
  866. _st(self)._context_(_st(_st(self)._context())._outerContext());
  867. $3=blockResult;
  868. return $3;
  869. }, function($ctx1) {$ctx1.fill(self,"withBlockContext:",{aBlock:aBlock,blockResult:blockResult},smalltalk.ASTInterpreter)})},
  870. messageSends: ["context:", "outerContext:", "context", "new", "yourself", "value", "outerContext"]}),
  871. smalltalk.ASTInterpreter);
  872. smalltalk.addClass('ASTSteppingInterpreter', smalltalk.ASTInterpreter, ['continuation', 'nextNode'], 'Compiler-Interpreter');
  873. smalltalk.addMethod(
  874. smalltalk.method({
  875. selector: "atEnd",
  876. fn: function (){
  877. var self=this;
  878. return smalltalk.withContext(function($ctx1) {
  879. var $1;
  880. $1=_st(_st(self)._shouldReturn())._or_((function(){
  881. return smalltalk.withContext(function($ctx2) {
  882. return _st(_st(self)._nextNode()).__eq_eq(_st(self)._currentNode());
  883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  884. return $1;
  885. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTSteppingInterpreter)})},
  886. messageSends: ["or:", "==", "currentNode", "nextNode", "shouldReturn"]}),
  887. smalltalk.ASTSteppingInterpreter);
  888. smalltalk.addMethod(
  889. smalltalk.method({
  890. selector: "initialize",
  891. fn: function (){
  892. var self=this;
  893. return smalltalk.withContext(function($ctx1) {
  894. smalltalk.ASTInterpreter.fn.prototype._initialize.apply(_st(self), []);
  895. self["@continuation"]=(function(){
  896. return smalltalk.withContext(function($ctx2) {
  897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  898. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ASTSteppingInterpreter)})},
  899. messageSends: ["initialize"]}),
  900. smalltalk.ASTSteppingInterpreter);
  901. smalltalk.addMethod(
  902. smalltalk.method({
  903. selector: "interpret:continue:",
  904. fn: function (aNode,aBlock){
  905. var self=this;
  906. return smalltalk.withContext(function($ctx1) {
  907. self["@nextNode"]=aNode;
  908. self["@continuation"]=(function(){
  909. return smalltalk.withContext(function($ctx2) {
  910. return smalltalk.ASTInterpreter.fn.prototype._interpret_continue_.apply(_st(self), [aNode,aBlock]);
  911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  912. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTSteppingInterpreter)})},
  913. messageSends: ["interpret:continue:"]}),
  914. smalltalk.ASTSteppingInterpreter);
  915. smalltalk.addMethod(
  916. smalltalk.method({
  917. selector: "nextNode",
  918. fn: function (){
  919. var self=this;
  920. return smalltalk.withContext(function($ctx1) {
  921. var $1;
  922. $1=self["@nextNode"];
  923. return $1;
  924. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.ASTSteppingInterpreter)})},
  925. messageSends: []}),
  926. smalltalk.ASTSteppingInterpreter);
  927. smalltalk.addMethod(
  928. smalltalk.method({
  929. selector: "step",
  930. fn: function (){
  931. var self=this;
  932. return smalltalk.withContext(function($ctx1) {
  933. _st(self["@continuation"])._value();
  934. return self}, function($ctx1) {$ctx1.fill(self,"step",{},smalltalk.ASTSteppingInterpreter)})},
  935. messageSends: ["value"]}),
  936. smalltalk.ASTSteppingInterpreter);
  937. smalltalk.addMethod(
  938. smalltalk.method({
  939. selector: "interpreter:continue:",
  940. fn: function (anInterpreter,aBlock){
  941. var self=this;
  942. return smalltalk.withContext(function($ctx1) {
  943. var $1;
  944. $1=_st(anInterpreter)._interpretNode_continue_(self,aBlock);
  945. return $1;
  946. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.Node)})},
  947. messageSends: ["interpretNode:continue:"]}),
  948. smalltalk.Node);
  949. smalltalk.addMethod(
  950. smalltalk.method({
  951. selector: "isSteppingNode",
  952. fn: function (){
  953. var self=this;
  954. return smalltalk.withContext(function($ctx1) {
  955. return false;
  956. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.Node)})},
  957. messageSends: []}),
  958. smalltalk.Node);
  959. smalltalk.addMethod(
  960. smalltalk.method({
  961. selector: "interpreter:continue:",
  962. fn: function (anInterpreter,aBlock){
  963. var self=this;
  964. return smalltalk.withContext(function($ctx1) {
  965. var $1;
  966. $1=_st(anInterpreter)._interpretAssignmentNode_continue_(self,aBlock);
  967. return $1;
  968. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.AssignmentNode)})},
  969. messageSends: ["interpretAssignmentNode:continue:"]}),
  970. smalltalk.AssignmentNode);
  971. smalltalk.addMethod(
  972. smalltalk.method({
  973. selector: "isSteppingNode",
  974. fn: function (){
  975. var self=this;
  976. return smalltalk.withContext(function($ctx1) {
  977. return true;
  978. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.AssignmentNode)})},
  979. messageSends: []}),
  980. smalltalk.AssignmentNode);
  981. smalltalk.addMethod(
  982. smalltalk.method({
  983. selector: "interpreter:continue:",
  984. fn: function (anInterpreter,aBlock){
  985. var self=this;
  986. return smalltalk.withContext(function($ctx1) {
  987. var $1;
  988. $1=_st(anInterpreter)._interpretBlockNode_continue_(self,aBlock);
  989. return $1;
  990. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.BlockNode)})},
  991. messageSends: ["interpretBlockNode:continue:"]}),
  992. smalltalk.BlockNode);
  993. smalltalk.addMethod(
  994. smalltalk.method({
  995. selector: "isSteppingNode",
  996. fn: function (){
  997. var self=this;
  998. return smalltalk.withContext(function($ctx1) {
  999. return true;
  1000. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.BlockNode)})},
  1001. messageSends: []}),
  1002. smalltalk.BlockNode);
  1003. smalltalk.addMethod(
  1004. smalltalk.method({
  1005. selector: "interpreter:continue:",
  1006. fn: function (anInterpreter,aBlock){
  1007. var self=this;
  1008. return smalltalk.withContext(function($ctx1) {
  1009. var $1;
  1010. $1=_st(anInterpreter)._interpretCascadeNode_continue_(self,aBlock);
  1011. return $1;
  1012. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.CascadeNode)})},
  1013. messageSends: ["interpretCascadeNode:continue:"]}),
  1014. smalltalk.CascadeNode);
  1015. smalltalk.addMethod(
  1016. smalltalk.method({
  1017. selector: "interpreter:continue:",
  1018. fn: function (anInterpreter,aBlock){
  1019. var self=this;
  1020. return smalltalk.withContext(function($ctx1) {
  1021. var $1;
  1022. $1=_st(anInterpreter)._interpretDynamicArrayNode_continue_(self,aBlock);
  1023. return $1;
  1024. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.DynamicArrayNode)})},
  1025. messageSends: ["interpretDynamicArrayNode:continue:"]}),
  1026. smalltalk.DynamicArrayNode);
  1027. smalltalk.addMethod(
  1028. smalltalk.method({
  1029. selector: "isSteppingNode",
  1030. fn: function (){
  1031. var self=this;
  1032. return smalltalk.withContext(function($ctx1) {
  1033. return true;
  1034. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicArrayNode)})},
  1035. messageSends: []}),
  1036. smalltalk.DynamicArrayNode);
  1037. smalltalk.addMethod(
  1038. smalltalk.method({
  1039. selector: "interpreter:continue:",
  1040. fn: function (anInterpreter,aBlock){
  1041. var self=this;
  1042. return smalltalk.withContext(function($ctx1) {
  1043. var $1;
  1044. $1=_st(anInterpreter)._interpretDynamicDictionaryNode_continue_(self,aBlock);
  1045. return $1;
  1046. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.DynamicDictionaryNode)})},
  1047. messageSends: ["interpretDynamicDictionaryNode:continue:"]}),
  1048. smalltalk.DynamicDictionaryNode);
  1049. smalltalk.addMethod(
  1050. smalltalk.method({
  1051. selector: "isSteppingNode",
  1052. fn: function (){
  1053. var self=this;
  1054. return smalltalk.withContext(function($ctx1) {
  1055. return true;
  1056. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicDictionaryNode)})},
  1057. messageSends: []}),
  1058. smalltalk.DynamicDictionaryNode);
  1059. smalltalk.addMethod(
  1060. smalltalk.method({
  1061. selector: "interpreter:continue:",
  1062. fn: function (anInterpreter,aBlock){
  1063. var self=this;
  1064. return smalltalk.withContext(function($ctx1) {
  1065. var $1;
  1066. $1=_st(anInterpreter)._interpretJSStatementNode_continue_(self,aBlock);
  1067. return $1;
  1068. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.JSStatementNode)})},
  1069. messageSends: ["interpretJSStatementNode:continue:"]}),
  1070. smalltalk.JSStatementNode);
  1071. smalltalk.addMethod(
  1072. smalltalk.method({
  1073. selector: "isSteppingNode",
  1074. fn: function (){
  1075. var self=this;
  1076. return smalltalk.withContext(function($ctx1) {
  1077. return true;
  1078. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.JSStatementNode)})},
  1079. messageSends: []}),
  1080. smalltalk.JSStatementNode);
  1081. smalltalk.addMethod(
  1082. smalltalk.method({
  1083. selector: "interpreter:continue:",
  1084. fn: function (anInterpreter,aBlock){
  1085. var self=this;
  1086. return smalltalk.withContext(function($ctx1) {
  1087. var $1;
  1088. $1=_st(anInterpreter)._interpretMethodNode_continue_(self,aBlock);
  1089. return $1;
  1090. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.MethodNode)})},
  1091. messageSends: ["interpretMethodNode:continue:"]}),
  1092. smalltalk.MethodNode);
  1093. smalltalk.addMethod(
  1094. smalltalk.method({
  1095. selector: "interpreter:continue:",
  1096. fn: function (anInterpreter,aBlock){
  1097. var self=this;
  1098. return smalltalk.withContext(function($ctx1) {
  1099. var $1;
  1100. $1=_st(anInterpreter)._interpretReturnNode_continue_(self,aBlock);
  1101. return $1;
  1102. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ReturnNode)})},
  1103. messageSends: ["interpretReturnNode:continue:"]}),
  1104. smalltalk.ReturnNode);
  1105. smalltalk.addMethod(
  1106. smalltalk.method({
  1107. selector: "interpreter:continue:",
  1108. fn: function (anInterpreter,aBlock){
  1109. var self=this;
  1110. return smalltalk.withContext(function($ctx1) {
  1111. var $1;
  1112. $1=_st(anInterpreter)._interpretSendNode_continue_(self,aBlock);
  1113. return $1;
  1114. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.SendNode)})},
  1115. messageSends: ["interpretSendNode:continue:"]}),
  1116. smalltalk.SendNode);
  1117. smalltalk.addMethod(
  1118. smalltalk.method({
  1119. selector: "isSteppingNode",
  1120. fn: function (){
  1121. var self=this;
  1122. return smalltalk.withContext(function($ctx1) {
  1123. return true;
  1124. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.SendNode)})},
  1125. messageSends: []}),
  1126. smalltalk.SendNode);
  1127. smalltalk.addMethod(
  1128. smalltalk.method({
  1129. selector: "interpreter:continue:",
  1130. fn: function (anInterpreter,aBlock){
  1131. var self=this;
  1132. return smalltalk.withContext(function($ctx1) {
  1133. var $1;
  1134. $1=_st(anInterpreter)._interpretSequenceNode_continue_(self,aBlock);
  1135. return $1;
  1136. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.SequenceNode)})},
  1137. messageSends: ["interpretSequenceNode:continue:"]}),
  1138. smalltalk.SequenceNode);
  1139. smalltalk.addMethod(
  1140. smalltalk.method({
  1141. selector: "interpreter:continue:",
  1142. fn: function (anInterpreter,aBlock){
  1143. var self=this;
  1144. return smalltalk.withContext(function($ctx1) {
  1145. var $1;
  1146. $1=_st(anInterpreter)._interpretBlockSequenceNode_continue_(self,aBlock);
  1147. return $1;
  1148. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.BlockSequenceNode)})},
  1149. messageSends: ["interpretBlockSequenceNode:continue:"]}),
  1150. smalltalk.BlockSequenceNode);
  1151. smalltalk.addMethod(
  1152. smalltalk.method({
  1153. selector: "interpreter:continue:",
  1154. fn: function (anInterpreter,aBlock){
  1155. var self=this;
  1156. return smalltalk.withContext(function($ctx1) {
  1157. var $1;
  1158. $1=_st(anInterpreter)._interpretValueNode_continue_(self,aBlock);
  1159. return $1;
  1160. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ValueNode)})},
  1161. messageSends: ["interpretValueNode:continue:"]}),
  1162. smalltalk.ValueNode);
  1163. smalltalk.addMethod(
  1164. smalltalk.method({
  1165. selector: "interpreter:continue:",
  1166. fn: function (anInterpreter,aBlock){
  1167. var self=this;
  1168. return smalltalk.withContext(function($ctx1) {
  1169. var $1;
  1170. $1=_st(anInterpreter)._interpretVariableNode_continue_(self,aBlock);
  1171. return $1;
  1172. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.VariableNode)})},
  1173. messageSends: ["interpretVariableNode:continue:"]}),
  1174. smalltalk.VariableNode);
  1175. smalltalk.addMethod(
  1176. smalltalk.method({
  1177. selector: "interpreter:continue:",
  1178. fn: function (anInterpreter,aBlock){
  1179. var self=this;
  1180. return smalltalk.withContext(function($ctx1) {
  1181. var $1;
  1182. $1=_st(anInterpreter)._interpretClassReferenceNode_continue_(self,aBlock);
  1183. return $1;
  1184. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ClassReferenceNode)})},
  1185. messageSends: ["interpretClassReferenceNode:continue:"]}),
  1186. smalltalk.ClassReferenceNode);