1
0

Compiler-Interpreter.deploy.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818
  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. "_currentNode",
  198. smalltalk.method({
  199. selector: "currentNode",
  200. fn: function (){
  201. var self=this;
  202. return smalltalk.withContext(function($ctx1) { var $1;
  203. $1=self["@currentNode"];
  204. return $1;
  205. }, function($ctx1) {$ctx1.fill(self,"currentNode",{}, smalltalk.ASTInterpreter)})}
  206. }),
  207. smalltalk.ASTInterpreter);
  208. smalltalk.addMethod(
  209. "_eval_",
  210. smalltalk.method({
  211. selector: "eval:",
  212. fn: function (aString){
  213. var self=this;
  214. var source,function_;
  215. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  216. source=_st((smalltalk.String || String))._streamContents_((function(str){
  217. return smalltalk.withContext(function($ctx2) { _st(str)._nextPutAll_("(function(");
  218. _st(_st(_st(_st(self)._context())._locals())._keys())._do_separatedBy_((function(each){
  219. return smalltalk.withContext(function($ctx3) { return _st(str)._nextPutAll_(each);
  220. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  221. return smalltalk.withContext(function($ctx3) { return _st(str)._nextPutAll_(",");
  222. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  223. $1=str;
  224. _st($1)._nextPutAll_("){ return (function() {");
  225. _st($1)._nextPutAll_(aString);
  226. $2=_st($1)._nextPutAll_("})() })");
  227. return $2;
  228. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1)})}));
  229. function_=_st(_st((smalltalk.Compiler || Compiler))._new())._eval_(source);
  230. $3=_st(function_)._valueWithPossibleArguments_(_st(_st(_st(self)._context())._locals())._values());
  231. return $3;
  232. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_}, smalltalk.ASTInterpreter)})}
  233. }),
  234. smalltalk.ASTInterpreter);
  235. smalltalk.addMethod(
  236. "_initialize",
  237. smalltalk.method({
  238. selector: "initialize",
  239. fn: function (){
  240. var self=this;
  241. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  242. self["@shouldReturn"]=false;
  243. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ASTInterpreter)})}
  244. }),
  245. smalltalk.ASTInterpreter);
  246. smalltalk.addMethod(
  247. "_interpret_",
  248. smalltalk.method({
  249. selector: "interpret:",
  250. fn: function (aNode){
  251. var self=this;
  252. return smalltalk.withContext(function($ctx1) { self["@shouldReturn"]=false;
  253. _st(self)._interpret_continue_(aNode,(function(value){
  254. return smalltalk.withContext(function($ctx2) { self["@result"]=value;
  255. return self["@result"];
  256. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  257. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode}, smalltalk.ASTInterpreter)})}
  258. }),
  259. smalltalk.ASTInterpreter);
  260. smalltalk.addMethod(
  261. "_interpret_continue_",
  262. smalltalk.method({
  263. selector: "interpret:continue:",
  264. fn: function (aNode,aBlock){
  265. var self=this;
  266. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  267. $1=self["@shouldReturn"];
  268. if(smalltalk.assert($1)){
  269. $2=self;
  270. return $2;
  271. };
  272. $3=_st(aNode)._isNode();
  273. if(smalltalk.assert($3)){
  274. self["@currentNode"]=aNode;
  275. self["@currentNode"];
  276. _st(self)._interpretNode_continue_(aNode,(function(value){
  277. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_value_(aBlock,value);
  278. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  279. } else {
  280. _st(self)._continue_value_(aBlock,aNode);
  281. };
  282. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  283. }),
  284. smalltalk.ASTInterpreter);
  285. smalltalk.addMethod(
  286. "_interpretAll_continue_",
  287. smalltalk.method({
  288. selector: "interpretAll:continue:",
  289. fn: function (aCollection,aBlock){
  290. var self=this;
  291. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_result_(aCollection,aBlock,_st((smalltalk.OrderedCollection || OrderedCollection))._new());
  292. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:",{aCollection:aCollection,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  293. }),
  294. smalltalk.ASTInterpreter);
  295. smalltalk.addMethod(
  296. "_interpretAll_continue_result_",
  297. smalltalk.method({
  298. selector: "interpretAll:continue:result:",
  299. fn: function (nodes,aBlock,aCollection){
  300. var self=this;
  301. return smalltalk.withContext(function($ctx1) { var $1;
  302. $1=_st(nodes)._isEmpty();
  303. if(smalltalk.assert($1)){
  304. _st(self)._continue_value_(aBlock,aCollection);
  305. } else {
  306. _st(self)._interpret_continue_(_st(nodes)._first(),(function(value){
  307. return smalltalk.withContext(function($ctx2) { return _st(self)._interpretAll_continue_result_(_st(nodes)._allButFirst(),aBlock,_st(aCollection).__comma([value]));
  308. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  309. };
  310. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:result:",{nodes:nodes,aBlock:aBlock,aCollection:aCollection}, smalltalk.ASTInterpreter)})}
  311. }),
  312. smalltalk.ASTInterpreter);
  313. smalltalk.addMethod(
  314. "_interpretAssignmentNode_continue_",
  315. smalltalk.method({
  316. selector: "interpretAssignmentNode:continue:",
  317. fn: function (aNode,aBlock){
  318. var self=this;
  319. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(aNode)._right(),(function(value){
  320. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_value_(aBlock,_st(self)._assign_to_(_st(aNode)._left(),value));
  321. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  322. return self}, function($ctx1) {$ctx1.fill(self,"interpretAssignmentNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  323. }),
  324. smalltalk.ASTInterpreter);
  325. smalltalk.addMethod(
  326. "_interpretBlockNode_continue_",
  327. smalltalk.method({
  328. selector: "interpretBlockNode:continue:",
  329. fn: function (aNode,aBlock){
  330. var self=this;
  331. return smalltalk.withContext(function($ctx1) { var $1,$2;
  332. _st(self)._continue_value_(aBlock,(function(){
  333. return smalltalk.withContext(function($ctx2) { $1=self;
  334. _st($1)._interpret_(_st(_st(aNode)._nodes())._first());
  335. $2=_st($1)._result();
  336. return $2;
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  338. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  339. }),
  340. smalltalk.ASTInterpreter);
  341. smalltalk.addMethod(
  342. "_interpretBlockSequenceNode_continue_",
  343. smalltalk.method({
  344. selector: "interpretBlockSequenceNode:continue:",
  345. fn: function (aNode,aBlock){
  346. var self=this;
  347. return smalltalk.withContext(function($ctx1) { _st(self)._interpretSequenceNode_continue_(aNode,aBlock);
  348. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockSequenceNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  349. }),
  350. smalltalk.ASTInterpreter);
  351. smalltalk.addMethod(
  352. "_interpretCascadeNode_continue_",
  353. smalltalk.method({
  354. selector: "interpretCascadeNode:continue:",
  355. fn: function (aNode,aBlock){
  356. var self=this;
  357. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  358. return smalltalk.withContext(function($ctx2) { _st(_st(aNode)._nodes())._do_((function(each){
  359. return smalltalk.withContext(function($ctx3) { return _st(each)._receiver_(receiver);
  360. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  361. return _st(self)._interpretAll_continue_(_st(_st(aNode)._nodes())._allButLast(),(function(){
  362. return smalltalk.withContext(function($ctx3) { return _st(self)._interpret_continue_(_st(_st(aNode)._nodes())._last(),(function(val){
  363. return smalltalk.withContext(function($ctx4) { return _st(self)._continue_value_(aBlock,val);
  364. }, function($ctx4) {$ctx4.fillBlock({val:val},$ctx1)})}));
  365. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  366. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  367. return self}, function($ctx1) {$ctx1.fill(self,"interpretCascadeNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  368. }),
  369. smalltalk.ASTInterpreter);
  370. smalltalk.addMethod(
  371. "_interpretClassReferenceNode_continue_",
  372. smalltalk.method({
  373. selector: "interpretClassReferenceNode:continue:",
  374. fn: function (aNode,aBlock){
  375. var self=this;
  376. return smalltalk.withContext(function($ctx1) { _st(self)._continue_value_(aBlock,_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_(_st(aNode)._value()));
  377. return self}, function($ctx1) {$ctx1.fill(self,"interpretClassReferenceNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  378. }),
  379. smalltalk.ASTInterpreter);
  380. smalltalk.addMethod(
  381. "_interpretDynamicArrayNode_continue_",
  382. smalltalk.method({
  383. selector: "interpretDynamicArrayNode: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. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_value_(aBlock,array);
  388. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  389. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicArrayNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  390. }),
  391. smalltalk.ASTInterpreter);
  392. smalltalk.addMethod(
  393. "_interpretDynamicDictionaryNode_continue_",
  394. smalltalk.method({
  395. selector: "interpretDynamicDictionaryNode:continue:",
  396. fn: function (aNode,aBlock){
  397. var self=this;
  398. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  399. var hashedCollection;
  400. return smalltalk.withContext(function($ctx2) { hashedCollection=_st((smalltalk.HashedCollection || HashedCollection))._new();
  401. hashedCollection;
  402. _st(array)._do_((function(each){
  403. return smalltalk.withContext(function($ctx3) { return _st(hashedCollection)._add_(each);
  404. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  405. return _st(self)._continue_value_(aBlock,hashedCollection);
  406. }, function($ctx2) {$ctx2.fillBlock({array:array,hashedCollection:hashedCollection},$ctx1)})}));
  407. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicDictionaryNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  408. }),
  409. smalltalk.ASTInterpreter);
  410. smalltalk.addMethod(
  411. "_interpretJSStatementNode_continue_",
  412. smalltalk.method({
  413. selector: "interpretJSStatementNode:continue:",
  414. fn: function (aNode,aBlock){
  415. var self=this;
  416. return smalltalk.withContext(function($ctx1) { self["@shouldReturn"]=true;
  417. _st(self)._continue_value_(aBlock,_st(self)._eval_(_st(aNode)._source()));
  418. return self}, function($ctx1) {$ctx1.fill(self,"interpretJSStatementNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  419. }),
  420. smalltalk.ASTInterpreter);
  421. smalltalk.addMethod(
  422. "_interpretMethodNode_continue_",
  423. smalltalk.method({
  424. selector: "interpretMethodNode:continue:",
  425. fn: function (aNode,aBlock){
  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_value_(aBlock,_st(array)._first());
  429. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  430. return self}, function($ctx1) {$ctx1.fill(self,"interpretMethodNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  431. }),
  432. smalltalk.ASTInterpreter);
  433. smalltalk.addMethod(
  434. "_interpretNode_continue_",
  435. smalltalk.method({
  436. selector: "interpretNode:continue:",
  437. fn: function (aNode,aBlock){
  438. var self=this;
  439. return smalltalk.withContext(function($ctx1) { _st(aNode)._interpreter_continue_(self,aBlock);
  440. return self}, function($ctx1) {$ctx1.fill(self,"interpretNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  441. }),
  442. smalltalk.ASTInterpreter);
  443. smalltalk.addMethod(
  444. "_interpretReturnNode_continue_",
  445. smalltalk.method({
  446. selector: "interpretReturnNode:continue:",
  447. fn: function (aNode,aBlock){
  448. var self=this;
  449. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(_st(aNode)._nodes())._first(),(function(value){
  450. return smalltalk.withContext(function($ctx2) { self["@shouldReturn"]=true;
  451. self["@shouldReturn"];
  452. return _st(self)._continue_value_(aBlock,value);
  453. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  454. return self}, function($ctx1) {$ctx1.fill(self,"interpretReturnNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  455. }),
  456. smalltalk.ASTInterpreter);
  457. smalltalk.addMethod(
  458. "_interpretSendNode_continue_",
  459. smalltalk.method({
  460. selector: "interpretSendNode:continue:",
  461. fn: function (aNode,aBlock){
  462. var self=this;
  463. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  464. return smalltalk.withContext(function($ctx2) { return _st(self)._interpretAll_continue_(_st(aNode)._arguments(),(function(args){
  465. return smalltalk.withContext(function($ctx3) { return _st(self)._messageFromSendNode_arguments_do_(aNode,args,(function(message){
  466. return smalltalk.withContext(function($ctx4) { _st(_st(self)._context())._pc_(_st(_st(_st(self)._context())._pc()).__plus((1)));
  467. return _st(self)._continue_value_(aBlock,_st(message)._sendTo_(receiver));
  468. }, function($ctx4) {$ctx4.fillBlock({message:message},$ctx1)})}));
  469. }, function($ctx3) {$ctx3.fillBlock({args:args},$ctx1)})}));
  470. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  471. return self}, function($ctx1) {$ctx1.fill(self,"interpretSendNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  472. }),
  473. smalltalk.ASTInterpreter);
  474. smalltalk.addMethod(
  475. "_interpretSequenceNode_continue_",
  476. smalltalk.method({
  477. selector: "interpretSequenceNode:continue:",
  478. fn: function (aNode,aBlock){
  479. var self=this;
  480. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  481. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_value_(aBlock,_st(array)._last());
  482. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  483. return self}, function($ctx1) {$ctx1.fill(self,"interpretSequenceNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  484. }),
  485. smalltalk.ASTInterpreter);
  486. smalltalk.addMethod(
  487. "_interpretValueNode_continue_",
  488. smalltalk.method({
  489. selector: "interpretValueNode:continue:",
  490. fn: function (aNode,aBlock){
  491. var self=this;
  492. return smalltalk.withContext(function($ctx1) { _st(self)._continue_value_(aBlock,_st(aNode)._value());
  493. return self}, function($ctx1) {$ctx1.fill(self,"interpretValueNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  494. }),
  495. smalltalk.ASTInterpreter);
  496. smalltalk.addMethod(
  497. "_interpretVariableNode_continue_",
  498. smalltalk.method({
  499. selector: "interpretVariableNode:continue:",
  500. fn: function (aNode,aBlock){
  501. var self=this;
  502. return smalltalk.withContext(function($ctx1) { var $1,$2,$4,$3;
  503. $1=self;
  504. $2=aBlock;
  505. $4=_st(_st(aNode)._binding())._isInstanceVar();
  506. if(smalltalk.assert($4)){
  507. $3=_st(_st(_st(self)._context())._receiver())._instVarAt_(_st(aNode)._value());
  508. } else {
  509. $3=_st(_st(self)._context())._localAt_(_st(aNode)._value());
  510. };
  511. _st($1)._continue_value_($2,$3);
  512. return self}, function($ctx1) {$ctx1.fill(self,"interpretVariableNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  513. }),
  514. smalltalk.ASTInterpreter);
  515. smalltalk.addMethod(
  516. "_messageFromSendNode_arguments_do_",
  517. smalltalk.method({
  518. selector: "messageFromSendNode:arguments:do:",
  519. fn: function (aSendNode,aCollection,aBlock){
  520. var self=this;
  521. return smalltalk.withContext(function($ctx1) { var $1,$2;
  522. $1=_st((smalltalk.Message || Message))._new();
  523. _st($1)._selector_(_st(aSendNode)._selector());
  524. _st($1)._arguments_(aCollection);
  525. $2=_st($1)._yourself();
  526. _st(self)._continue_value_(aBlock,$2);
  527. return self}, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:do:",{aSendNode:aSendNode,aCollection:aCollection,aBlock:aBlock}, smalltalk.ASTInterpreter)})}
  528. }),
  529. smalltalk.ASTInterpreter);
  530. smalltalk.addMethod(
  531. "_result",
  532. smalltalk.method({
  533. selector: "result",
  534. fn: function (){
  535. var self=this;
  536. return smalltalk.withContext(function($ctx1) { var $1;
  537. $1=self["@result"];
  538. return $1;
  539. }, function($ctx1) {$ctx1.fill(self,"result",{}, smalltalk.ASTInterpreter)})}
  540. }),
  541. smalltalk.ASTInterpreter);
  542. smalltalk.addClass('ASTSteppingInterpreter', smalltalk.ASTInterpreter, ['continuation'], 'Compiler-Interpreter');
  543. smalltalk.addMethod(
  544. "_initialize",
  545. smalltalk.method({
  546. selector: "initialize",
  547. fn: function (){
  548. var self=this;
  549. return smalltalk.withContext(function($ctx1) { smalltalk.ASTInterpreter.fn.prototype._initialize.apply(_st(self), []);
  550. self["@continuation"]=(function(){
  551. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  552. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ASTDebugger)})}
  553. }),
  554. smalltalk.ASTSteppingInterpreter);
  555. smalltalk.addMethod(
  556. "_interpret_continue_",
  557. smalltalk.method({
  558. selector: "interpret:continue:",
  559. fn: function (aNode,aBlock){
  560. var self=this;
  561. return smalltalk.withContext(function($ctx1) { self["@continuation"]=(function(){
  562. return smalltalk.withContext(function($ctx2) { return smalltalk.ASTInterpreter.fn.prototype._interpret_continue_.apply(_st(self), [aNode,aBlock]);
  563. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  564. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTDebugger)})}
  565. }),
  566. smalltalk.ASTSteppingInterpreter);
  567. smalltalk.addMethod(
  568. "_step",
  569. smalltalk.method({
  570. selector: "step",
  571. fn: function (){
  572. var self=this;
  573. return smalltalk.withContext(function($ctx1) { _st(self["@continuation"])._value();
  574. return self}, function($ctx1) {$ctx1.fill(self,"step",{}, smalltalk.ASTDebugger)})}
  575. }),
  576. smalltalk.ASTSteppingInterpreter);
  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)._interpretNode_continue_(self,aBlock);
  585. return $1;
  586. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.Node)})}
  587. }),
  588. smalltalk.Node);
  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)._interpretAssignmentNode_continue_(self,aBlock);
  597. return $1;
  598. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.AssignmentNode)})}
  599. }),
  600. smalltalk.AssignmentNode);
  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)._interpretBlockNode_continue_(self,aBlock);
  609. return $1;
  610. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.BlockNode)})}
  611. }),
  612. smalltalk.BlockNode);
  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)._interpretCascadeNode_continue_(self,aBlock);
  621. return $1;
  622. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.CascadeNode)})}
  623. }),
  624. smalltalk.CascadeNode);
  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)._interpretDynamicArrayNode_continue_(self,aBlock);
  633. return $1;
  634. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.DynamicArrayNode)})}
  635. }),
  636. smalltalk.DynamicArrayNode);
  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)._interpretDynamicDictionaryNode_continue_(self,aBlock);
  645. return $1;
  646. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.DynamicDictionaryNode)})}
  647. }),
  648. smalltalk.DynamicDictionaryNode);
  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)._interpretJSStatementNode_continue_(self,aBlock);
  657. return $1;
  658. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.JSStatementNode)})}
  659. }),
  660. smalltalk.JSStatementNode);
  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)._interpretMethodNode_continue_(self,aBlock);
  669. return $1;
  670. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.MethodNode)})}
  671. }),
  672. smalltalk.MethodNode);
  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)._interpretReturnNode_continue_(self,aBlock);
  681. return $1;
  682. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.ReturnNode)})}
  683. }),
  684. smalltalk.ReturnNode);
  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)._interpretSendNode_continue_(self,aBlock);
  693. return $1;
  694. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.SendNode)})}
  695. }),
  696. smalltalk.SendNode);
  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)._interpretSequenceNode_continue_(self,aBlock);
  705. return $1;
  706. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.SequenceNode)})}
  707. }),
  708. smalltalk.SequenceNode);
  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)._interpretBlockSequenceNode_continue_(self,aBlock);
  717. return $1;
  718. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.BlockSequenceNode)})}
  719. }),
  720. smalltalk.BlockSequenceNode);
  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)._interpretValueNode_continue_(self,aBlock);
  729. return $1;
  730. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.ValueNode)})}
  731. }),
  732. smalltalk.ValueNode);
  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)._interpretVariableNode_continue_(self,aBlock);
  741. return $1;
  742. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.VariableNode)})}
  743. }),
  744. smalltalk.VariableNode);
  745. smalltalk.addMethod(
  746. "_interpreter_continue_",
  747. smalltalk.method({
  748. selector: "interpreter:continue:",
  749. fn: function (anInterpreter,aBlock){
  750. var self=this;
  751. return smalltalk.withContext(function($ctx1) { var $1;
  752. $1=_st(anInterpreter)._interpretClassReferenceNode_continue_(self,aBlock);
  753. return $1;
  754. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.ClassReferenceNode)})}
  755. }),
  756. smalltalk.ClassReferenceNode);