Compiler-Interpreter.deploy.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. smalltalk.addPackage('Compiler-Interpreter', {});
  2. smalltalk.addClass('AIContext', smalltalk.NodeVisitor, ['outerContext', 'pc', 'locals', '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=_st(self)._localAt_("self");
  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) { _st(self)._localAt_put_("self",anObject);
  136. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.AIContext)})}
  137. }),
  138. smalltalk.AIContext);
  139. smalltalk.addClass('ASTInterpreter', smalltalk.NodeVisitor, ['currentNode', 'context', 'shouldReturn', 'currentValue'], 'Compiler-Interpreter');
  140. smalltalk.addMethod(
  141. "_assign_to_",
  142. smalltalk.method({
  143. selector: "assign:to:",
  144. fn: function (aNode,anObject){
  145. var self=this;
  146. return smalltalk.withContext(function($ctx1) { var $2,$1;
  147. $2=_st(_st(aNode)._binding())._isInstanceVar();
  148. if(smalltalk.assert($2)){
  149. $1=_st(_st(_st(self)._context())._receiver())._instVarAt_put_(_st(aNode)._value(),anObject);
  150. } else {
  151. $1=_st(_st(self)._context())._localAt_put_(_st(aNode)._value(),anObject);
  152. };
  153. return $1;
  154. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject}, smalltalk.ASTInterpreter)})}
  155. }),
  156. smalltalk.ASTInterpreter);
  157. smalltalk.addMethod(
  158. "_context",
  159. smalltalk.method({
  160. selector: "context",
  161. fn: function (){
  162. var self=this;
  163. return smalltalk.withContext(function($ctx1) { var $2,$1;
  164. $2=self["@context"];
  165. if(($receiver = $2) == nil || $receiver == undefined){
  166. self["@context"]=_st((smalltalk.AIContext || AIContext))._new();
  167. $1=self["@context"];
  168. } else {
  169. $1=$2;
  170. };
  171. return $1;
  172. }, function($ctx1) {$ctx1.fill(self,"context",{}, smalltalk.ASTInterpreter)})}
  173. }),
  174. smalltalk.ASTInterpreter);
  175. smalltalk.addMethod(
  176. "_context_",
  177. smalltalk.method({
  178. selector: "context:",
  179. fn: function (anAIContext){
  180. var self=this;
  181. return smalltalk.withContext(function($ctx1) { self["@context"]=anAIContext;
  182. return self}, function($ctx1) {$ctx1.fill(self,"context:",{anAIContext:anAIContext}, smalltalk.ASTInterpreter)})}
  183. }),
  184. smalltalk.ASTInterpreter);
  185. smalltalk.addMethod(
  186. "_continue_",
  187. smalltalk.method({
  188. selector: "continue:",
  189. fn: function (anObject){
  190. var self=this;
  191. return smalltalk.withContext(function($ctx1) { self["@currentValue"]=anObject;
  192. return self}, function($ctx1) {$ctx1.fill(self,"continue:",{anObject:anObject}, smalltalk.ASTInterpreter)})}
  193. }),
  194. smalltalk.ASTInterpreter);
  195. smalltalk.addMethod(
  196. "_currentValue",
  197. smalltalk.method({
  198. selector: "currentValue",
  199. fn: function (){
  200. var self=this;
  201. return smalltalk.withContext(function($ctx1) { var $1;
  202. $1=self["@currentValue"];
  203. return $1;
  204. }, function($ctx1) {$ctx1.fill(self,"currentValue",{}, smalltalk.ASTInterpreter)})}
  205. }),
  206. smalltalk.ASTInterpreter);
  207. smalltalk.addMethod(
  208. "_eval_",
  209. smalltalk.method({
  210. selector: "eval:",
  211. fn: function (aString){
  212. var self=this;
  213. var source,function_;
  214. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  215. source=_st((smalltalk.String || String))._streamContents_((function(str){
  216. return smalltalk.withContext(function($ctx2) { _st(str)._nextPutAll_("(function(");
  217. _st(_st(_st(_st(self)._context())._locals())._keys())._do_separatedBy_((function(each){
  218. return smalltalk.withContext(function($ctx3) { return _st(str)._nextPutAll_(each);
  219. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  220. return smalltalk.withContext(function($ctx3) { return _st(str)._nextPutAll_(",");
  221. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  222. $1=str;
  223. _st($1)._nextPutAll_("){ return (function() {");
  224. _st($1)._nextPutAll_(aString);
  225. $2=_st($1)._nextPutAll_("})() })");
  226. return $2;
  227. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1)})}));
  228. function_=_st(_st((smalltalk.Compiler || Compiler))._new())._eval_(source);
  229. $3=_st(function_)._valueWithPossibleArguments_(_st(_st(_st(self)._context())._locals())._values());
  230. return $3;
  231. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_}, smalltalk.ASTInterpreter)})}
  232. }),
  233. smalltalk.ASTInterpreter);
  234. smalltalk.addMethod(
  235. "_initialize",
  236. smalltalk.method({
  237. selector: "initialize",
  238. fn: function (){
  239. var self=this;
  240. return smalltalk.withContext(function($ctx1) { smalltalk.NodeVisitor.fn.prototype._initialize.apply(_st(self), []);
  241. self["@shouldReturn"]=false;
  242. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ASTInterpreter)})}
  243. }),
  244. smalltalk.ASTInterpreter);
  245. smalltalk.addMethod(
  246. "_interpret_",
  247. smalltalk.method({
  248. selector: "interpret:",
  249. fn: function (aNode){
  250. var self=this;
  251. return smalltalk.withContext(function($ctx1) { self["@shouldReturn"]=false;
  252. _st(self)._interpret_continue_(aNode,(function(value){
  253. return smalltalk.withContext(function($ctx2) { self["@currentValue"]=value;
  254. return self["@currentValue"];
  255. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  256. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  257. }),
  258. smalltalk.ASTInterpreter);
  259. smalltalk.addMethod(
  260. "_interpret_continue_",
  261. smalltalk.method({
  262. selector: "interpret:continue:",
  263. fn: function (aNode,aBlock){
  264. var self=this;
  265. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  266. $1=self["@shouldReturn"];
  267. if(smalltalk.assert($1)){
  268. $2=self;
  269. return $2;
  270. };
  271. $3=_st(aNode)._isNode();
  272. if(smalltalk.assert($3)){
  273. _st(self)._visit_(aNode);
  274. } else {
  275. self["@currentValue"]=aNode;
  276. self["@currentValue"];
  277. };
  278. _st(aBlock)._value_(_st(self)._currentValue());
  279. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  280. }),
  281. smalltalk.ASTInterpreter);
  282. smalltalk.addMethod(
  283. "_interpretAll_continue_",
  284. smalltalk.method({
  285. selector: "interpretAll:continue:",
  286. fn: function (aCollection,aBlock){
  287. var self=this;
  288. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_result_(aCollection,aBlock,_st((smalltalk.OrderedCollection || OrderedCollection))._new());
  289. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:",{aCollection:aCollection,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  290. }),
  291. smalltalk.ASTInterpreter);
  292. smalltalk.addMethod(
  293. "_interpretAll_continue_result_",
  294. smalltalk.method({
  295. selector: "interpretAll:continue:result:",
  296. fn: function (nodes,aBlock,aCollection){
  297. var self=this;
  298. return smalltalk.withContext(function($ctx1) { var $1;
  299. $1=_st(nodes)._isEmpty();
  300. if(smalltalk.assert($1)){
  301. _st(aBlock)._value_(aCollection);
  302. } else {
  303. _st(self)._interpret_continue_(_st(nodes)._first(),(function(value){
  304. return smalltalk.withContext(function($ctx2) { return _st(self)._interpretAll_continue_result_(_st(nodes)._allButFirst(),aBlock,_st(aCollection).__comma([value]));
  305. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  306. };
  307. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:result:",{nodes:nodes,aBlock:aBlock,aCollection:aCollection}, smalltalk.ASTInterpreter)})}
  308. }),
  309. smalltalk.ASTInterpreter);
  310. smalltalk.addMethod(
  311. "_messageFromSendNode_do_",
  312. smalltalk.method({
  313. selector: "messageFromSendNode:do:",
  314. fn: function (aSendNode,aBlock){
  315. var self=this;
  316. return smalltalk.withContext(function($ctx1) { var $1,$2;
  317. _st(self)._interpretAll_continue_(_st(aSendNode)._arguments(),(function(args){
  318. return smalltalk.withContext(function($ctx2) { $1=_st((smalltalk.Message || Message))._new();
  319. _st($1)._selector_(_st(aSendNode)._selector());
  320. _st($1)._arguments_(args);
  321. $2=_st($1)._yourself();
  322. return _st(aBlock)._value_($2);
  323. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1)})}));
  324. return self}, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:do:",{aSendNode:aSendNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  325. }),
  326. smalltalk.ASTInterpreter);
  327. smalltalk.addMethod(
  328. "_visitAssignmentNode_",
  329. smalltalk.method({
  330. selector: "visitAssignmentNode:",
  331. fn: function (aNode){
  332. var self=this;
  333. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(aNode)._right(),(function(value){
  334. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_(_st(self)._assign_to_(_st(aNode)._left(),value));
  335. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  336. return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  337. }),
  338. smalltalk.ASTInterpreter);
  339. smalltalk.addMethod(
  340. "_visitBlockNode_",
  341. smalltalk.method({
  342. selector: "visitBlockNode:",
  343. fn: function (aNode){
  344. var self=this;
  345. return smalltalk.withContext(function($ctx1) { var $1,$2;
  346. _st(self)._continue_((function(){
  347. return smalltalk.withContext(function($ctx2) { $1=self;
  348. _st($1)._interpret_(_st(_st(aNode)._nodes())._first());
  349. $2=_st($1)._currentValue();
  350. return $2;
  351. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  352. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  353. }),
  354. smalltalk.ASTInterpreter);
  355. smalltalk.addMethod(
  356. "_visitCascadeNode_",
  357. smalltalk.method({
  358. selector: "visitCascadeNode:",
  359. fn: function (aNode){
  360. var self=this;
  361. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  362. return smalltalk.withContext(function($ctx2) { _st(_st(aNode)._nodes())._do_((function(each){
  363. return smalltalk.withContext(function($ctx3) { return _st(each)._receiver_(receiver);
  364. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  365. return _st(self)._interpretAll_continue_(_st(_st(aNode)._nodes())._allButLast(),(function(){
  366. return smalltalk.withContext(function($ctx3) { return _st(self)._interpret_continue_(_st(_st(aNode)._nodes())._last(),(function(val){
  367. return smalltalk.withContext(function($ctx4) { return _st(self)._continue_(val);
  368. }, function($ctx4) {$ctx4.fillBlock({val:val},$ctx1)})}));
  369. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  370. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  371. return self}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  372. }),
  373. smalltalk.ASTInterpreter);
  374. smalltalk.addMethod(
  375. "_visitClassReferenceNode_",
  376. smalltalk.method({
  377. selector: "visitClassReferenceNode:",
  378. fn: function (aNode){
  379. var self=this;
  380. return smalltalk.withContext(function($ctx1) { _st(self)._continue_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_(_st(aNode)._value()));
  381. return self}, function($ctx1) {$ctx1.fill(self,"visitClassReferenceNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  382. }),
  383. smalltalk.ASTInterpreter);
  384. smalltalk.addMethod(
  385. "_visitDynamicArrayNode_",
  386. smalltalk.method({
  387. selector: "visitDynamicArrayNode:",
  388. fn: function (aNode){
  389. var self=this;
  390. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  391. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_(array);
  392. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  393. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  394. }),
  395. smalltalk.ASTInterpreter);
  396. smalltalk.addMethod(
  397. "_visitDynamicDictionaryNode_",
  398. smalltalk.method({
  399. selector: "visitDynamicDictionaryNode:",
  400. fn: function (aNode){
  401. var self=this;
  402. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  403. var hashedCollection;
  404. return smalltalk.withContext(function($ctx2) { hashedCollection=_st((smalltalk.HashedCollection || HashedCollection))._new();
  405. hashedCollection;
  406. _st(array)._do_((function(each){
  407. return smalltalk.withContext(function($ctx3) { return _st(hashedCollection)._add_(each);
  408. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  409. return _st(self)._continue_(hashedCollection);
  410. }, function($ctx2) {$ctx2.fillBlock({array:array,hashedCollection:hashedCollection},$ctx1)})}));
  411. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  412. }),
  413. smalltalk.ASTInterpreter);
  414. smalltalk.addMethod(
  415. "_visitJSStatementNode_",
  416. smalltalk.method({
  417. selector: "visitJSStatementNode:",
  418. fn: function (aNode){
  419. var self=this;
  420. return smalltalk.withContext(function($ctx1) { self["@shouldReturn"]=true;
  421. _st(self)._continue_(_st(self)._eval_(_st(aNode)._source()));
  422. return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  423. }),
  424. smalltalk.ASTInterpreter);
  425. smalltalk.addMethod(
  426. "_visitReturnNode_",
  427. smalltalk.method({
  428. selector: "visitReturnNode:",
  429. fn: function (aNode){
  430. var self=this;
  431. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(_st(aNode)._nodes())._first(),(function(value){
  432. return smalltalk.withContext(function($ctx2) { self["@shouldReturn"]=true;
  433. self["@shouldReturn"];
  434. return _st(self)._continue_(value);
  435. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  436. return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  437. }),
  438. smalltalk.ASTInterpreter);
  439. smalltalk.addMethod(
  440. "_visitSendNode_",
  441. smalltalk.method({
  442. selector: "visitSendNode:",
  443. fn: function (aNode){
  444. var self=this;
  445. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  446. return smalltalk.withContext(function($ctx2) { return _st(self)._messageFromSendNode_do_(aNode,(function(message){
  447. return smalltalk.withContext(function($ctx3) { _st(_st(self)._context())._pc_(_st(_st(_st(self)._context())._pc()).__plus((1)));
  448. return _st(self)._continue_(_st(message)._sendTo_(receiver));
  449. }, function($ctx3) {$ctx3.fillBlock({message:message},$ctx1)})}));
  450. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  451. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  452. }),
  453. smalltalk.ASTInterpreter);
  454. smalltalk.addMethod(
  455. "_visitSequenceNode_",
  456. smalltalk.method({
  457. selector: "visitSequenceNode:",
  458. fn: function (aNode){
  459. var self=this;
  460. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  461. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_(_st(array)._last());
  462. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  463. return self}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  464. }),
  465. smalltalk.ASTInterpreter);
  466. smalltalk.addMethod(
  467. "_visitValueNode_",
  468. smalltalk.method({
  469. selector: "visitValueNode:",
  470. fn: function (aNode){
  471. var self=this;
  472. return smalltalk.withContext(function($ctx1) { _st(self)._continue_(_st(aNode)._value());
  473. return self}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  474. }),
  475. smalltalk.ASTInterpreter);
  476. smalltalk.addMethod(
  477. "_visitVariableNode_",
  478. smalltalk.method({
  479. selector: "visitVariableNode:",
  480. fn: function (aNode){
  481. var self=this;
  482. return smalltalk.withContext(function($ctx1) { var $1,$3,$2;
  483. $1=self;
  484. $3=_st(_st(aNode)._binding())._isInstanceVar();
  485. if(smalltalk.assert($3)){
  486. $2=_st(_st(_st(self)._context())._receiver())._instVarAt_(_st(aNode)._value());
  487. } else {
  488. $2=_st(_st(self)._context())._localAt_(_st(aNode)._value());
  489. };
  490. _st($1)._continue_($2);
  491. return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  492. }),
  493. smalltalk.ASTInterpreter);
  494. smalltalk.addClass('ASTDebugger', smalltalk.ASTInterpreter, ['continuation'], 'Compiler-Interpreter');
  495. smalltalk.addMethod(
  496. "_initialize",
  497. smalltalk.method({
  498. selector: "initialize",
  499. fn: function (){
  500. var self=this;
  501. return smalltalk.withContext(function($ctx1) { smalltalk.ASTInterpreter.fn.prototype._initialize.apply(_st(self), []);
  502. self["@continuation"]=(function(){
  503. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  504. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ASTDebugger)})}
  505. }),
  506. smalltalk.ASTDebugger);
  507. smalltalk.addMethod(
  508. "_interpret_continue_",
  509. smalltalk.method({
  510. selector: "interpret:continue:",
  511. fn: function (aNode,aBlock){
  512. var self=this;
  513. return smalltalk.withContext(function($ctx1) { self["@continuation"]=(function(){
  514. return smalltalk.withContext(function($ctx2) { return smalltalk.ASTInterpreter.fn.prototype._interpret_continue_.apply(_st(self), [aNode,aBlock]);
  515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  516. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTDebugger)})}
  517. }),
  518. smalltalk.ASTDebugger);
  519. smalltalk.addMethod(
  520. "_stepOver",
  521. smalltalk.method({
  522. selector: "stepOver",
  523. fn: function (){
  524. var self=this;
  525. return smalltalk.withContext(function($ctx1) { _st(self["@continuation"])._value();
  526. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{}, smalltalk.ASTDebugger)})}
  527. }),
  528. smalltalk.ASTDebugger);