Compiler-Interpreter.deploy.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805
  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.Object, ['currentNode', 'context', 'shouldReturn', 'result'], '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_value_",
  187. smalltalk.method({
  188. selector: "continue:value:",
  189. fn: function (aBlock,anObject){
  190. var self=this;
  191. return smalltalk.withContext(function($ctx1) { self["@result"]=anObject;
  192. _st(aBlock)._value_(anObject);
  193. return self}, function($ctx1) {$ctx1.fill(self,"continue:value:",{aBlock:aBlock,anObject:anObject}, smalltalk.ASTInterpreter)})}
  194. }),
  195. smalltalk.ASTInterpreter);
  196. smalltalk.addMethod(
  197. "_eval_",
  198. smalltalk.method({
  199. selector: "eval:",
  200. fn: function (aString){
  201. var self=this;
  202. var source,function_;
  203. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  204. source=_st((smalltalk.String || String))._streamContents_((function(str){
  205. return smalltalk.withContext(function($ctx2) { _st(str)._nextPutAll_("(function(");
  206. _st(_st(_st(_st(self)._context())._locals())._keys())._do_separatedBy_((function(each){
  207. return smalltalk.withContext(function($ctx3) { return _st(str)._nextPutAll_(each);
  208. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  209. return smalltalk.withContext(function($ctx3) { return _st(str)._nextPutAll_(",");
  210. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  211. $1=str;
  212. _st($1)._nextPutAll_("){ return (function() {");
  213. _st($1)._nextPutAll_(aString);
  214. $2=_st($1)._nextPutAll_("})() })");
  215. return $2;
  216. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1)})}));
  217. function_=_st(_st((smalltalk.Compiler || Compiler))._new())._eval_(source);
  218. $3=_st(function_)._valueWithPossibleArguments_(_st(_st(_st(self)._context())._locals())._values());
  219. return $3;
  220. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_}, smalltalk.ASTInterpreter)})}
  221. }),
  222. smalltalk.ASTInterpreter);
  223. smalltalk.addMethod(
  224. "_initialize",
  225. smalltalk.method({
  226. selector: "initialize",
  227. fn: function (){
  228. var self=this;
  229. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  230. self["@shouldReturn"]=false;
  231. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ASTInterpreter)})}
  232. }),
  233. smalltalk.ASTInterpreter);
  234. smalltalk.addMethod(
  235. "_interpret_",
  236. smalltalk.method({
  237. selector: "interpret:",
  238. fn: function (aNode){
  239. var self=this;
  240. return smalltalk.withContext(function($ctx1) { self["@shouldReturn"]=false;
  241. _st(self)._interpret_continue_(aNode,(function(value){
  242. return smalltalk.withContext(function($ctx2) { self["@result"]=value;
  243. return self["@result"];
  244. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  245. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  246. }),
  247. smalltalk.ASTInterpreter);
  248. smalltalk.addMethod(
  249. "_interpret_continue_",
  250. smalltalk.method({
  251. selector: "interpret:continue:",
  252. fn: function (aNode,aBlock){
  253. var self=this;
  254. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  255. $1=self["@shouldReturn"];
  256. if(smalltalk.assert($1)){
  257. $2=self;
  258. return $2;
  259. };
  260. $3=_st(aNode)._isNode();
  261. if(smalltalk.assert($3)){
  262. self["@currentNode"]=aNode;
  263. self["@currentNode"];
  264. _st(self)._interpretNode_continue_(aNode,(function(value){
  265. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_value_(aBlock,value);
  266. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  267. } else {
  268. _st(self)._continue_value_(aBlock,aNode);
  269. };
  270. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  271. }),
  272. smalltalk.ASTInterpreter);
  273. smalltalk.addMethod(
  274. "_interpretAll_continue_",
  275. smalltalk.method({
  276. selector: "interpretAll:continue:",
  277. fn: function (aCollection,aBlock){
  278. var self=this;
  279. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_result_(aCollection,aBlock,_st((smalltalk.OrderedCollection || OrderedCollection))._new());
  280. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:",{aCollection:aCollection,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  281. }),
  282. smalltalk.ASTInterpreter);
  283. smalltalk.addMethod(
  284. "_interpretAll_continue_result_",
  285. smalltalk.method({
  286. selector: "interpretAll:continue:result:",
  287. fn: function (nodes,aBlock,aCollection){
  288. var self=this;
  289. return smalltalk.withContext(function($ctx1) { var $1;
  290. $1=_st(nodes)._isEmpty();
  291. if(smalltalk.assert($1)){
  292. _st(aBlock)._value_(aCollection);
  293. } else {
  294. _st(self)._interpret_continue_(_st(nodes)._first(),(function(value){
  295. return smalltalk.withContext(function($ctx2) { return _st(self)._interpretAll_continue_result_(_st(nodes)._allButFirst(),aBlock,_st(aCollection).__comma([value]));
  296. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  297. };
  298. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:result:",{nodes:nodes,aBlock:aBlock,aCollection:aCollection}, smalltalk.ASTInterpreter)})}
  299. }),
  300. smalltalk.ASTInterpreter);
  301. smalltalk.addMethod(
  302. "_interpretAssignmentNode_continue_",
  303. smalltalk.method({
  304. selector: "interpretAssignmentNode:continue:",
  305. fn: function (aNode,aBlock){
  306. var self=this;
  307. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(aNode)._right(),(function(value){
  308. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_value_(aBlock,_st(self)._assign_to_(_st(aNode)._left(),value));
  309. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  310. return self}, function($ctx1) {$ctx1.fill(self,"interpretAssignmentNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  311. }),
  312. smalltalk.ASTInterpreter);
  313. smalltalk.addMethod(
  314. "_interpretBlockNode_continue_",
  315. smalltalk.method({
  316. selector: "interpretBlockNode:continue:",
  317. fn: function (aNode,aBlock){
  318. var self=this;
  319. return smalltalk.withContext(function($ctx1) { var $1,$2;
  320. _st(self)._continue_value_(aBlock,(function(){
  321. return smalltalk.withContext(function($ctx2) { $1=self;
  322. _st($1)._interpret_(_st(_st(aNode)._nodes())._first());
  323. $2=_st($1)._result();
  324. return $2;
  325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  326. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  327. }),
  328. smalltalk.ASTInterpreter);
  329. smalltalk.addMethod(
  330. "_interpretBlockSequenceNode_continue_",
  331. smalltalk.method({
  332. selector: "interpretBlockSequenceNode:continue:",
  333. fn: function (aNode,aBlock){
  334. var self=this;
  335. return smalltalk.withContext(function($ctx1) { _st(self)._interpretSequenceNode_continue_(aNode,aBlock);
  336. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockSequenceNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  337. }),
  338. smalltalk.ASTInterpreter);
  339. smalltalk.addMethod(
  340. "_interpretCascadeNode_continue_",
  341. smalltalk.method({
  342. selector: "interpretCascadeNode:continue:",
  343. fn: function (aNode,aBlock){
  344. var self=this;
  345. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  346. return smalltalk.withContext(function($ctx2) { _st(_st(aNode)._nodes())._do_((function(each){
  347. return smalltalk.withContext(function($ctx3) { return _st(each)._receiver_(receiver);
  348. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  349. return _st(self)._interpretAll_continue_(_st(_st(aNode)._nodes())._allButLast(),(function(){
  350. return smalltalk.withContext(function($ctx3) { return _st(self)._interpret_continue_(_st(_st(aNode)._nodes())._last(),(function(val){
  351. return smalltalk.withContext(function($ctx4) { return _st(self)._continue_value_(aBlock,val);
  352. }, function($ctx4) {$ctx4.fillBlock({val:val},$ctx1)})}));
  353. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  354. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  355. return self}, function($ctx1) {$ctx1.fill(self,"interpretCascadeNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  356. }),
  357. smalltalk.ASTInterpreter);
  358. smalltalk.addMethod(
  359. "_interpretClassReferenceNode_continue_",
  360. smalltalk.method({
  361. selector: "interpretClassReferenceNode:continue:",
  362. fn: function (aNode,aBlock){
  363. var self=this;
  364. return smalltalk.withContext(function($ctx1) { _st(self)._continue_value_(aBlock,_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_(_st(aNode)._value()));
  365. return self}, function($ctx1) {$ctx1.fill(self,"interpretClassReferenceNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  366. }),
  367. smalltalk.ASTInterpreter);
  368. smalltalk.addMethod(
  369. "_interpretDynamicArrayNode_continue_",
  370. smalltalk.method({
  371. selector: "interpretDynamicArrayNode:continue:",
  372. fn: function (aNode,aBlock){
  373. var self=this;
  374. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  375. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_value_(aBlock,array);
  376. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  377. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicArrayNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  378. }),
  379. smalltalk.ASTInterpreter);
  380. smalltalk.addMethod(
  381. "_interpretDynamicDictionaryNode_continue_",
  382. smalltalk.method({
  383. selector: "interpretDynamicDictionaryNode:continue:",
  384. fn: function (aNode,aBlock){
  385. var self=this;
  386. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  387. var hashedCollection;
  388. return smalltalk.withContext(function($ctx2) { hashedCollection=_st((smalltalk.HashedCollection || HashedCollection))._new();
  389. hashedCollection;
  390. _st(array)._do_((function(each){
  391. return smalltalk.withContext(function($ctx3) { return _st(hashedCollection)._add_(each);
  392. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  393. return _st(self)._continue_value_(aBlock,hashedCollection);
  394. }, function($ctx2) {$ctx2.fillBlock({array:array,hashedCollection:hashedCollection},$ctx1)})}));
  395. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicDictionaryNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  396. }),
  397. smalltalk.ASTInterpreter);
  398. smalltalk.addMethod(
  399. "_interpretJSStatementNode_continue_",
  400. smalltalk.method({
  401. selector: "interpretJSStatementNode:continue:",
  402. fn: function (aNode,aBlock){
  403. var self=this;
  404. return smalltalk.withContext(function($ctx1) { self["@shouldReturn"]=true;
  405. _st(self)._continue_value_(aBlock,_st(self)._eval_(_st(aNode)._source()));
  406. return self}, function($ctx1) {$ctx1.fill(self,"interpretJSStatementNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  407. }),
  408. smalltalk.ASTInterpreter);
  409. smalltalk.addMethod(
  410. "_interpretMethodNode_continue_",
  411. smalltalk.method({
  412. selector: "interpretMethodNode:continue:",
  413. fn: function (aNode,aBlock){
  414. var self=this;
  415. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  416. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_value_(aBlock,_st(array)._first());
  417. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  418. return self}, function($ctx1) {$ctx1.fill(self,"interpretMethodNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  419. }),
  420. smalltalk.ASTInterpreter);
  421. smalltalk.addMethod(
  422. "_interpretNode_continue_",
  423. smalltalk.method({
  424. selector: "interpretNode:continue:",
  425. fn: function (aNode,aBlock){
  426. var self=this;
  427. return smalltalk.withContext(function($ctx1) { _st(aNode)._interpreter_continue_(self,aBlock);
  428. return self}, function($ctx1) {$ctx1.fill(self,"interpretNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  429. }),
  430. smalltalk.ASTInterpreter);
  431. smalltalk.addMethod(
  432. "_interpretReturnNode_continue_",
  433. smalltalk.method({
  434. selector: "interpretReturnNode:continue:",
  435. fn: function (aNode,aBlock){
  436. var self=this;
  437. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(_st(aNode)._nodes())._first(),(function(value){
  438. return smalltalk.withContext(function($ctx2) { self["@shouldReturn"]=true;
  439. self["@shouldReturn"];
  440. return _st(self)._continue_value_(aBlock,value);
  441. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  442. return self}, function($ctx1) {$ctx1.fill(self,"interpretReturnNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  443. }),
  444. smalltalk.ASTInterpreter);
  445. smalltalk.addMethod(
  446. "_interpretSendNode_continue_",
  447. smalltalk.method({
  448. selector: "interpretSendNode:continue:",
  449. fn: function (aNode,aBlock){
  450. var self=this;
  451. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  452. return smalltalk.withContext(function($ctx2) { return _st(self)._messageFromSendNode_do_(aNode,(function(message){
  453. return smalltalk.withContext(function($ctx3) { _st(_st(self)._context())._pc_(_st(_st(_st(self)._context())._pc()).__plus((1)));
  454. return _st(self)._continue_value_(aBlock,_st(message)._sendTo_(receiver));
  455. }, function($ctx3) {$ctx3.fillBlock({message:message},$ctx1)})}));
  456. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  457. return self}, function($ctx1) {$ctx1.fill(self,"interpretSendNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  458. }),
  459. smalltalk.ASTInterpreter);
  460. smalltalk.addMethod(
  461. "_interpretSequenceNode_continue_",
  462. smalltalk.method({
  463. selector: "interpretSequenceNode:continue:",
  464. fn: function (aNode,aBlock){
  465. var self=this;
  466. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  467. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_value_(aBlock,_st(array)._last());
  468. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  469. return self}, function($ctx1) {$ctx1.fill(self,"interpretSequenceNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  470. }),
  471. smalltalk.ASTInterpreter);
  472. smalltalk.addMethod(
  473. "_interpretValueNode_continue_",
  474. smalltalk.method({
  475. selector: "interpretValueNode:continue:",
  476. fn: function (aNode,aBlock){
  477. var self=this;
  478. return smalltalk.withContext(function($ctx1) { _st(self)._continue_value_(aBlock,_st(aNode)._value());
  479. return self}, function($ctx1) {$ctx1.fill(self,"interpretValueNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  480. }),
  481. smalltalk.ASTInterpreter);
  482. smalltalk.addMethod(
  483. "_interpretVariableNode_continue_",
  484. smalltalk.method({
  485. selector: "interpretVariableNode:continue:",
  486. fn: function (aNode,aBlock){
  487. var self=this;
  488. return smalltalk.withContext(function($ctx1) { var $1,$2,$4,$3;
  489. $1=self;
  490. $2=aBlock;
  491. $4=_st(_st(aNode)._binding())._isInstanceVar();
  492. if(smalltalk.assert($4)){
  493. $3=_st(_st(_st(self)._context())._receiver())._instVarAt_(_st(aNode)._value());
  494. } else {
  495. $3=_st(_st(self)._context())._localAt_(_st(aNode)._value());
  496. };
  497. _st($1)._continue_value_($2,$3);
  498. return self}, function($ctx1) {$ctx1.fill(self,"interpretVariableNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  499. }),
  500. smalltalk.ASTInterpreter);
  501. smalltalk.addMethod(
  502. "_messageFromSendNode_do_",
  503. smalltalk.method({
  504. selector: "messageFromSendNode:do:",
  505. fn: function (aSendNode,aBlock){
  506. var self=this;
  507. return smalltalk.withContext(function($ctx1) { var $1,$2;
  508. _st(self)._interpretAll_continue_(_st(aSendNode)._arguments(),(function(args){
  509. return smalltalk.withContext(function($ctx2) { $1=_st((smalltalk.Message || Message))._new();
  510. _st($1)._selector_(_st(aSendNode)._selector());
  511. _st($1)._arguments_(args);
  512. $2=_st($1)._yourself();
  513. return _st(aBlock)._value_($2);
  514. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1)})}));
  515. return self}, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:do:",{aSendNode:aSendNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  516. }),
  517. smalltalk.ASTInterpreter);
  518. smalltalk.addMethod(
  519. "_result",
  520. smalltalk.method({
  521. selector: "result",
  522. fn: function (){
  523. var self=this;
  524. return smalltalk.withContext(function($ctx1) { var $1;
  525. $1=self["@result"];
  526. return $1;
  527. }, function($ctx1) {$ctx1.fill(self,"result",{}, smalltalk.ASTInterpreter)})}
  528. }),
  529. smalltalk.ASTInterpreter);
  530. smalltalk.addClass('ASTDebugger', smalltalk.ASTInterpreter, ['continuation'], 'Compiler-Interpreter');
  531. smalltalk.addMethod(
  532. "_initialize",
  533. smalltalk.method({
  534. selector: "initialize",
  535. fn: function (){
  536. var self=this;
  537. return smalltalk.withContext(function($ctx1) { smalltalk.ASTInterpreter.fn.prototype._initialize.apply(_st(self), []);
  538. self["@continuation"]=(function(){
  539. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  540. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ASTDebugger)})}
  541. }),
  542. smalltalk.ASTDebugger);
  543. smalltalk.addMethod(
  544. "_interpret_continue_",
  545. smalltalk.method({
  546. selector: "interpret:continue:",
  547. fn: function (aNode,aBlock){
  548. var self=this;
  549. return smalltalk.withContext(function($ctx1) { self["@continuation"]=(function(){
  550. return smalltalk.withContext(function($ctx2) { return smalltalk.ASTInterpreter.fn.prototype._interpret_continue_.apply(_st(self), [aNode,aBlock]);
  551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  552. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTDebugger)})}
  553. }),
  554. smalltalk.ASTDebugger);
  555. smalltalk.addMethod(
  556. "_stepOver",
  557. smalltalk.method({
  558. selector: "stepOver",
  559. fn: function (){
  560. var self=this;
  561. return smalltalk.withContext(function($ctx1) { _st(self["@continuation"])._value();
  562. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{}, smalltalk.ASTDebugger)})}
  563. }),
  564. smalltalk.ASTDebugger);
  565. smalltalk.addMethod(
  566. "_interpreter_continue_",
  567. smalltalk.method({
  568. selector: "interpreter:continue:",
  569. fn: function (anInterpreter,aBlock){
  570. var self=this;
  571. return smalltalk.withContext(function($ctx1) { var $1;
  572. $1=_st(anInterpreter)._interpretNode_continue_(self,aBlock);
  573. return $1;
  574. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.Node)})}
  575. }),
  576. smalltalk.Node);
  577. smalltalk.addMethod(
  578. "_interpreter_continue_",
  579. smalltalk.method({
  580. selector: "interpreter:continue:",
  581. fn: function (anInterpreter,aBlock){
  582. var self=this;
  583. return smalltalk.withContext(function($ctx1) { var $1;
  584. $1=_st(anInterpreter)._interpretAssignmentNode_continue_(self,aBlock);
  585. return $1;
  586. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.AssignmentNode)})}
  587. }),
  588. smalltalk.AssignmentNode);
  589. smalltalk.addMethod(
  590. "_interpreter_continue_",
  591. smalltalk.method({
  592. selector: "interpreter:continue:",
  593. fn: function (anInterpreter,aBlock){
  594. var self=this;
  595. return smalltalk.withContext(function($ctx1) { var $1;
  596. $1=_st(anInterpreter)._interpretBlockNode_continue_(self,aBlock);
  597. return $1;
  598. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.BlockNode)})}
  599. }),
  600. smalltalk.BlockNode);
  601. smalltalk.addMethod(
  602. "_interpreter_continue_",
  603. smalltalk.method({
  604. selector: "interpreter:continue:",
  605. fn: function (anInterpreter,aBlock){
  606. var self=this;
  607. return smalltalk.withContext(function($ctx1) { var $1;
  608. $1=_st(anInterpreter)._interpretCascadeNode_continue_(self,aBlock);
  609. return $1;
  610. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.CascadeNode)})}
  611. }),
  612. smalltalk.CascadeNode);
  613. smalltalk.addMethod(
  614. "_interpreter_continue_",
  615. smalltalk.method({
  616. selector: "interpreter:continue:",
  617. fn: function (anInterpreter,aBlock){
  618. var self=this;
  619. return smalltalk.withContext(function($ctx1) { var $1;
  620. $1=_st(anInterpreter)._interpretDynamicArrayNode_continue_(self,aBlock);
  621. return $1;
  622. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.DynamicArrayNode)})}
  623. }),
  624. smalltalk.DynamicArrayNode);
  625. smalltalk.addMethod(
  626. "_interpreter_continue_",
  627. smalltalk.method({
  628. selector: "interpreter:continue:",
  629. fn: function (anInterpreter,aBlock){
  630. var self=this;
  631. return smalltalk.withContext(function($ctx1) { var $1;
  632. $1=_st(anInterpreter)._interpretDynamicDictionaryNode_continue_(self,aBlock);
  633. return $1;
  634. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.DynamicDictionaryNode)})}
  635. }),
  636. smalltalk.DynamicDictionaryNode);
  637. smalltalk.addMethod(
  638. "_interpreter_continue_",
  639. smalltalk.method({
  640. selector: "interpreter:continue:",
  641. fn: function (anInterpreter,aBlock){
  642. var self=this;
  643. return smalltalk.withContext(function($ctx1) { var $1;
  644. $1=_st(anInterpreter)._interpretJSStatementNode_continue_(self,aBlock);
  645. return $1;
  646. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.JSStatementNode)})}
  647. }),
  648. smalltalk.JSStatementNode);
  649. smalltalk.addMethod(
  650. "_interpreter_continue_",
  651. smalltalk.method({
  652. selector: "interpreter:continue:",
  653. fn: function (anInterpreter,aBlock){
  654. var self=this;
  655. return smalltalk.withContext(function($ctx1) { var $1;
  656. $1=_st(anInterpreter)._interpretMethodNode_continue_(self,aBlock);
  657. return $1;
  658. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.MethodNode)})}
  659. }),
  660. smalltalk.MethodNode);
  661. smalltalk.addMethod(
  662. "_interpreter_continue_",
  663. smalltalk.method({
  664. selector: "interpreter:continue:",
  665. fn: function (anInterpreter,aBlock){
  666. var self=this;
  667. return smalltalk.withContext(function($ctx1) { var $1;
  668. $1=_st(anInterpreter)._interpretReturnNode_continue_(self,aBlock);
  669. return $1;
  670. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.ReturnNode)})}
  671. }),
  672. smalltalk.ReturnNode);
  673. smalltalk.addMethod(
  674. "_interpreter_continue_",
  675. smalltalk.method({
  676. selector: "interpreter:continue:",
  677. fn: function (anInterpreter,aBlock){
  678. var self=this;
  679. return smalltalk.withContext(function($ctx1) { var $1;
  680. $1=_st(anInterpreter)._interpretSendNode_continue_(self,aBlock);
  681. return $1;
  682. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.SendNode)})}
  683. }),
  684. smalltalk.SendNode);
  685. smalltalk.addMethod(
  686. "_interpreter_continue_",
  687. smalltalk.method({
  688. selector: "interpreter:continue:",
  689. fn: function (anInterpreter,aBlock){
  690. var self=this;
  691. return smalltalk.withContext(function($ctx1) { var $1;
  692. $1=_st(anInterpreter)._interpretSequenceNode_continue_(self,aBlock);
  693. return $1;
  694. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.SequenceNode)})}
  695. }),
  696. smalltalk.SequenceNode);
  697. smalltalk.addMethod(
  698. "_interpreter_continue_",
  699. smalltalk.method({
  700. selector: "interpreter:continue:",
  701. fn: function (anInterpreter,aBlock){
  702. var self=this;
  703. return smalltalk.withContext(function($ctx1) { var $1;
  704. $1=_st(anInterpreter)._interpretBlockSequenceNode_continue_(self,aBlock);
  705. return $1;
  706. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.BlockSequenceNode)})}
  707. }),
  708. smalltalk.BlockSequenceNode);
  709. smalltalk.addMethod(
  710. "_interpreter_continue_",
  711. smalltalk.method({
  712. selector: "interpreter:continue:",
  713. fn: function (anInterpreter,aBlock){
  714. var self=this;
  715. return smalltalk.withContext(function($ctx1) { var $1;
  716. $1=_st(anInterpreter)._interpretValueNode_continue_(self,aBlock);
  717. return $1;
  718. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.ValueNode)})}
  719. }),
  720. smalltalk.ValueNode);
  721. smalltalk.addMethod(
  722. "_interpreter_continue_",
  723. smalltalk.method({
  724. selector: "interpreter:continue:",
  725. fn: function (anInterpreter,aBlock){
  726. var self=this;
  727. return smalltalk.withContext(function($ctx1) { var $1;
  728. $1=_st(anInterpreter)._interpretVariableNode_continue_(self,aBlock);
  729. return $1;
  730. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.VariableNode)})}
  731. }),
  732. smalltalk.VariableNode);
  733. smalltalk.addMethod(
  734. "_interpreter_continue_",
  735. smalltalk.method({
  736. selector: "interpreter:continue:",
  737. fn: function (anInterpreter,aBlock){
  738. var self=this;
  739. return smalltalk.withContext(function($ctx1) { var $1;
  740. $1=_st(anInterpreter)._interpretClassReferenceNode_continue_(self,aBlock);
  741. return $1;
  742. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.ClassReferenceNode)})}
  743. }),
  744. smalltalk.ClassReferenceNode);