Compiler-Interpreter.js 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083
  1. smalltalk.addPackage('Compiler-Interpreter', {});
  2. smalltalk.addClass('AIContext', smalltalk.NodeVisitor, ['outerContext', 'pc', 'locals', 'selector'], 'Compiler-Interpreter');
  3. smalltalk.AIContext.comment="AIContext is like a `MethodContext`, used by the `ASTInterpreter`.\x0aUnlike a `MethodContext`, it is not read-only.\x0a\x0aWhen debugging, `AIContext` instances are created by copying the current `MethodContext` (thisContext)"
  4. smalltalk.addMethod(
  5. "_initializeFromMethodContext_",
  6. smalltalk.method({
  7. selector: "initializeFromMethodContext:",
  8. category: 'initialization',
  9. fn: function (aMethodContext){
  10. var self=this;
  11. return smalltalk.withContext(function($ctx1) { var $1;
  12. _st(self)._pc_(_st(aMethodContext)._pc());
  13. _st(self)._receiver_(_st(aMethodContext)._receiver());
  14. _st(self)._selector_(_st(aMethodContext)._selector());
  15. $1=_st(aMethodContext)._outerContext();
  16. if(($receiver = $1) == nil || $receiver == undefined){
  17. $1;
  18. } else {
  19. _st(self)._outerContext_(_st(_st(self)._class())._fromMethodContext_(_st(aMethodContext)._outerContext()));
  20. };
  21. _st(_st(aMethodContext)._locals())._keysAndValuesDo_((function(key,value){
  22. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._locals())._at_put_(key,value);
  23. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  24. return self}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext}, smalltalk.AIContext)})},
  25. args: ["aMethodContext"],
  26. source: "initializeFromMethodContext: aMethodContext\x0a\x09self pc: aMethodContext pc.\x0a self receiver: aMethodContext receiver.\x0a self selector: aMethodContext selector.\x0a aMethodContext outerContext ifNotNil: [\x0a\x09\x09self outerContext: (self class fromMethodContext: aMethodContext outerContext) ].\x0a aMethodContext locals keysAndValuesDo: [ :key :value |\x0a \x09self locals at: key put: value ]\x0a ",
  27. messageSends: ["pc:", "pc", "receiver:", "receiver", "selector:", "selector", "ifNotNil:", "outerContext:", "fromMethodContext:", "outerContext", "class", "keysAndValuesDo:", "at:put:", "locals"],
  28. referencedClasses: []
  29. }),
  30. smalltalk.AIContext);
  31. smalltalk.addMethod(
  32. "_localAt_",
  33. smalltalk.method({
  34. selector: "localAt:",
  35. category: 'accessing',
  36. fn: function (aString){
  37. var self=this;
  38. return smalltalk.withContext(function($ctx1) { var $1;
  39. $1=_st(_st(self)._locals())._at_ifAbsent_(aString,(function(){
  40. return smalltalk.withContext(function($ctx2) { return nil;
  41. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  42. return $1;
  43. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString}, smalltalk.AIContext)})},
  44. args: ["aString"],
  45. source: "localAt: aString\x0a\x09^ self locals at: aString ifAbsent: [ nil ]",
  46. messageSends: ["at:ifAbsent:", "locals"],
  47. referencedClasses: []
  48. }),
  49. smalltalk.AIContext);
  50. smalltalk.addMethod(
  51. "_localAt_put_",
  52. smalltalk.method({
  53. selector: "localAt:put:",
  54. category: 'accessing',
  55. fn: function (aString,anObject){
  56. var self=this;
  57. return smalltalk.withContext(function($ctx1) { _st(_st(self)._locals())._at_put_(aString,anObject);
  58. return self}, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject}, smalltalk.AIContext)})},
  59. args: ["aString", "anObject"],
  60. source: "localAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  61. messageSends: ["at:put:", "locals"],
  62. referencedClasses: []
  63. }),
  64. smalltalk.AIContext);
  65. smalltalk.addMethod(
  66. "_locals",
  67. smalltalk.method({
  68. selector: "locals",
  69. category: 'accessing',
  70. fn: function (){
  71. var self=this;
  72. return smalltalk.withContext(function($ctx1) { var $2,$1;
  73. $2=self["@locals"];
  74. if(($receiver = $2) == nil || $receiver == undefined){
  75. self["@locals"]=_st((smalltalk.Dictionary || Dictionary))._new();
  76. $1=self["@locals"];
  77. } else {
  78. $1=$2;
  79. };
  80. return $1;
  81. }, function($ctx1) {$ctx1.fill(self,"locals",{}, smalltalk.AIContext)})},
  82. args: [],
  83. source: "locals\x0a\x09^ locals ifNil: [ locals := Dictionary new ]",
  84. messageSends: ["ifNil:", "new"],
  85. referencedClasses: ["Dictionary"]
  86. }),
  87. smalltalk.AIContext);
  88. smalltalk.addMethod(
  89. "_outerContext",
  90. smalltalk.method({
  91. selector: "outerContext",
  92. category: 'accessing',
  93. fn: function (){
  94. var self=this;
  95. return smalltalk.withContext(function($ctx1) { var $1;
  96. $1=self["@outerContext"];
  97. return $1;
  98. }, function($ctx1) {$ctx1.fill(self,"outerContext",{}, smalltalk.AIContext)})},
  99. args: [],
  100. source: "outerContext\x0a\x09^ outerContext",
  101. messageSends: [],
  102. referencedClasses: []
  103. }),
  104. smalltalk.AIContext);
  105. smalltalk.addMethod(
  106. "_outerContext_",
  107. smalltalk.method({
  108. selector: "outerContext:",
  109. category: 'accessing',
  110. fn: function (anAIContext){
  111. var self=this;
  112. return smalltalk.withContext(function($ctx1) { self["@outerContext"]=anAIContext;
  113. return self}, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext}, smalltalk.AIContext)})},
  114. args: ["anAIContext"],
  115. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext",
  116. messageSends: [],
  117. referencedClasses: []
  118. }),
  119. smalltalk.AIContext);
  120. smalltalk.addMethod(
  121. "_pc",
  122. smalltalk.method({
  123. selector: "pc",
  124. category: 'accessing',
  125. fn: function (){
  126. var self=this;
  127. return smalltalk.withContext(function($ctx1) { var $2,$1;
  128. $2=self["@pc"];
  129. if(($receiver = $2) == nil || $receiver == undefined){
  130. self["@pc"]=(0);
  131. $1=self["@pc"];
  132. } else {
  133. $1=$2;
  134. };
  135. return $1;
  136. }, function($ctx1) {$ctx1.fill(self,"pc",{}, smalltalk.AIContext)})},
  137. args: [],
  138. source: "pc\x0a\x09^ pc ifNil: [ pc := 0 ]",
  139. messageSends: ["ifNil:"],
  140. referencedClasses: []
  141. }),
  142. smalltalk.AIContext);
  143. smalltalk.addMethod(
  144. "_pc_",
  145. smalltalk.method({
  146. selector: "pc:",
  147. category: 'accessing',
  148. fn: function (anInteger){
  149. var self=this;
  150. return smalltalk.withContext(function($ctx1) { self["@pc"]=anInteger;
  151. return self}, function($ctx1) {$ctx1.fill(self,"pc:",{anInteger:anInteger}, smalltalk.AIContext)})},
  152. args: ["anInteger"],
  153. source: "pc: anInteger\x0a\x09pc := anInteger",
  154. messageSends: [],
  155. referencedClasses: []
  156. }),
  157. smalltalk.AIContext);
  158. smalltalk.addMethod(
  159. "_receiver",
  160. smalltalk.method({
  161. selector: "receiver",
  162. category: 'accessing',
  163. fn: function (){
  164. var self=this;
  165. return smalltalk.withContext(function($ctx1) { var $1;
  166. $1=_st(self)._localAt_("self");
  167. return $1;
  168. }, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.AIContext)})},
  169. args: [],
  170. source: "receiver\x0a\x09^ self localAt: 'self'",
  171. messageSends: ["localAt:"],
  172. referencedClasses: []
  173. }),
  174. smalltalk.AIContext);
  175. smalltalk.addMethod(
  176. "_receiver_",
  177. smalltalk.method({
  178. selector: "receiver:",
  179. category: 'accessing',
  180. fn: function (anObject){
  181. var self=this;
  182. return smalltalk.withContext(function($ctx1) { _st(self)._localAt_put_("self",anObject);
  183. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.AIContext)})},
  184. args: ["anObject"],
  185. source: "receiver: anObject\x0a\x09self localAt: 'self' put: anObject",
  186. messageSends: ["localAt:put:"],
  187. referencedClasses: []
  188. }),
  189. smalltalk.AIContext);
  190. smalltalk.addClass('ASTInterpreter', smalltalk.Object, ['currentNode', 'context', 'shouldReturn', 'result'], 'Compiler-Interpreter');
  191. smalltalk.ASTInterpreter.comment="ASTIntepreter is like a `NodeVisitor`, interpreting nodes one after each other.\x0aIt is built using Continuation Passing Style for stepping purposes.\x0a\x0aUsage example:\x0a\x0a | ast interpreter |\x0a ast := Smalltalk current parse: 'foo 1+2+4'.\x0a (SemanticAnalyzer on: Object) visit: ast.\x0a\x0a ASTInterpreter new\x0a interpret: ast nodes first;\x0a result \x22Answers 7\x22"
  192. smalltalk.addMethod(
  193. "_assign_to_",
  194. smalltalk.method({
  195. selector: "assign:to:",
  196. category: 'private',
  197. fn: function (aNode,anObject){
  198. var self=this;
  199. return smalltalk.withContext(function($ctx1) { var $2,$1;
  200. $2=_st(_st(aNode)._binding())._isInstanceVar();
  201. if(smalltalk.assert($2)){
  202. $1=_st(_st(_st(self)._context())._receiver())._instVarAt_put_(_st(aNode)._value(),anObject);
  203. } else {
  204. $1=_st(_st(self)._context())._localAt_put_(_st(aNode)._value(),anObject);
  205. };
  206. return $1;
  207. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject}, smalltalk.ASTInterpreter)})},
  208. args: ["aNode", "anObject"],
  209. source: "assign: aNode to: anObject\x0a\x09^ aNode binding isInstanceVar \x0a \x09ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]\x0a \x09ifFalse: [ self context localAt: aNode value put: anObject ]",
  210. messageSends: ["ifTrue:ifFalse:", "instVarAt:put:", "value", "receiver", "context", "localAt:put:", "isInstanceVar", "binding"],
  211. referencedClasses: []
  212. }),
  213. smalltalk.ASTInterpreter);
  214. smalltalk.addMethod(
  215. "_context",
  216. smalltalk.method({
  217. selector: "context",
  218. category: 'accessing',
  219. fn: function (){
  220. var self=this;
  221. return smalltalk.withContext(function($ctx1) { var $2,$1;
  222. $2=self["@context"];
  223. if(($receiver = $2) == nil || $receiver == undefined){
  224. self["@context"]=_st((smalltalk.AIContext || AIContext))._new();
  225. $1=self["@context"];
  226. } else {
  227. $1=$2;
  228. };
  229. return $1;
  230. }, function($ctx1) {$ctx1.fill(self,"context",{}, smalltalk.ASTInterpreter)})},
  231. args: [],
  232. source: "context\x0a\x09^ context ifNil: [ context := AIContext new ]",
  233. messageSends: ["ifNil:", "new"],
  234. referencedClasses: ["AIContext"]
  235. }),
  236. smalltalk.ASTInterpreter);
  237. smalltalk.addMethod(
  238. "_context_",
  239. smalltalk.method({
  240. selector: "context:",
  241. category: 'accessing',
  242. fn: function (anAIContext){
  243. var self=this;
  244. return smalltalk.withContext(function($ctx1) { self["@context"]=anAIContext;
  245. return self}, function($ctx1) {$ctx1.fill(self,"context:",{anAIContext:anAIContext}, smalltalk.ASTInterpreter)})},
  246. args: ["anAIContext"],
  247. source: "context: anAIContext\x0a\x09context := anAIContext",
  248. messageSends: [],
  249. referencedClasses: []
  250. }),
  251. smalltalk.ASTInterpreter);
  252. smalltalk.addMethod(
  253. "_continue_value_",
  254. smalltalk.method({
  255. selector: "continue:value:",
  256. category: 'private',
  257. fn: function (aBlock,anObject){
  258. var self=this;
  259. return smalltalk.withContext(function($ctx1) { self["@result"]=anObject;
  260. _st(aBlock)._value_(anObject);
  261. return self}, function($ctx1) {$ctx1.fill(self,"continue:value:",{aBlock:aBlock,anObject:anObject}, smalltalk.ASTInterpreter)})},
  262. args: ["aBlock", "anObject"],
  263. source: "continue: aBlock value: anObject\x0a\x09result := anObject.\x0a aBlock value: anObject",
  264. messageSends: ["value:"],
  265. referencedClasses: []
  266. }),
  267. smalltalk.ASTInterpreter);
  268. smalltalk.addMethod(
  269. "_eval_",
  270. smalltalk.method({
  271. selector: "eval:",
  272. category: 'private',
  273. fn: function (aString){
  274. var self=this;
  275. var source,function_;
  276. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  277. source=_st((smalltalk.String || String))._streamContents_((function(str){
  278. return smalltalk.withContext(function($ctx2) { _st(str)._nextPutAll_("(function(");
  279. _st(_st(_st(_st(self)._context())._locals())._keys())._do_separatedBy_((function(each){
  280. return smalltalk.withContext(function($ctx3) { return _st(str)._nextPutAll_(each);
  281. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  282. return smalltalk.withContext(function($ctx3) { return _st(str)._nextPutAll_(",");
  283. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  284. $1=str;
  285. _st($1)._nextPutAll_("){ return (function() {");
  286. _st($1)._nextPutAll_(aString);
  287. $2=_st($1)._nextPutAll_("})() })");
  288. return $2;
  289. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1)})}));
  290. function_=_st(_st((smalltalk.Compiler || Compiler))._new())._eval_(source);
  291. $3=_st(function_)._valueWithPossibleArguments_(_st(_st(_st(self)._context())._locals())._values());
  292. return $3;
  293. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_}, smalltalk.ASTInterpreter)})},
  294. args: ["aString"],
  295. source: "eval: aString\x0a\x09\x22Evaluate aString as JS source inside an JS function. \x0a aString is not sandboxed.\x22\x0a \x0a | source function |\x0a \x0a source := String streamContents: [ :str |\x0a \x09str nextPutAll: '(function('.\x0a self context locals keys \x0a \x09do: [ :each | str nextPutAll: each ]\x0a \x09separatedBy: [ str nextPutAll: ',' ].\x0a str \x0a \x09nextPutAll: '){ return (function() {';\x0a \x09nextPutAll: aString;\x0a nextPutAll: '})() })' ].\x0a \x0a\x09function := Compiler new eval: source.\x0a \x0a\x09^ function valueWithPossibleArguments: self context locals values",
  296. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"],
  297. referencedClasses: ["String", "Compiler"]
  298. }),
  299. smalltalk.ASTInterpreter);
  300. smalltalk.addMethod(
  301. "_initialize",
  302. smalltalk.method({
  303. selector: "initialize",
  304. category: 'initialization',
  305. fn: function (){
  306. var self=this;
  307. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  308. self["@shouldReturn"]=false;
  309. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ASTInterpreter)})},
  310. args: [],
  311. source: "initialize\x0a\x09super initialize.\x0a shouldReturn := false",
  312. messageSends: ["initialize"],
  313. referencedClasses: []
  314. }),
  315. smalltalk.ASTInterpreter);
  316. smalltalk.addMethod(
  317. "_interpret_",
  318. smalltalk.method({
  319. selector: "interpret:",
  320. category: 'interpreting',
  321. fn: function (aNode){
  322. var self=this;
  323. return smalltalk.withContext(function($ctx1) { self["@shouldReturn"]=false;
  324. _st(self)._interpret_continue_(aNode,(function(value){
  325. return smalltalk.withContext(function($ctx2) { self["@result"]=value;
  326. return self["@result"];
  327. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  328. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode}, smalltalk.ASTInterpreter)})},
  329. args: ["aNode"],
  330. source: "interpret: aNode\x0a\x09shouldReturn := false.\x0a self interpret: aNode continue: [ :value |\x0a \x09result := value ]",
  331. messageSends: ["interpret:continue:"],
  332. referencedClasses: []
  333. }),
  334. smalltalk.ASTInterpreter);
  335. smalltalk.addMethod(
  336. "_interpret_continue_",
  337. smalltalk.method({
  338. selector: "interpret:continue:",
  339. category: 'interpreting',
  340. fn: function (aNode,aBlock){
  341. var self=this;
  342. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  343. $1=self["@shouldReturn"];
  344. if(smalltalk.assert($1)){
  345. $2=self;
  346. return $2;
  347. };
  348. $3=_st(aNode)._isNode();
  349. if(smalltalk.assert($3)){
  350. self["@currentNode"]=aNode;
  351. self["@currentNode"];
  352. _st(self)._interpretNode_continue_(aNode,(function(value){
  353. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_value_(aBlock,value);
  354. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  355. } else {
  356. _st(self)._continue_value_(aBlock,aNode);
  357. };
  358. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  359. args: ["aNode", "aBlock"],
  360. source: "interpret: aNode continue: aBlock\x0a\x09shouldReturn ifTrue: [ ^ self ].\x0a\x0a\x09aNode isNode \x0a \x09ifTrue: [ \x09\x0a \x09currentNode := aNode.\x0a self interpretNode: aNode continue: [ :value |\x0a \x09\x09\x09\x09self continue: aBlock value: value] ]\x0a ifFalse: [ self continue: aBlock value: aNode ]",
  361. messageSends: ["ifTrue:", "ifTrue:ifFalse:", "interpretNode:continue:", "continue:value:", "isNode"],
  362. referencedClasses: []
  363. }),
  364. smalltalk.ASTInterpreter);
  365. smalltalk.addMethod(
  366. "_interpretAll_continue_",
  367. smalltalk.method({
  368. selector: "interpretAll:continue:",
  369. category: 'private',
  370. fn: function (aCollection,aBlock){
  371. var self=this;
  372. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_result_(aCollection,aBlock,_st((smalltalk.OrderedCollection || OrderedCollection))._new());
  373. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:",{aCollection:aCollection,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  374. args: ["aCollection", "aBlock"],
  375. source: "interpretAll: aCollection continue: aBlock\x0a\x09self \x0a \x09interpretAll: aCollection \x0a continue: aBlock \x0a result: OrderedCollection new",
  376. messageSends: ["interpretAll:continue:result:", "new"],
  377. referencedClasses: ["OrderedCollection"]
  378. }),
  379. smalltalk.ASTInterpreter);
  380. smalltalk.addMethod(
  381. "_interpretAll_continue_result_",
  382. smalltalk.method({
  383. selector: "interpretAll:continue:result:",
  384. category: 'private',
  385. fn: function (nodes,aBlock,aCollection){
  386. var self=this;
  387. return smalltalk.withContext(function($ctx1) { var $1;
  388. $1=_st(nodes)._isEmpty();
  389. if(smalltalk.assert($1)){
  390. _st(aBlock)._value_(aCollection);
  391. } else {
  392. _st(self)._interpret_continue_(_st(nodes)._first(),(function(value){
  393. return smalltalk.withContext(function($ctx2) { return _st(self)._interpretAll_continue_result_(_st(nodes)._allButFirst(),aBlock,_st(aCollection).__comma([value]));
  394. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  395. };
  396. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:result:",{nodes:nodes,aBlock:aBlock,aCollection:aCollection}, smalltalk.ASTInterpreter)})},
  397. args: ["nodes", "aBlock", "aCollection"],
  398. source: "interpretAll: nodes continue: aBlock result: aCollection\x0a\x09nodes isEmpty \x0a \x09ifTrue: [ aBlock value: aCollection ]\x0a \x09ifFalse: [\x0a \x09\x09self interpret: nodes first continue: [:value |\x0a \x09\x09\x09self \x0a \x09interpretAll: nodes allButFirst \x0a continue: aBlock\x0a \x09\x09\x09\x09\x09result: aCollection, { value } ] ]",
  399. messageSends: ["ifTrue:ifFalse:", "value:", "interpret:continue:", "first", "interpretAll:continue:result:", "allButFirst", ",", "isEmpty"],
  400. referencedClasses: []
  401. }),
  402. smalltalk.ASTInterpreter);
  403. smalltalk.addMethod(
  404. "_interpretAssignmentNode_continue_",
  405. smalltalk.method({
  406. selector: "interpretAssignmentNode:continue:",
  407. category: 'interpreting',
  408. fn: function (aNode,aBlock){
  409. var self=this;
  410. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(aNode)._right(),(function(value){
  411. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_value_(aBlock,_st(self)._assign_to_(_st(aNode)._left(),value));
  412. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  413. return self}, function($ctx1) {$ctx1.fill(self,"interpretAssignmentNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  414. args: ["aNode", "aBlock"],
  415. source: "interpretAssignmentNode: aNode continue: aBlock\x0a\x09self interpret: aNode right continue: [ :value |\x0a \x09self \x0a \x09continue: aBlock\x0a value: (self assign: aNode left to: value) ]",
  416. messageSends: ["interpret:continue:", "right", "continue:value:", "assign:to:", "left"],
  417. referencedClasses: []
  418. }),
  419. smalltalk.ASTInterpreter);
  420. smalltalk.addMethod(
  421. "_interpretBlockNode_continue_",
  422. smalltalk.method({
  423. selector: "interpretBlockNode:continue:",
  424. category: 'interpreting',
  425. fn: function (aNode,aBlock){
  426. var self=this;
  427. return smalltalk.withContext(function($ctx1) { var $1,$2;
  428. _st(self)._continue_value_(aBlock,(function(){
  429. return smalltalk.withContext(function($ctx2) { $1=self;
  430. _st($1)._interpret_(_st(_st(aNode)._nodes())._first());
  431. $2=_st($1)._result();
  432. return $2;
  433. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  434. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  435. args: ["aNode", "aBlock"],
  436. source: "interpretBlockNode: aNode continue: aBlock\x0a\x09\x22TODO: Context should be set\x22\x0a \x0a self \x0a \x09continue: aBlock \x0a value: [ self interpret: aNode nodes first; result ]",
  437. messageSends: ["continue:value:", "interpret:", "first", "nodes", "result"],
  438. referencedClasses: []
  439. }),
  440. smalltalk.ASTInterpreter);
  441. smalltalk.addMethod(
  442. "_interpretBlockSequenceNode_continue_",
  443. smalltalk.method({
  444. selector: "interpretBlockSequenceNode:continue:",
  445. category: 'interpreting',
  446. fn: function (aNode,aBlock){
  447. var self=this;
  448. return smalltalk.withContext(function($ctx1) { _st(self)._interpretSequenceNode_continue_(aNode,aBlock);
  449. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockSequenceNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  450. args: ["aNode", "aBlock"],
  451. source: "interpretBlockSequenceNode: aNode continue: aBlock\x0a\x09self interpretSequenceNode: aNode continue: aBlock",
  452. messageSends: ["interpretSequenceNode:continue:"],
  453. referencedClasses: []
  454. }),
  455. smalltalk.ASTInterpreter);
  456. smalltalk.addMethod(
  457. "_interpretCascadeNode_continue_",
  458. smalltalk.method({
  459. selector: "interpretCascadeNode:continue:",
  460. category: 'interpreting',
  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) { _st(_st(aNode)._nodes())._do_((function(each){
  465. return smalltalk.withContext(function($ctx3) { return _st(each)._receiver_(receiver);
  466. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  467. return _st(self)._interpretAll_continue_(_st(_st(aNode)._nodes())._allButLast(),(function(){
  468. return smalltalk.withContext(function($ctx3) { return _st(self)._interpret_continue_(_st(_st(aNode)._nodes())._last(),(function(val){
  469. return smalltalk.withContext(function($ctx4) { return _st(self)._continue_value_(aBlock,val);
  470. }, function($ctx4) {$ctx4.fillBlock({val:val},$ctx1)})}));
  471. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  472. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  473. return self}, function($ctx1) {$ctx1.fill(self,"interpretCascadeNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  474. args: ["aNode", "aBlock"],
  475. source: "interpretCascadeNode: aNode continue: aBlock\x0a\x09\x22TODO: Handle super sends\x22\x0a\x09\x0a self interpret: aNode receiver continue: [ :receiver |\x0a\x09\x09\x22Only interpret the receiver once\x22\x0a aNode nodes do: [ :each | each receiver: receiver ].\x0a \x0a \x09self \x0a \x09interpretAll: aNode nodes allButLast\x0a \x09\x09continue: [\x0a \x09self \x0a \x09interpret: aNode nodes last\x0a \x09continue: [ :val | self continue: aBlock value: val ] ] ]",
  476. messageSends: ["interpret:continue:", "receiver", "do:", "receiver:", "nodes", "interpretAll:continue:", "allButLast", "last", "continue:value:"],
  477. referencedClasses: []
  478. }),
  479. smalltalk.ASTInterpreter);
  480. smalltalk.addMethod(
  481. "_interpretClassReferenceNode_continue_",
  482. smalltalk.method({
  483. selector: "interpretClassReferenceNode:continue:",
  484. category: 'interpreting',
  485. fn: function (aNode,aBlock){
  486. var self=this;
  487. return smalltalk.withContext(function($ctx1) { _st(self)._continue_value_(aBlock,_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_(_st(aNode)._value()));
  488. return self}, function($ctx1) {$ctx1.fill(self,"interpretClassReferenceNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  489. args: ["aNode", "aBlock"],
  490. source: "interpretClassReferenceNode: aNode continue: aBlock\x0a\x09self continue: aBlock value: (Smalltalk current at: aNode value)",
  491. messageSends: ["continue:value:", "at:", "value", "current"],
  492. referencedClasses: ["Smalltalk"]
  493. }),
  494. smalltalk.ASTInterpreter);
  495. smalltalk.addMethod(
  496. "_interpretDynamicArrayNode_continue_",
  497. smalltalk.method({
  498. selector: "interpretDynamicArrayNode:continue:",
  499. category: 'interpreting',
  500. fn: function (aNode,aBlock){
  501. var self=this;
  502. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  503. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_value_(aBlock,array);
  504. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  505. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicArrayNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  506. args: ["aNode", "aBlock"],
  507. source: "interpretDynamicArrayNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array |\x0a \x09self \x0a \x09continue: aBlock\x0a\x09\x09\x09value: array ]",
  508. messageSends: ["interpretAll:continue:", "nodes", "continue:value:"],
  509. referencedClasses: []
  510. }),
  511. smalltalk.ASTInterpreter);
  512. smalltalk.addMethod(
  513. "_interpretDynamicDictionaryNode_continue_",
  514. smalltalk.method({
  515. selector: "interpretDynamicDictionaryNode:continue:",
  516. category: 'interpreting',
  517. fn: function (aNode,aBlock){
  518. var self=this;
  519. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  520. var hashedCollection;
  521. return smalltalk.withContext(function($ctx2) { hashedCollection=_st((smalltalk.HashedCollection || HashedCollection))._new();
  522. hashedCollection;
  523. _st(array)._do_((function(each){
  524. return smalltalk.withContext(function($ctx3) { return _st(hashedCollection)._add_(each);
  525. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  526. return _st(self)._continue_value_(aBlock,hashedCollection);
  527. }, function($ctx2) {$ctx2.fillBlock({array:array,hashedCollection:hashedCollection},$ctx1)})}));
  528. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicDictionaryNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  529. args: ["aNode", "aBlock"],
  530. source: "interpretDynamicDictionaryNode: aNode continue: aBlock\x0a self interpretAll: aNode nodes continue: [ :array | | hashedCollection |\x0a \x09hashedCollection := HashedCollection new.\x0a array do: [ :each | hashedCollection add: each ].\x0a self \x09\x0a \x09continue: aBlock\x0a value: hashedCollection ]",
  531. messageSends: ["interpretAll:continue:", "nodes", "new", "do:", "add:", "continue:value:"],
  532. referencedClasses: ["HashedCollection"]
  533. }),
  534. smalltalk.ASTInterpreter);
  535. smalltalk.addMethod(
  536. "_interpretJSStatementNode_continue_",
  537. smalltalk.method({
  538. selector: "interpretJSStatementNode:continue:",
  539. category: 'interpreting',
  540. fn: function (aNode,aBlock){
  541. var self=this;
  542. return smalltalk.withContext(function($ctx1) { self["@shouldReturn"]=true;
  543. _st(self)._continue_value_(aBlock,_st(self)._eval_(_st(aNode)._source()));
  544. return self}, function($ctx1) {$ctx1.fill(self,"interpretJSStatementNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  545. args: ["aNode", "aBlock"],
  546. source: "interpretJSStatementNode: aNode continue: aBlock\x0a\x09shouldReturn := true.\x0a\x09self continue: aBlock value: (self eval: aNode source)",
  547. messageSends: ["continue:value:", "eval:", "source"],
  548. referencedClasses: []
  549. }),
  550. smalltalk.ASTInterpreter);
  551. smalltalk.addMethod(
  552. "_interpretMethodNode_continue_",
  553. smalltalk.method({
  554. selector: "interpretMethodNode:continue:",
  555. category: 'interpreting',
  556. fn: function (aNode,aBlock){
  557. var self=this;
  558. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  559. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_value_(aBlock,_st(array)._first());
  560. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  561. return self}, function($ctx1) {$ctx1.fill(self,"interpretMethodNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  562. args: ["aNode", "aBlock"],
  563. source: "interpretMethodNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array |\x0a \x09self continue: aBlock value: array first ]",
  564. messageSends: ["interpretAll:continue:", "nodes", "continue:value:", "first"],
  565. referencedClasses: []
  566. }),
  567. smalltalk.ASTInterpreter);
  568. smalltalk.addMethod(
  569. "_interpretNode_continue_",
  570. smalltalk.method({
  571. selector: "interpretNode:continue:",
  572. category: 'interpreting',
  573. fn: function (aNode,aBlock){
  574. var self=this;
  575. return smalltalk.withContext(function($ctx1) { _st(aNode)._interpreter_continue_(self,aBlock);
  576. return self}, function($ctx1) {$ctx1.fill(self,"interpretNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  577. args: ["aNode", "aBlock"],
  578. source: "interpretNode: aNode continue: aBlock\x0a aNode interpreter: self continue: aBlock",
  579. messageSends: ["interpreter:continue:"],
  580. referencedClasses: []
  581. }),
  582. smalltalk.ASTInterpreter);
  583. smalltalk.addMethod(
  584. "_interpretReturnNode_continue_",
  585. smalltalk.method({
  586. selector: "interpretReturnNode:continue:",
  587. category: 'interpreting',
  588. fn: function (aNode,aBlock){
  589. var self=this;
  590. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(_st(aNode)._nodes())._first(),(function(value){
  591. return smalltalk.withContext(function($ctx2) { self["@shouldReturn"]=true;
  592. self["@shouldReturn"];
  593. return _st(self)._continue_value_(aBlock,value);
  594. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  595. return self}, function($ctx1) {$ctx1.fill(self,"interpretReturnNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  596. args: ["aNode", "aBlock"],
  597. source: "interpretReturnNode: aNode continue: aBlock\x0a self interpret: aNode nodes first continue: [ :value |\x0a \x09shouldReturn := true.\x0a\x09\x09self continue: aBlock value: value ]",
  598. messageSends: ["interpret:continue:", "first", "nodes", "continue:value:"],
  599. referencedClasses: []
  600. }),
  601. smalltalk.ASTInterpreter);
  602. smalltalk.addMethod(
  603. "_interpretSendNode_continue_",
  604. smalltalk.method({
  605. selector: "interpretSendNode:continue:",
  606. category: 'interpreting',
  607. fn: function (aNode,aBlock){
  608. var self=this;
  609. return smalltalk.withContext(function($ctx1) { _st(self)._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  610. return smalltalk.withContext(function($ctx2) { return _st(self)._messageFromSendNode_do_(aNode,(function(message){
  611. return smalltalk.withContext(function($ctx3) { _st(_st(self)._context())._pc_(_st(_st(_st(self)._context())._pc()).__plus((1)));
  612. return _st(self)._continue_value_(aBlock,_st(message)._sendTo_(receiver));
  613. }, function($ctx3) {$ctx3.fillBlock({message:message},$ctx1)})}));
  614. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  615. return self}, function($ctx1) {$ctx1.fill(self,"interpretSendNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  616. args: ["aNode", "aBlock"],
  617. source: "interpretSendNode: aNode continue: aBlock\x0a\x09\x22TODO: Handle super sends\x22\x0a \x0a self interpret: aNode receiver continue: [ :receiver |\x0a \x09self messageFromSendNode: aNode do: [ :message |\x0a \x09self context pc: self context pc + 1.\x0a \x09self \x0a \x09continue: aBlock \x0a value: (message sendTo: receiver) ] ]",
  618. messageSends: ["interpret:continue:", "receiver", "messageFromSendNode:do:", "pc:", "+", "pc", "context", "continue:value:", "sendTo:"],
  619. referencedClasses: []
  620. }),
  621. smalltalk.ASTInterpreter);
  622. smalltalk.addMethod(
  623. "_interpretSequenceNode_continue_",
  624. smalltalk.method({
  625. selector: "interpretSequenceNode:continue:",
  626. category: 'interpreting',
  627. fn: function (aNode,aBlock){
  628. var self=this;
  629. return smalltalk.withContext(function($ctx1) { _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  630. return smalltalk.withContext(function($ctx2) { return _st(self)._continue_value_(aBlock,_st(array)._last());
  631. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  632. return self}, function($ctx1) {$ctx1.fill(self,"interpretSequenceNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  633. args: ["aNode", "aBlock"],
  634. source: "interpretSequenceNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array |\x0a \x09self continue: aBlock value: array last ]",
  635. messageSends: ["interpretAll:continue:", "nodes", "continue:value:", "last"],
  636. referencedClasses: []
  637. }),
  638. smalltalk.ASTInterpreter);
  639. smalltalk.addMethod(
  640. "_interpretValueNode_continue_",
  641. smalltalk.method({
  642. selector: "interpretValueNode:continue:",
  643. category: 'interpreting',
  644. fn: function (aNode,aBlock){
  645. var self=this;
  646. return smalltalk.withContext(function($ctx1) { _st(self)._continue_value_(aBlock,_st(aNode)._value());
  647. return self}, function($ctx1) {$ctx1.fill(self,"interpretValueNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  648. args: ["aNode", "aBlock"],
  649. source: "interpretValueNode: aNode continue: aBlock\x0a\x09self continue: aBlock value: aNode value",
  650. messageSends: ["continue:value:", "value"],
  651. referencedClasses: []
  652. }),
  653. smalltalk.ASTInterpreter);
  654. smalltalk.addMethod(
  655. "_interpretVariableNode_continue_",
  656. smalltalk.method({
  657. selector: "interpretVariableNode:continue:",
  658. category: 'interpreting',
  659. fn: function (aNode,aBlock){
  660. var self=this;
  661. return smalltalk.withContext(function($ctx1) { var $1,$2,$4,$3;
  662. $1=self;
  663. $2=aBlock;
  664. $4=_st(_st(aNode)._binding())._isInstanceVar();
  665. if(smalltalk.assert($4)){
  666. $3=_st(_st(_st(self)._context())._receiver())._instVarAt_(_st(aNode)._value());
  667. } else {
  668. $3=_st(_st(self)._context())._localAt_(_st(aNode)._value());
  669. };
  670. _st($1)._continue_value_($2,$3);
  671. return self}, function($ctx1) {$ctx1.fill(self,"interpretVariableNode:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  672. args: ["aNode", "aBlock"],
  673. source: "interpretVariableNode: aNode continue: aBlock\x0a self \x0a \x09continue: aBlock\x0a value: (aNode binding isInstanceVar\x0a\x09\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09\x09ifFalse: [ self context localAt: aNode value ])",
  674. messageSends: ["continue:value:", "ifTrue:ifFalse:", "instVarAt:", "value", "receiver", "context", "localAt:", "isInstanceVar", "binding"],
  675. referencedClasses: []
  676. }),
  677. smalltalk.ASTInterpreter);
  678. smalltalk.addMethod(
  679. "_messageFromSendNode_do_",
  680. smalltalk.method({
  681. selector: "messageFromSendNode:do:",
  682. category: 'private',
  683. fn: function (aSendNode,aBlock){
  684. var self=this;
  685. return smalltalk.withContext(function($ctx1) { var $1,$2;
  686. _st(self)._interpretAll_continue_(_st(aSendNode)._arguments(),(function(args){
  687. return smalltalk.withContext(function($ctx2) { $1=_st((smalltalk.Message || Message))._new();
  688. _st($1)._selector_(_st(aSendNode)._selector());
  689. _st($1)._arguments_(args);
  690. $2=_st($1)._yourself();
  691. return _st(aBlock)._value_($2);
  692. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1)})}));
  693. return self}, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:do:",{aSendNode:aSendNode,aBlock:aBlock}, smalltalk.ASTInterpreter)})},
  694. args: ["aSendNode", "aBlock"],
  695. source: "messageFromSendNode: aSendNode do: aBlock\x0a\x09self interpretAll: aSendNode arguments continue: [ :args |\x0a \x09aBlock value: (Message new\x0a \x09\x09selector: aSendNode selector;\x0a \x09arguments: args;\x0a \x09yourself) ]",
  696. messageSends: ["interpretAll:continue:", "arguments", "value:", "selector:", "selector", "new", "arguments:", "yourself"],
  697. referencedClasses: ["Message"]
  698. }),
  699. smalltalk.ASTInterpreter);
  700. smalltalk.addMethod(
  701. "_result",
  702. smalltalk.method({
  703. selector: "result",
  704. category: 'accessing',
  705. fn: function (){
  706. var self=this;
  707. return smalltalk.withContext(function($ctx1) { var $1;
  708. $1=self["@result"];
  709. return $1;
  710. }, function($ctx1) {$ctx1.fill(self,"result",{}, smalltalk.ASTInterpreter)})},
  711. args: [],
  712. source: "result\x0a\x09^ result",
  713. messageSends: [],
  714. referencedClasses: []
  715. }),
  716. smalltalk.ASTInterpreter);
  717. smalltalk.addClass('ASTDebugger', smalltalk.ASTInterpreter, ['continuation'], 'Compiler-Interpreter');
  718. smalltalk.ASTDebugger.comment="ASTDebugger is an interpreter with stepping capabilities.\x0aUse `#stepOver` to actually interpret the next node.\x0a\x0aUsage example:\x0a\x0a | ast debugger |\x0a ast := Smalltalk current parse: 'foo 1+2+4'.\x0a (SemanticAnalyzer on: Object) visit: ast.\x0a\x0a debugger := ASTDebugger new\x0a interpret: ast nodes first;\x0a yourself.\x0a \x0a debugger stepOver; stepOver.\x0a debugger stepOver; stepOver.\x0a debugger result.\x22Answers 1\x22\x0a debugger stepOver.\x0a debugger result. \x22Answers 3\x22\x0a debugger stepOver.\x0a debugger result. \x22Answers 7\x22\x0a "
  719. smalltalk.addMethod(
  720. "_initialize",
  721. smalltalk.method({
  722. selector: "initialize",
  723. category: 'initialization',
  724. fn: function (){
  725. var self=this;
  726. return smalltalk.withContext(function($ctx1) { smalltalk.ASTInterpreter.fn.prototype._initialize.apply(_st(self), []);
  727. self["@continuation"]=(function(){
  728. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  729. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ASTDebugger)})},
  730. args: [],
  731. source: "initialize\x0a\x09super initialize.\x0a continuation := [ ]",
  732. messageSends: ["initialize"],
  733. referencedClasses: []
  734. }),
  735. smalltalk.ASTDebugger);
  736. smalltalk.addMethod(
  737. "_interpret_continue_",
  738. smalltalk.method({
  739. selector: "interpret:continue:",
  740. category: 'interpreting',
  741. fn: function (aNode,aBlock){
  742. var self=this;
  743. return smalltalk.withContext(function($ctx1) { self["@continuation"]=(function(){
  744. return smalltalk.withContext(function($ctx2) { return smalltalk.ASTInterpreter.fn.prototype._interpret_continue_.apply(_st(self), [aNode,aBlock]);
  745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  746. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock}, smalltalk.ASTDebugger)})},
  747. args: ["aNode", "aBlock"],
  748. source: "interpret: aNode continue: aBlock\x0a\x09continuation := [ super interpret: aNode continue: aBlock ]",
  749. messageSends: ["interpret:continue:"],
  750. referencedClasses: []
  751. }),
  752. smalltalk.ASTDebugger);
  753. smalltalk.addMethod(
  754. "_stepOver",
  755. smalltalk.method({
  756. selector: "stepOver",
  757. category: 'stepping',
  758. fn: function (){
  759. var self=this;
  760. return smalltalk.withContext(function($ctx1) { _st(self["@continuation"])._value();
  761. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{}, smalltalk.ASTDebugger)})},
  762. args: [],
  763. source: "stepOver\x0a\x09continuation value",
  764. messageSends: ["value"],
  765. referencedClasses: []
  766. }),
  767. smalltalk.ASTDebugger);
  768. smalltalk.addMethod(
  769. "_interpreter_continue_",
  770. smalltalk.method({
  771. selector: "interpreter:continue:",
  772. category: '*Compiler-Interpreter',
  773. fn: function (anInterpreter,aBlock){
  774. var self=this;
  775. return smalltalk.withContext(function($ctx1) { var $1;
  776. $1=_st(anInterpreter)._interpretNode_continue_(self,aBlock);
  777. return $1;
  778. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.Node)})},
  779. args: ["anInterpreter", "aBlock"],
  780. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretNode: self continue: aBlock",
  781. messageSends: ["interpretNode:continue:"],
  782. referencedClasses: []
  783. }),
  784. smalltalk.Node);
  785. smalltalk.addMethod(
  786. "_interpreter_continue_",
  787. smalltalk.method({
  788. selector: "interpreter:continue:",
  789. category: '*Compiler-Interpreter',
  790. fn: function (anInterpreter,aBlock){
  791. var self=this;
  792. return smalltalk.withContext(function($ctx1) { var $1;
  793. $1=_st(anInterpreter)._interpretAssignmentNode_continue_(self,aBlock);
  794. return $1;
  795. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.AssignmentNode)})},
  796. args: ["anInterpreter", "aBlock"],
  797. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretAssignmentNode: self continue: aBlock",
  798. messageSends: ["interpretAssignmentNode:continue:"],
  799. referencedClasses: []
  800. }),
  801. smalltalk.AssignmentNode);
  802. smalltalk.addMethod(
  803. "_interpreter_continue_",
  804. smalltalk.method({
  805. selector: "interpreter:continue:",
  806. category: '*Compiler-Interpreter',
  807. fn: function (anInterpreter,aBlock){
  808. var self=this;
  809. return smalltalk.withContext(function($ctx1) { var $1;
  810. $1=_st(anInterpreter)._interpretBlockNode_continue_(self,aBlock);
  811. return $1;
  812. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.BlockNode)})},
  813. args: ["anInterpreter", "aBlock"],
  814. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretBlockNode: self continue: aBlock",
  815. messageSends: ["interpretBlockNode:continue:"],
  816. referencedClasses: []
  817. }),
  818. smalltalk.BlockNode);
  819. smalltalk.addMethod(
  820. "_interpreter_continue_",
  821. smalltalk.method({
  822. selector: "interpreter:continue:",
  823. category: '*Compiler-Interpreter',
  824. fn: function (anInterpreter,aBlock){
  825. var self=this;
  826. return smalltalk.withContext(function($ctx1) { var $1;
  827. $1=_st(anInterpreter)._interpretCascadeNode_continue_(self,aBlock);
  828. return $1;
  829. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.CascadeNode)})},
  830. args: ["anInterpreter", "aBlock"],
  831. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretCascadeNode: self continue: aBlock",
  832. messageSends: ["interpretCascadeNode:continue:"],
  833. referencedClasses: []
  834. }),
  835. smalltalk.CascadeNode);
  836. smalltalk.addMethod(
  837. "_interpreter_continue_",
  838. smalltalk.method({
  839. selector: "interpreter:continue:",
  840. category: '*Compiler-Interpreter',
  841. fn: function (anInterpreter,aBlock){
  842. var self=this;
  843. return smalltalk.withContext(function($ctx1) { var $1;
  844. $1=_st(anInterpreter)._interpretDynamicArrayNode_continue_(self,aBlock);
  845. return $1;
  846. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.DynamicArrayNode)})},
  847. args: ["anInterpreter", "aBlock"],
  848. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretDynamicArrayNode: self continue: aBlock",
  849. messageSends: ["interpretDynamicArrayNode:continue:"],
  850. referencedClasses: []
  851. }),
  852. smalltalk.DynamicArrayNode);
  853. smalltalk.addMethod(
  854. "_interpreter_continue_",
  855. smalltalk.method({
  856. selector: "interpreter:continue:",
  857. category: '*Compiler-Interpreter',
  858. fn: function (anInterpreter,aBlock){
  859. var self=this;
  860. return smalltalk.withContext(function($ctx1) { var $1;
  861. $1=_st(anInterpreter)._interpretDynamicDictionaryNode_continue_(self,aBlock);
  862. return $1;
  863. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.DynamicDictionaryNode)})},
  864. args: ["anInterpreter", "aBlock"],
  865. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretDynamicDictionaryNode: self continue: aBlock",
  866. messageSends: ["interpretDynamicDictionaryNode:continue:"],
  867. referencedClasses: []
  868. }),
  869. smalltalk.DynamicDictionaryNode);
  870. smalltalk.addMethod(
  871. "_interpreter_continue_",
  872. smalltalk.method({
  873. selector: "interpreter:continue:",
  874. category: '*Compiler-Interpreter',
  875. fn: function (anInterpreter,aBlock){
  876. var self=this;
  877. return smalltalk.withContext(function($ctx1) { var $1;
  878. $1=_st(anInterpreter)._interpretJSStatementNode_continue_(self,aBlock);
  879. return $1;
  880. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.JSStatementNode)})},
  881. args: ["anInterpreter", "aBlock"],
  882. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretJSStatementNode: self continue: aBlock",
  883. messageSends: ["interpretJSStatementNode:continue:"],
  884. referencedClasses: []
  885. }),
  886. smalltalk.JSStatementNode);
  887. smalltalk.addMethod(
  888. "_interpreter_continue_",
  889. smalltalk.method({
  890. selector: "interpreter:continue:",
  891. category: '*Compiler-Interpreter',
  892. fn: function (anInterpreter,aBlock){
  893. var self=this;
  894. return smalltalk.withContext(function($ctx1) { var $1;
  895. $1=_st(anInterpreter)._interpretMethodNode_continue_(self,aBlock);
  896. return $1;
  897. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.MethodNode)})},
  898. args: ["anInterpreter", "aBlock"],
  899. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretMethodNode: self continue: aBlock",
  900. messageSends: ["interpretMethodNode:continue:"],
  901. referencedClasses: []
  902. }),
  903. smalltalk.MethodNode);
  904. smalltalk.addMethod(
  905. "_interpreter_continue_",
  906. smalltalk.method({
  907. selector: "interpreter:continue:",
  908. category: '*Compiler-Interpreter',
  909. fn: function (anInterpreter,aBlock){
  910. var self=this;
  911. return smalltalk.withContext(function($ctx1) { var $1;
  912. $1=_st(anInterpreter)._interpretReturnNode_continue_(self,aBlock);
  913. return $1;
  914. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.ReturnNode)})},
  915. args: ["anInterpreter", "aBlock"],
  916. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretReturnNode: self continue: aBlock",
  917. messageSends: ["interpretReturnNode:continue:"],
  918. referencedClasses: []
  919. }),
  920. smalltalk.ReturnNode);
  921. smalltalk.addMethod(
  922. "_interpreter_continue_",
  923. smalltalk.method({
  924. selector: "interpreter:continue:",
  925. category: '*Compiler-Interpreter',
  926. fn: function (anInterpreter,aBlock){
  927. var self=this;
  928. return smalltalk.withContext(function($ctx1) { var $1;
  929. $1=_st(anInterpreter)._interpretSendNode_continue_(self,aBlock);
  930. return $1;
  931. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.SendNode)})},
  932. args: ["anInterpreter", "aBlock"],
  933. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretSendNode: self continue: aBlock",
  934. messageSends: ["interpretSendNode:continue:"],
  935. referencedClasses: []
  936. }),
  937. smalltalk.SendNode);
  938. smalltalk.addMethod(
  939. "_interpreter_continue_",
  940. smalltalk.method({
  941. selector: "interpreter:continue:",
  942. category: '*Compiler-Interpreter',
  943. fn: function (anInterpreter,aBlock){
  944. var self=this;
  945. return smalltalk.withContext(function($ctx1) { var $1;
  946. $1=_st(anInterpreter)._interpretSequenceNode_continue_(self,aBlock);
  947. return $1;
  948. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.SequenceNode)})},
  949. args: ["anInterpreter", "aBlock"],
  950. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretSequenceNode: self continue: aBlock",
  951. messageSends: ["interpretSequenceNode:continue:"],
  952. referencedClasses: []
  953. }),
  954. smalltalk.SequenceNode);
  955. smalltalk.addMethod(
  956. "_interpreter_continue_",
  957. smalltalk.method({
  958. selector: "interpreter:continue:",
  959. category: '*Compiler-Interpreter',
  960. fn: function (anInterpreter,aBlock){
  961. var self=this;
  962. return smalltalk.withContext(function($ctx1) { var $1;
  963. $1=_st(anInterpreter)._interpretBlockSequenceNode_continue_(self,aBlock);
  964. return $1;
  965. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.BlockSequenceNode)})},
  966. args: ["anInterpreter", "aBlock"],
  967. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretBlockSequenceNode: self continue: aBlock",
  968. messageSends: ["interpretBlockSequenceNode:continue:"],
  969. referencedClasses: []
  970. }),
  971. smalltalk.BlockSequenceNode);
  972. smalltalk.addMethod(
  973. "_interpreter_continue_",
  974. smalltalk.method({
  975. selector: "interpreter:continue:",
  976. category: '*Compiler-Interpreter',
  977. fn: function (anInterpreter,aBlock){
  978. var self=this;
  979. return smalltalk.withContext(function($ctx1) { var $1;
  980. $1=_st(anInterpreter)._interpretValueNode_continue_(self,aBlock);
  981. return $1;
  982. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.ValueNode)})},
  983. args: ["anInterpreter", "aBlock"],
  984. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretValueNode: self continue: aBlock",
  985. messageSends: ["interpretValueNode:continue:"],
  986. referencedClasses: []
  987. }),
  988. smalltalk.ValueNode);
  989. smalltalk.addMethod(
  990. "_interpreter_continue_",
  991. smalltalk.method({
  992. selector: "interpreter:continue:",
  993. category: '*Compiler-Interpreter',
  994. fn: function (anInterpreter,aBlock){
  995. var self=this;
  996. return smalltalk.withContext(function($ctx1) { var $1;
  997. $1=_st(anInterpreter)._interpretVariableNode_continue_(self,aBlock);
  998. return $1;
  999. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.VariableNode)})},
  1000. args: ["anInterpreter", "aBlock"],
  1001. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretVariableNode: self continue: aBlock",
  1002. messageSends: ["interpretVariableNode:continue:"],
  1003. referencedClasses: []
  1004. }),
  1005. smalltalk.VariableNode);
  1006. smalltalk.addMethod(
  1007. "_interpreter_continue_",
  1008. smalltalk.method({
  1009. selector: "interpreter:continue:",
  1010. category: '*Compiler-Interpreter',
  1011. fn: function (anInterpreter,aBlock){
  1012. var self=this;
  1013. return smalltalk.withContext(function($ctx1) { var $1;
  1014. $1=_st(anInterpreter)._interpretClassReferenceNode_continue_(self,aBlock);
  1015. return $1;
  1016. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock}, smalltalk.ClassReferenceNode)})},
  1017. args: ["anInterpreter", "aBlock"],
  1018. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretClassReferenceNode: self continue: aBlock",
  1019. messageSends: ["interpretClassReferenceNode:continue:"],
  1020. referencedClasses: []
  1021. }),
  1022. smalltalk.ClassReferenceNode);