Compiler-Interpreter.deploy.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. smalltalk.addPackage('Compiler-Interpreter', {});
  2. smalltalk.addClass('AIContext', smalltalk.NodeVisitor, ['outerContext', 'pc', 'locals', 'receiver', 'selector'], 'Compiler-Interpreter');
  3. smalltalk.addMethod(
  4. "_initializeFromMethodContext_",
  5. smalltalk.method({
  6. selector: "initializeFromMethodContext:",
  7. fn: function (aMethodContext){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) { var $1;
  10. _st(self)._pc_(_st(aMethodContext)._pc());
  11. _st(self)._receiver_(_st(aMethodContext)._receiver());
  12. _st(self)._selector_(_st(aMethodContext)._selector());
  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) { return _st(_st(self)._locals())._at_put_(key,value);
  21. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  22. return self}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext}, smalltalk.AIContext)})}
  23. }),
  24. smalltalk.AIContext);
  25. smalltalk.addMethod(
  26. "_localAt_",
  27. smalltalk.method({
  28. selector: "localAt:",
  29. fn: function (aString){
  30. var self=this;
  31. return smalltalk.withContext(function($ctx1) { var $1;
  32. $1=_st(_st(self)._locals())._at_ifAbsent_(aString,(function(){
  33. return smalltalk.withContext(function($ctx2) { return nil;
  34. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  35. return $1;
  36. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString}, smalltalk.AIContext)})}
  37. }),
  38. smalltalk.AIContext);
  39. smalltalk.addMethod(
  40. "_localAt_put_",
  41. smalltalk.method({
  42. selector: "localAt:put:",
  43. fn: function (aString,anObject){
  44. var self=this;
  45. return smalltalk.withContext(function($ctx1) { _st(_st(self)._locals())._at_put_(aString,anObject);
  46. return self}, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject}, smalltalk.AIContext)})}
  47. }),
  48. smalltalk.AIContext);
  49. smalltalk.addMethod(
  50. "_locals",
  51. smalltalk.method({
  52. selector: "locals",
  53. fn: function (){
  54. var self=this;
  55. return smalltalk.withContext(function($ctx1) { var $2,$1;
  56. $2=self["@locals"];
  57. if(($receiver = $2) == nil || $receiver == undefined){
  58. self["@locals"]=_st((smalltalk.Dictionary || Dictionary))._new();
  59. $1=self["@locals"];
  60. } else {
  61. $1=$2;
  62. };
  63. return $1;
  64. }, function($ctx1) {$ctx1.fill(self,"locals",{}, smalltalk.AIContext)})}
  65. }),
  66. smalltalk.AIContext);
  67. smalltalk.addMethod(
  68. "_outerContext",
  69. smalltalk.method({
  70. selector: "outerContext",
  71. fn: function (){
  72. var self=this;
  73. return smalltalk.withContext(function($ctx1) { var $1;
  74. $1=self["@outerContext"];
  75. return $1;
  76. }, function($ctx1) {$ctx1.fill(self,"outerContext",{}, smalltalk.AIContext)})}
  77. }),
  78. smalltalk.AIContext);
  79. smalltalk.addMethod(
  80. "_outerContext_",
  81. smalltalk.method({
  82. selector: "outerContext:",
  83. fn: function (anAIContext){
  84. var self=this;
  85. return smalltalk.withContext(function($ctx1) { self["@outerContext"]=anAIContext;
  86. return self}, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext}, smalltalk.AIContext)})}
  87. }),
  88. smalltalk.AIContext);
  89. smalltalk.addMethod(
  90. "_pc",
  91. smalltalk.method({
  92. selector: "pc",
  93. fn: function (){
  94. var self=this;
  95. return smalltalk.withContext(function($ctx1) { var $2,$1;
  96. $2=self["@pc"];
  97. if(($receiver = $2) == nil || $receiver == undefined){
  98. self["@pc"]=(0);
  99. $1=self["@pc"];
  100. } else {
  101. $1=$2;
  102. };
  103. return $1;
  104. }, function($ctx1) {$ctx1.fill(self,"pc",{}, smalltalk.AIContext)})}
  105. }),
  106. smalltalk.AIContext);
  107. smalltalk.addMethod(
  108. "_pc_",
  109. smalltalk.method({
  110. selector: "pc:",
  111. fn: function (anInteger){
  112. var self=this;
  113. return smalltalk.withContext(function($ctx1) { self["@pc"]=anInteger;
  114. return self}, function($ctx1) {$ctx1.fill(self,"pc:",{anInteger:anInteger}, smalltalk.AIContext)})}
  115. }),
  116. smalltalk.AIContext);
  117. smalltalk.addMethod(
  118. "_receiver",
  119. smalltalk.method({
  120. selector: "receiver",
  121. fn: function (){
  122. var self=this;
  123. return smalltalk.withContext(function($ctx1) { var $1;
  124. $1=self["@receiver"];
  125. return $1;
  126. }, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.AIContext)})}
  127. }),
  128. smalltalk.AIContext);
  129. smalltalk.addMethod(
  130. "_receiver_",
  131. smalltalk.method({
  132. selector: "receiver:",
  133. fn: function (anObject){
  134. var self=this;
  135. return smalltalk.withContext(function($ctx1) { self["@receiver"]=anObject;
  136. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.AIContext)})}
  137. }),
  138. smalltalk.AIContext);
  139. smalltalk.addMethod(
  140. "_selector",
  141. smalltalk.method({
  142. selector: "selector",
  143. fn: function (){
  144. var self=this;
  145. return smalltalk.withContext(function($ctx1) { var $1;
  146. $1=self["@selector"];
  147. return $1;
  148. }, function($ctx1) {$ctx1.fill(self,"selector",{}, smalltalk.AIContext)})}
  149. }),
  150. smalltalk.AIContext);
  151. smalltalk.addMethod(
  152. "_selector_",
  153. smalltalk.method({
  154. selector: "selector:",
  155. fn: function (aString){
  156. var self=this;
  157. return smalltalk.withContext(function($ctx1) { self["@selector"]=aString;
  158. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString}, smalltalk.AIContext)})}
  159. }),
  160. smalltalk.AIContext);
  161. smalltalk.addMethod(
  162. "_fromMethodContext_",
  163. smalltalk.method({
  164. selector: "fromMethodContext:",
  165. fn: function (aMethodContext){
  166. var self=this;
  167. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  168. $2=_st(self)._new();
  169. _st($2)._initializeFromMethodContext_(aMethodContext);
  170. $3=_st($2)._yourself();
  171. $1=$3;
  172. return $1;
  173. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext}, smalltalk.AIContext.klass)})}
  174. }),
  175. smalltalk.AIContext.klass);
  176. smalltalk.addClass('ASTInterpreter', smalltalk.NodeVisitor, ['currentNode', 'context', 'shouldReturn', 'currentValue'], 'Compiler-Interpreter');
  177. smalltalk.addMethod(
  178. "_assign_to_",
  179. smalltalk.method({
  180. selector: "assign:to:",
  181. fn: function (aNode,anObject){
  182. var self=this;
  183. return smalltalk.withContext(function($ctx1) { var $2,$1;
  184. $2=_st(_st(aNode)._binding())._isInstanceVar();
  185. if(smalltalk.assert($2)){
  186. $1=_st(_st(_st(self)._context())._receiver())._instVarAt_put_(_st(aNode)._value(),anObject);
  187. } else {
  188. $1=_st(_st(self)._context())._localAt_put_(_st(aNode)._value(),anObject);
  189. };
  190. return $1;
  191. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject}, smalltalk.ASTInterpreter)})}
  192. }),
  193. smalltalk.ASTInterpreter);
  194. smalltalk.addMethod(
  195. "_context",
  196. smalltalk.method({
  197. selector: "context",
  198. fn: function (){
  199. var self=this;
  200. return smalltalk.withContext(function($ctx1) { var $2,$1;
  201. $2=self["@context"];
  202. if(($receiver = $2) == nil || $receiver == undefined){
  203. self["@context"]=_st((smalltalk.AIContext || AIContext))._new();
  204. $1=self["@context"];
  205. } else {
  206. $1=$2;
  207. };
  208. return $1;
  209. }, function($ctx1) {$ctx1.fill(self,"context",{}, smalltalk.ASTInterpreter)})}
  210. }),
  211. smalltalk.ASTInterpreter);
  212. smalltalk.addMethod(
  213. "_context_",
  214. smalltalk.method({
  215. selector: "context:",
  216. fn: function (anAIContext){
  217. var self=this;
  218. return smalltalk.withContext(function($ctx1) { self["@context"]=anAIContext;
  219. return self}, function($ctx1) {$ctx1.fill(self,"context:",{anAIContext:anAIContext}, smalltalk.ASTInterpreter)})}
  220. }),
  221. smalltalk.ASTInterpreter);
  222. smalltalk.addMethod(
  223. "_continue_",
  224. smalltalk.method({
  225. selector: "continue:",
  226. fn: function (anObject){
  227. var self=this;
  228. return smalltalk.withContext(function($ctx1) { self["@currentValue"]=anObject;
  229. return self}, function($ctx1) {$ctx1.fill(self,"continue:",{anObject:anObject}, smalltalk.ASTInterpreter)})}
  230. }),
  231. smalltalk.ASTInterpreter);
  232. smalltalk.addMethod(
  233. "_currentValue",
  234. smalltalk.method({
  235. selector: "currentValue",
  236. fn: function (){
  237. var self=this;
  238. return smalltalk.withContext(function($ctx1) { var $1;
  239. $1=self["@currentValue"];
  240. return $1;
  241. }, function($ctx1) {$ctx1.fill(self,"currentValue",{}, smalltalk.ASTInterpreter)})}
  242. }),
  243. smalltalk.ASTInterpreter);
  244. smalltalk.addMethod(
  245. "_eval_",
  246. smalltalk.method({
  247. selector: "eval:",
  248. fn: function (aString){
  249. var self=this;
  250. var source,function_;
  251. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  252. source=_st((smalltalk.String || String))._streamContents_((function(str){
  253. return smalltalk.withContext(function($ctx2) { _st(str)._nextPutAll_("(function(");
  254. _st(_st(_st(_st(self)._context())._locals())._keys())._do_separatedBy_((function(each){
  255. return smalltalk.withContext(function($ctx3) { return _st(str)._nextPutAll_(each);
  256. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  257. return smalltalk.withContext(function($ctx3) { return _st(str)._nextPutAll_(",");
  258. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  259. $1=str;
  260. _st($1)._nextPutAll_("){ return (function() {");
  261. _st($1)._nextPutAll_(aString);
  262. $2=_st($1)._nextPutAll_("})() })");
  263. return $2;
  264. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1)})}));
  265. function_=_st(_st((smalltalk.Compiler || Compiler))._new())._eval_(source);
  266. $3=_st(function_)._valueWithPossibleArguments_(_st(_st(_st(self)._context())._locals())._values());
  267. return $3;
  268. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_}, smalltalk.ASTInterpreter)})}
  269. }),
  270. smalltalk.ASTInterpreter);
  271. smalltalk.addMethod(
  272. "_initialize",
  273. smalltalk.method({
  274. selector: "initialize",
  275. fn: function (){
  276. var self=this;
  277. return smalltalk.withContext(function($ctx1) { smalltalk.NodeVisitor.fn.prototype._initialize.apply(_st(self), []);
  278. self["@shouldReturn"]=false;
  279. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ASTInterpreter)})}
  280. }),
  281. smalltalk.ASTInterpreter);
  282. smalltalk.addMethod(
  283. "_interpret_",
  284. smalltalk.method({
  285. selector: "interpret:",
  286. fn: function (aNode){
  287. var self=this;
  288. return smalltalk.withContext(function($ctx1) { self["@shouldReturn"]=false;
  289. _st(self)._interpret_continue_(aNode,(function(value){
  290. return smalltalk.withContext(function($ctx2) { self["@currentValue"]=value;
  291. return self["@currentValue"];
  292. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  293. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  294. }),
  295. smalltalk.ASTInterpreter);
  296. smalltalk.addMethod(
  297. "_interpret_continue_",
  298. smalltalk.method({
  299. selector: "interpret:continue:",
  300. fn: function (aNode,aBlock){
  301. var self=this;
  302. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  303. $1=self["@shouldReturn"];
  304. if(smalltalk.assert($1)){
  305. $2=self;
  306. return $2;
  307. };
  308. $3=_st(aNode)._isNode();
  309. if(smalltalk.assert($3)){
  310. _st(self)._visit_(aNode);
  311. } else {
  312. self["@currentValue"]=aNode;
  313. self["@currentValue"];
  314. };
  315. _st(aBlock)._value_(_st(self)._currentValue());
  316. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  317. }),
  318. smalltalk.ASTInterpreter);
  319. smalltalk.addMethod(
  320. "_interpretAll_continue_",
  321. smalltalk.method({
  322. selector: "interpretAll:continue:",
  323. fn: function (aCollection,aBlock){
  324. var self=this;
  325. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_result_(aCollection,aBlock,_st((smalltalk.OrderedCollection || OrderedCollection))._new());
  326. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:",{aCollection:aCollection,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  327. }),
  328. smalltalk.ASTInterpreter);
  329. smalltalk.addMethod(
  330. "_interpretAll_continue_result_",
  331. smalltalk.method({
  332. selector: "interpretAll:continue:result:",
  333. fn: function (nodes,aBlock,aCollection){
  334. var self=this;
  335. return smalltalk.withContext(function($ctx1) { var $1;
  336. $1=_st(nodes)._isEmpty();
  337. if(smalltalk.assert($1)){
  338. _st(aBlock)._value_(aCollection);
  339. } else {
  340. _st(self)._interpret_continue_(_st(nodes)._first(),(function(value){
  341. return smalltalk.withContext(function($ctx2) { return _st(self)._interpretAll_continue_result_(_st(nodes)._allButFirst(),aBlock,_st(aCollection).__comma([value]));
  342. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  343. };
  344. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:result:",{nodes:nodes,aBlock:aBlock,aCollection:aCollection}, smalltalk.ASTInterpreter)})}
  345. }),
  346. smalltalk.ASTInterpreter);
  347. smalltalk.addMethod(
  348. "_messageFromSendNode_do_",
  349. smalltalk.method({
  350. selector: "messageFromSendNode:do:",
  351. fn: function (aSendNode,aBlock){
  352. var self=this;
  353. return smalltalk.withContext(function($ctx1) { var $1,$2;
  354. _st(self)._interpretAll_continue_(_st(aSendNode)._arguments(),(function(args){
  355. return smalltalk.withContext(function($ctx2) { $1=_st((smalltalk.Message || Message))._new();
  356. _st($1)._selector_(_st(aSendNode)._selector());
  357. _st($1)._arguments_(args);
  358. $2=_st($1)._yourself();
  359. return _st(aBlock)._value_($2);
  360. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1)})}));
  361. return self}, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:do:",{aSendNode:aSendNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  362. }),
  363. smalltalk.ASTInterpreter);
  364. smalltalk.addMethod(
  365. "_visitAssignmentNode_",
  366. smalltalk.method({
  367. selector: "visitAssignmentNode:",
  368. fn: function (aNode){
  369. var self=this;
  370. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(aNode)._right(),(function(value){
  371. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_(_st(self)._assign_to_(_st(aNode)._left(),value));
  372. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  373. return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  374. }),
  375. smalltalk.ASTInterpreter);
  376. smalltalk.addMethod(
  377. "_visitBlockNode_",
  378. smalltalk.method({
  379. selector: "visitBlockNode:",
  380. fn: function (aNode){
  381. var self=this;
  382. return smalltalk.withContext(function($ctx1) { var $1,$2;
  383. _st(self)._continue_((function(){
  384. return smalltalk.withContext(function($ctx2) { $1=self;
  385. _st($1)._interpret_(_st(_st(aNode)._nodes())._first());
  386. $2=_st($1)._currentValue();
  387. return $2;
  388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  389. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  390. }),
  391. smalltalk.ASTInterpreter);
  392. smalltalk.addMethod(
  393. "_visitCascadeNode_",
  394. smalltalk.method({
  395. selector: "visitCascadeNode:",
  396. fn: function (aNode){
  397. var self=this;
  398. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  399. return smalltalk.withContext(function($ctx2) { _st(_st(aNode)._nodes())._do_((function(each){
  400. return smalltalk.withContext(function($ctx3) { return _st(each)._receiver_(receiver);
  401. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  402. return _st(self)._interpretAll_continue_(_st(_st(aNode)._nodes())._allButLast(),(function(){
  403. return smalltalk.withContext(function($ctx3) { return _st(self)._interpret_continue_(_st(_st(aNode)._nodes())._last(),(function(val){
  404. return smalltalk.withContext(function($ctx4) { return _st(self)._continue_(val);
  405. }, function($ctx4) {$ctx4.fillBlock({val:val},$ctx1)})}));
  406. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  407. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  408. return self}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  409. }),
  410. smalltalk.ASTInterpreter);
  411. smalltalk.addMethod(
  412. "_visitClassReferenceNode_",
  413. smalltalk.method({
  414. selector: "visitClassReferenceNode:",
  415. fn: function (aNode){
  416. var self=this;
  417. return smalltalk.withContext(function($ctx1) { _st(self)._continue_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_(_st(aNode)._value()));
  418. return self}, function($ctx1) {$ctx1.fill(self,"visitClassReferenceNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  419. }),
  420. smalltalk.ASTInterpreter);
  421. smalltalk.addMethod(
  422. "_visitDynamicArrayNode_",
  423. smalltalk.method({
  424. selector: "visitDynamicArrayNode:",
  425. fn: function (aNode){
  426. var self=this;
  427. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  428. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_(array);
  429. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  430. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  431. }),
  432. smalltalk.ASTInterpreter);
  433. smalltalk.addMethod(
  434. "_visitDynamicDictionaryNode_",
  435. smalltalk.method({
  436. selector: "visitDynamicDictionaryNode:",
  437. fn: function (aNode){
  438. var self=this;
  439. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  440. var hashedCollection;
  441. return smalltalk.withContext(function($ctx2) { hashedCollection=_st((smalltalk.HashedCollection || HashedCollection))._new();
  442. hashedCollection;
  443. _st(array)._do_((function(each){
  444. return smalltalk.withContext(function($ctx3) { return _st(hashedCollection)._add_(each);
  445. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  446. return _st(self)._continue_(hashedCollection);
  447. }, function($ctx2) {$ctx2.fillBlock({array:array,hashedCollection:hashedCollection},$ctx1)})}));
  448. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  449. }),
  450. smalltalk.ASTInterpreter);
  451. smalltalk.addMethod(
  452. "_visitJSStatementNode_",
  453. smalltalk.method({
  454. selector: "visitJSStatementNode:",
  455. fn: function (aNode){
  456. var self=this;
  457. return smalltalk.withContext(function($ctx1) { self["@shouldReturn"]=true;
  458. _st(self)._continue_(_st(self)._eval_(_st(aNode)._source()));
  459. return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  460. }),
  461. smalltalk.ASTInterpreter);
  462. smalltalk.addMethod(
  463. "_visitReturnNode_",
  464. smalltalk.method({
  465. selector: "visitReturnNode:",
  466. fn: function (aNode){
  467. var self=this;
  468. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(_st(aNode)._nodes())._first(),(function(value){
  469. return smalltalk.withContext(function($ctx2) { self["@shouldReturn"]=true;
  470. self["@shouldReturn"];
  471. return _st(self)._continue_(value);
  472. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  473. return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  474. }),
  475. smalltalk.ASTInterpreter);
  476. smalltalk.addMethod(
  477. "_visitSendNode_",
  478. smalltalk.method({
  479. selector: "visitSendNode:",
  480. fn: function (aNode){
  481. var self=this;
  482. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  483. return smalltalk.withContext(function($ctx2) { return _st(self)._messageFromSendNode_do_(aNode,(function(message){
  484. return smalltalk.withContext(function($ctx3) { _st(_st(self)._context())._pc_(_st(_st(_st(self)._context())._pc()).__plus((1)));
  485. return _st(self)._continue_(_st(message)._sendTo_(receiver));
  486. }, function($ctx3) {$ctx3.fillBlock({message:message},$ctx1)})}));
  487. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  488. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  489. }),
  490. smalltalk.ASTInterpreter);
  491. smalltalk.addMethod(
  492. "_visitSequenceNode_",
  493. smalltalk.method({
  494. selector: "visitSequenceNode:",
  495. fn: function (aNode){
  496. var self=this;
  497. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  498. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_(_st(array)._last());
  499. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  500. return self}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  501. }),
  502. smalltalk.ASTInterpreter);
  503. smalltalk.addMethod(
  504. "_visitValueNode_",
  505. smalltalk.method({
  506. selector: "visitValueNode:",
  507. fn: function (aNode){
  508. var self=this;
  509. return smalltalk.withContext(function($ctx1) { _st(self)._continue_(_st(aNode)._value());
  510. return self}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  511. }),
  512. smalltalk.ASTInterpreter);
  513. smalltalk.addClass('ASTDebugger', smalltalk.ASTInterpreter, ['continuation'], 'Compiler-Interpreter');
  514. smalltalk.addMethod(
  515. "_initialize",
  516. smalltalk.method({
  517. selector: "initialize",
  518. fn: function (){
  519. var self=this;
  520. return smalltalk.withContext(function($ctx1) { smalltalk.ASTInterpreter.fn.prototype._initialize.apply(_st(self), []);
  521. self["@continuation"]=(function(){
  522. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  523. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ASTDebugger)})}
  524. }),
  525. smalltalk.ASTDebugger);
  526. smalltalk.addMethod(
  527. "_interpret_continue_",
  528. smalltalk.method({
  529. selector: "interpret:continue:",
  530. fn: function (aNode,aBlock){
  531. var self=this;
  532. return smalltalk.withContext(function($ctx1) { self["@continuation"]=(function(){
  533. return smalltalk.withContext(function($ctx2) { return smalltalk.ASTInterpreter.fn.prototype._interpret_continue_.apply(_st(self), [aNode,aBlock]);
  534. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  535. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTDebugger)})}
  536. }),
  537. smalltalk.ASTDebugger);
  538. smalltalk.addMethod(
  539. "_stepOver",
  540. smalltalk.method({
  541. selector: "stepOver",
  542. fn: function (){
  543. var self=this;
  544. return smalltalk.withContext(function($ctx1) { _st(self["@continuation"])._value();
  545. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{}, smalltalk.ASTDebugger)})}
  546. }),
  547. smalltalk.ASTDebugger);