Compiler-Interpreter.deploy.js 30 KB

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