Compiler-Interpreter.deploy.js 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374
  1. smalltalk.addPackage('Compiler-Interpreter');
  2. smalltalk.addClass('AIContext', smalltalk.NodeVisitor, ['methodContext', 'outerContext', 'pc', 'locals', 'method'], 'Compiler-Interpreter');
  3. smalltalk.addMethod(
  4. smalltalk.method({
  5. selector: "asString",
  6. fn: function (){
  7. var self=this;
  8. return smalltalk.withContext(function($ctx1) {
  9. var $1;
  10. $1=_st(self["@methodContext"])._asString();
  11. return $1;
  12. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.AIContext)})},
  13. messageSends: ["asString"]}),
  14. smalltalk.AIContext);
  15. smalltalk.addMethod(
  16. smalltalk.method({
  17. selector: "home",
  18. fn: function (){
  19. var self=this;
  20. return smalltalk.withContext(function($ctx1) {
  21. var $2,$1;
  22. $2=_st(self)._isBlockContext();
  23. if(smalltalk.assert($2)){
  24. $1=_st(_st(self)._outerContext())._methodContext();
  25. } else {
  26. $1=self;
  27. };
  28. return $1;
  29. }, function($ctx1) {$ctx1.fill(self,"home",{},smalltalk.AIContext)})},
  30. messageSends: ["ifTrue:ifFalse:", "methodContext", "outerContext", "isBlockContext"]}),
  31. smalltalk.AIContext);
  32. smalltalk.addMethod(
  33. smalltalk.method({
  34. selector: "initializeFromMethodContext:",
  35. fn: function (aMethodContext){
  36. var self=this;
  37. return smalltalk.withContext(function($ctx1) {
  38. var $1;
  39. self["@methodContext"]=aMethodContext;
  40. _st(self)._pc_(_st(aMethodContext)._pc());
  41. _st(self)._receiver_(_st(aMethodContext)._receiver());
  42. _st(self)._method_(_st(aMethodContext)._method());
  43. $1=_st(aMethodContext)._outerContext();
  44. if(($receiver = $1) == nil || $receiver == undefined){
  45. $1;
  46. } else {
  47. _st(self)._outerContext_(_st(_st(self)._class())._fromMethodContext_(_st(aMethodContext)._outerContext()));
  48. };
  49. _st(_st(aMethodContext)._locals())._keysAndValuesDo_((function(key,value){
  50. return smalltalk.withContext(function($ctx2) {
  51. return _st(_st(self)._locals())._at_put_(key,value);
  52. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  53. return self}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext)})},
  54. messageSends: ["pc:", "pc", "receiver:", "receiver", "method:", "method", "ifNotNil:", "outerContext:", "fromMethodContext:", "outerContext", "class", "keysAndValuesDo:", "at:put:", "locals"]}),
  55. smalltalk.AIContext);
  56. smalltalk.addMethod(
  57. smalltalk.method({
  58. selector: "initializeLocals",
  59. fn: function (){
  60. var self=this;
  61. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  62. return smalltalk.withContext(function($ctx1) {
  63. self["@locals"]=_st($Dictionary())._new();
  64. _st(self["@locals"])._at_put_("thisContext",self);
  65. return self}, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},smalltalk.AIContext)})},
  66. messageSends: ["new", "at:put:"]}),
  67. smalltalk.AIContext);
  68. smalltalk.addMethod(
  69. smalltalk.method({
  70. selector: "isBlockContext",
  71. fn: function (){
  72. var self=this;
  73. return smalltalk.withContext(function($ctx1) {
  74. var $1;
  75. $1=_st(self["@methodContext"])._isBlockContext();
  76. return $1;
  77. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},smalltalk.AIContext)})},
  78. messageSends: ["isBlockContext"]}),
  79. smalltalk.AIContext);
  80. smalltalk.addMethod(
  81. smalltalk.method({
  82. selector: "localAt:",
  83. fn: function (aString){
  84. var self=this;
  85. return smalltalk.withContext(function($ctx1) {
  86. var $1;
  87. $1=_st(_st(self)._locals())._at_ifAbsent_(aString,(function(){
  88. return smalltalk.withContext(function($ctx2) {
  89. return nil;
  90. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  91. return $1;
  92. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString},smalltalk.AIContext)})},
  93. messageSends: ["at:ifAbsent:", "locals"]}),
  94. smalltalk.AIContext);
  95. smalltalk.addMethod(
  96. smalltalk.method({
  97. selector: "localAt:put:",
  98. fn: function (aString,anObject){
  99. var self=this;
  100. return smalltalk.withContext(function($ctx1) {
  101. _st(_st(self)._locals())._at_put_(aString,anObject);
  102. return self}, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject},smalltalk.AIContext)})},
  103. messageSends: ["at:put:", "locals"]}),
  104. smalltalk.AIContext);
  105. smalltalk.addMethod(
  106. smalltalk.method({
  107. selector: "locals",
  108. fn: function (){
  109. var self=this;
  110. return smalltalk.withContext(function($ctx1) {
  111. var $1,$2;
  112. $1=self["@locals"];
  113. if(($receiver = $1) == nil || $receiver == undefined){
  114. _st(self)._initializeLocals();
  115. } else {
  116. $1;
  117. };
  118. $2=self["@locals"];
  119. return $2;
  120. }, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.AIContext)})},
  121. messageSends: ["ifNil:", "initializeLocals"]}),
  122. smalltalk.AIContext);
  123. smalltalk.addMethod(
  124. smalltalk.method({
  125. selector: "method",
  126. fn: function (){
  127. var self=this;
  128. return smalltalk.withContext(function($ctx1) {
  129. var $1;
  130. $1=self["@method"];
  131. return $1;
  132. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.AIContext)})},
  133. messageSends: []}),
  134. smalltalk.AIContext);
  135. smalltalk.addMethod(
  136. smalltalk.method({
  137. selector: "method:",
  138. fn: function (aCompiledMethod){
  139. var self=this;
  140. return smalltalk.withContext(function($ctx1) {
  141. self["@method"]=aCompiledMethod;
  142. return self}, function($ctx1) {$ctx1.fill(self,"method:",{aCompiledMethod:aCompiledMethod},smalltalk.AIContext)})},
  143. messageSends: []}),
  144. smalltalk.AIContext);
  145. smalltalk.addMethod(
  146. smalltalk.method({
  147. selector: "outerContext",
  148. fn: function (){
  149. var self=this;
  150. return smalltalk.withContext(function($ctx1) {
  151. var $1;
  152. $1=self["@outerContext"];
  153. return $1;
  154. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.AIContext)})},
  155. messageSends: []}),
  156. smalltalk.AIContext);
  157. smalltalk.addMethod(
  158. smalltalk.method({
  159. selector: "outerContext:",
  160. fn: function (anAIContext){
  161. var self=this;
  162. return smalltalk.withContext(function($ctx1) {
  163. self["@outerContext"]=anAIContext;
  164. return self}, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},smalltalk.AIContext)})},
  165. messageSends: []}),
  166. smalltalk.AIContext);
  167. smalltalk.addMethod(
  168. smalltalk.method({
  169. selector: "pc",
  170. fn: function (){
  171. var self=this;
  172. return smalltalk.withContext(function($ctx1) {
  173. var $2,$1;
  174. $2=self["@pc"];
  175. if(($receiver = $2) == nil || $receiver == undefined){
  176. self["@pc"]=(0);
  177. $1=self["@pc"];
  178. } else {
  179. $1=$2;
  180. };
  181. return $1;
  182. }, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.AIContext)})},
  183. messageSends: ["ifNil:"]}),
  184. smalltalk.AIContext);
  185. smalltalk.addMethod(
  186. smalltalk.method({
  187. selector: "pc:",
  188. fn: function (anInteger){
  189. var self=this;
  190. return smalltalk.withContext(function($ctx1) {
  191. self["@pc"]=anInteger;
  192. return self}, function($ctx1) {$ctx1.fill(self,"pc:",{anInteger:anInteger},smalltalk.AIContext)})},
  193. messageSends: []}),
  194. smalltalk.AIContext);
  195. smalltalk.addMethod(
  196. smalltalk.method({
  197. selector: "receiver",
  198. fn: function (){
  199. var self=this;
  200. return smalltalk.withContext(function($ctx1) {
  201. var $1;
  202. $1=_st(self)._localAt_("self");
  203. return $1;
  204. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.AIContext)})},
  205. messageSends: ["localAt:"]}),
  206. smalltalk.AIContext);
  207. smalltalk.addMethod(
  208. smalltalk.method({
  209. selector: "receiver:",
  210. fn: function (anObject){
  211. var self=this;
  212. return smalltalk.withContext(function($ctx1) {
  213. _st(self)._localAt_put_("self",anObject);
  214. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.AIContext)})},
  215. messageSends: ["localAt:put:"]}),
  216. smalltalk.AIContext);
  217. smalltalk.addMethod(
  218. smalltalk.method({
  219. selector: "selector",
  220. fn: function (){
  221. var self=this;
  222. return smalltalk.withContext(function($ctx1) {
  223. var $2,$1;
  224. $2=_st(self)._method();
  225. if(($receiver = $2) == nil || $receiver == undefined){
  226. $1=$2;
  227. } else {
  228. $1=_st(_st(self)._method())._selector();
  229. };
  230. return $1;
  231. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.AIContext)})},
  232. messageSends: ["ifNotNil:", "selector", "method"]}),
  233. smalltalk.AIContext);
  234. smalltalk.addMethod(
  235. smalltalk.method({
  236. selector: "fromMethodContext:",
  237. fn: function (aMethodContext){
  238. var self=this;
  239. return smalltalk.withContext(function($ctx1) {
  240. var $2,$3,$1;
  241. $2=_st(self)._new();
  242. _st($2)._initializeFromMethodContext_(aMethodContext);
  243. $3=_st($2)._yourself();
  244. $1=$3;
  245. return $1;
  246. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext.klass)})},
  247. messageSends: ["initializeFromMethodContext:", "new", "yourself"]}),
  248. smalltalk.AIContext.klass);
  249. smalltalk.addClass('ASTDebugger', smalltalk.Object, ['interpreter', 'context'], 'Compiler-Interpreter');
  250. smalltalk.addMethod(
  251. smalltalk.method({
  252. selector: "atEnd",
  253. fn: function (){
  254. var self=this;
  255. return smalltalk.withContext(function($ctx1) {
  256. var $1;
  257. $1=_st(_st(self)._interpreter())._atEnd();
  258. return $1;
  259. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTDebugger)})},
  260. messageSends: ["atEnd", "interpreter"]}),
  261. smalltalk.ASTDebugger);
  262. smalltalk.addMethod(
  263. smalltalk.method({
  264. selector: "buildAST",
  265. fn: function (){
  266. var self=this;
  267. var ast;
  268. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  269. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  270. return smalltalk.withContext(function($ctx1) {
  271. var $1;
  272. ast=_st(_st($Smalltalk())._current())._parse_(_st(_st(self)._method())._source());
  273. _st(_st($SemanticAnalyzer())._on_(_st(_st(_st(self)._context())._receiver())._class()))._visit_(ast);
  274. $1=ast;
  275. return $1;
  276. }, function($ctx1) {$ctx1.fill(self,"buildAST",{ast:ast},smalltalk.ASTDebugger)})},
  277. messageSends: ["parse:", "source", "method", "current", "visit:", "on:", "class", "receiver", "context"]}),
  278. smalltalk.ASTDebugger);
  279. smalltalk.addMethod(
  280. smalltalk.method({
  281. selector: "context",
  282. fn: function (){
  283. var self=this;
  284. return smalltalk.withContext(function($ctx1) {
  285. var $1;
  286. $1=self["@context"];
  287. return $1;
  288. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTDebugger)})},
  289. messageSends: []}),
  290. smalltalk.ASTDebugger);
  291. smalltalk.addMethod(
  292. smalltalk.method({
  293. selector: "context:",
  294. fn: function (aContext){
  295. var self=this;
  296. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  297. return smalltalk.withContext(function($ctx1) {
  298. self["@context"]=_st($AIContext())._new();
  299. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTDebugger)})},
  300. messageSends: ["new"]}),
  301. smalltalk.ASTDebugger);
  302. smalltalk.addMethod(
  303. smalltalk.method({
  304. selector: "defaultInterpreterClass",
  305. fn: function (){
  306. var self=this;
  307. function $ASTSteppingInterpreter(){return smalltalk.ASTSteppingInterpreter||(typeof ASTSteppingInterpreter=="undefined"?nil:ASTSteppingInterpreter)}
  308. return smalltalk.withContext(function($ctx1) {
  309. var $1;
  310. $1=$ASTSteppingInterpreter();
  311. return $1;
  312. }, function($ctx1) {$ctx1.fill(self,"defaultInterpreterClass",{},smalltalk.ASTDebugger)})},
  313. messageSends: []}),
  314. smalltalk.ASTDebugger);
  315. smalltalk.addMethod(
  316. smalltalk.method({
  317. selector: "initializeInterpreter",
  318. fn: function (){
  319. var self=this;
  320. return smalltalk.withContext(function($ctx1) {
  321. _st(_st(self)._interpreter())._interpret_(_st(_st(_st(self)._buildAST())._nodes())._first());
  322. return self}, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},smalltalk.ASTDebugger)})},
  323. messageSends: ["interpret:", "first", "nodes", "buildAST", "interpreter"]}),
  324. smalltalk.ASTDebugger);
  325. smalltalk.addMethod(
  326. smalltalk.method({
  327. selector: "initializeWithContext:",
  328. fn: function (aMethodContext){
  329. var self=this;
  330. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  331. return smalltalk.withContext(function($ctx1) {
  332. _st(self)._context_(_st($AIContext())._fromMethodContext_(aMethodContext));
  333. _st(self)._initializeInterpreter();
  334. return self}, function($ctx1) {$ctx1.fill(self,"initializeWithContext:",{aMethodContext:aMethodContext},smalltalk.ASTDebugger)})},
  335. messageSends: ["context:", "fromMethodContext:", "initializeInterpreter"]}),
  336. smalltalk.ASTDebugger);
  337. smalltalk.addMethod(
  338. smalltalk.method({
  339. selector: "interpreter",
  340. fn: function (){
  341. var self=this;
  342. return smalltalk.withContext(function($ctx1) {
  343. var $2,$1;
  344. $2=self["@interpreter"];
  345. if(($receiver = $2) == nil || $receiver == undefined){
  346. self["@interpreter"]=_st(_st(self)._defaultInterpreterClass())._new();
  347. $1=self["@interpreter"];
  348. } else {
  349. $1=$2;
  350. };
  351. return $1;
  352. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.ASTDebugger)})},
  353. messageSends: ["ifNil:", "new", "defaultInterpreterClass"]}),
  354. smalltalk.ASTDebugger);
  355. smalltalk.addMethod(
  356. smalltalk.method({
  357. selector: "interpreter:",
  358. fn: function (anInterpreter){
  359. var self=this;
  360. return smalltalk.withContext(function($ctx1) {
  361. self["@interpreter"]=anInterpreter;
  362. return self}, function($ctx1) {$ctx1.fill(self,"interpreter:",{anInterpreter:anInterpreter},smalltalk.ASTDebugger)})},
  363. messageSends: []}),
  364. smalltalk.ASTDebugger);
  365. smalltalk.addMethod(
  366. smalltalk.method({
  367. selector: "method",
  368. fn: function (){
  369. var self=this;
  370. return smalltalk.withContext(function($ctx1) {
  371. var $1;
  372. $1=_st(_st(self)._context())._method();
  373. return $1;
  374. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.ASTDebugger)})},
  375. messageSends: ["method", "context"]}),
  376. smalltalk.ASTDebugger);
  377. smalltalk.addMethod(
  378. smalltalk.method({
  379. selector: "proceed",
  380. fn: function (){
  381. var self=this;
  382. return smalltalk.withContext(function($ctx1) {
  383. _st(self)._shouldBeImplemented();
  384. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.ASTDebugger)})},
  385. messageSends: ["shouldBeImplemented"]}),
  386. smalltalk.ASTDebugger);
  387. smalltalk.addMethod(
  388. smalltalk.method({
  389. selector: "restart",
  390. fn: function (){
  391. var self=this;
  392. return smalltalk.withContext(function($ctx1) {
  393. _st(self)._shouldBeImplemented();
  394. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},smalltalk.ASTDebugger)})},
  395. messageSends: ["shouldBeImplemented"]}),
  396. smalltalk.ASTDebugger);
  397. smalltalk.addMethod(
  398. smalltalk.method({
  399. selector: "step",
  400. fn: function (){
  401. var self=this;
  402. return smalltalk.withContext(function($ctx1) {
  403. _st((function(){
  404. return smalltalk.withContext(function($ctx2) {
  405. return _st(_st(_st(_st(_st(self)._interpreter())._nextNode())._notNil())._and_((function(){
  406. return smalltalk.withContext(function($ctx3) {
  407. return _st(_st(_st(self)._interpreter())._nextNode())._stopOnStepping();
  408. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})))._or_((function(){
  409. return smalltalk.withContext(function($ctx3) {
  410. return _st(_st(_st(self)._interpreter())._atEnd())._not();
  411. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  412. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  413. return smalltalk.withContext(function($ctx2) {
  414. _st(_st(self)._interpreter())._step();
  415. return _st(self)._step();
  416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  417. return self}, function($ctx1) {$ctx1.fill(self,"step",{},smalltalk.ASTDebugger)})},
  418. messageSends: ["whileFalse:", "step", "interpreter", "or:", "not", "atEnd", "and:", "stopOnStepping", "nextNode", "notNil"]}),
  419. smalltalk.ASTDebugger);
  420. smalltalk.addMethod(
  421. smalltalk.method({
  422. selector: "stepInto",
  423. fn: function (){
  424. var self=this;
  425. return smalltalk.withContext(function($ctx1) {
  426. _st(self)._shouldBeImplemented();
  427. return self}, function($ctx1) {$ctx1.fill(self,"stepInto",{},smalltalk.ASTDebugger)})},
  428. messageSends: ["shouldBeImplemented"]}),
  429. smalltalk.ASTDebugger);
  430. smalltalk.addMethod(
  431. smalltalk.method({
  432. selector: "stepOver",
  433. fn: function (){
  434. var self=this;
  435. return smalltalk.withContext(function($ctx1) {
  436. _st(self)._step();
  437. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},smalltalk.ASTDebugger)})},
  438. messageSends: ["step"]}),
  439. smalltalk.ASTDebugger);
  440. smalltalk.addMethod(
  441. smalltalk.method({
  442. selector: "context:",
  443. fn: function (aMethodContext){
  444. var self=this;
  445. return smalltalk.withContext(function($ctx1) {
  446. var $2,$3,$1;
  447. $2=_st(self)._new();
  448. _st($2)._initializeWithContext_(aMethodContext);
  449. $3=_st($2)._yourself();
  450. $1=$3;
  451. return $1;
  452. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},smalltalk.ASTDebugger.klass)})},
  453. messageSends: ["initializeWithContext:", "new", "yourself"]}),
  454. smalltalk.ASTDebugger.klass);
  455. smalltalk.addClass('ASTInterpreter', smalltalk.Object, ['currentNode', 'context', 'shouldReturn', 'result'], 'Compiler-Interpreter');
  456. smalltalk.addMethod(
  457. smalltalk.method({
  458. selector: "assign:to:",
  459. fn: function (aNode,anObject){
  460. var self=this;
  461. return smalltalk.withContext(function($ctx1) {
  462. var $2,$1;
  463. $2=_st(_st(aNode)._binding())._isInstanceVar();
  464. if(smalltalk.assert($2)){
  465. $1=_st(_st(_st(self)._context())._receiver())._instVarAt_put_(_st(aNode)._value(),anObject);
  466. } else {
  467. $1=_st(_st(self)._context())._localAt_put_(_st(aNode)._value(),anObject);
  468. };
  469. return $1;
  470. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},smalltalk.ASTInterpreter)})},
  471. messageSends: ["ifTrue:ifFalse:", "instVarAt:put:", "value", "receiver", "context", "localAt:put:", "isInstanceVar", "binding"]}),
  472. smalltalk.ASTInterpreter);
  473. smalltalk.addMethod(
  474. smalltalk.method({
  475. selector: "context",
  476. fn: function (){
  477. var self=this;
  478. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  479. return smalltalk.withContext(function($ctx1) {
  480. var $2,$1;
  481. $2=self["@context"];
  482. if(($receiver = $2) == nil || $receiver == undefined){
  483. self["@context"]=_st($AIContext())._new();
  484. $1=self["@context"];
  485. } else {
  486. $1=$2;
  487. };
  488. return $1;
  489. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTInterpreter)})},
  490. messageSends: ["ifNil:", "new"]}),
  491. smalltalk.ASTInterpreter);
  492. smalltalk.addMethod(
  493. smalltalk.method({
  494. selector: "context:",
  495. fn: function (anAIContext){
  496. var self=this;
  497. return smalltalk.withContext(function($ctx1) {
  498. self["@context"]=anAIContext;
  499. return self}, function($ctx1) {$ctx1.fill(self,"context:",{anAIContext:anAIContext},smalltalk.ASTInterpreter)})},
  500. messageSends: []}),
  501. smalltalk.ASTInterpreter);
  502. smalltalk.addMethod(
  503. smalltalk.method({
  504. selector: "continue:value:",
  505. fn: function (aBlock,anObject){
  506. var self=this;
  507. return smalltalk.withContext(function($ctx1) {
  508. self["@result"]=anObject;
  509. _st(aBlock)._value_(anObject);
  510. return self}, function($ctx1) {$ctx1.fill(self,"continue:value:",{aBlock:aBlock,anObject:anObject},smalltalk.ASTInterpreter)})},
  511. messageSends: ["value:"]}),
  512. smalltalk.ASTInterpreter);
  513. smalltalk.addMethod(
  514. smalltalk.method({
  515. selector: "currentNode",
  516. fn: function (){
  517. var self=this;
  518. return smalltalk.withContext(function($ctx1) {
  519. var $1;
  520. $1=self["@currentNode"];
  521. return $1;
  522. }, function($ctx1) {$ctx1.fill(self,"currentNode",{},smalltalk.ASTInterpreter)})},
  523. messageSends: []}),
  524. smalltalk.ASTInterpreter);
  525. smalltalk.addMethod(
  526. smalltalk.method({
  527. selector: "eval:",
  528. fn: function (aString){
  529. var self=this;
  530. var source,function_;
  531. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  532. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  533. return smalltalk.withContext(function($ctx1) {
  534. var $1,$2,$3;
  535. source=_st($String())._streamContents_((function(str){
  536. return smalltalk.withContext(function($ctx2) {
  537. _st(str)._nextPutAll_("(function(");
  538. _st(_st(_st(_st(self)._context())._locals())._keys())._do_separatedBy_((function(each){
  539. return smalltalk.withContext(function($ctx3) {
  540. return _st(str)._nextPutAll_(each);
  541. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  542. return smalltalk.withContext(function($ctx3) {
  543. return _st(str)._nextPutAll_(",");
  544. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  545. $1=str;
  546. _st($1)._nextPutAll_("){ return (function() {");
  547. _st($1)._nextPutAll_(aString);
  548. $2=_st($1)._nextPutAll_("})() })");
  549. return $2;
  550. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1)})}));
  551. function_=_st(_st($Compiler())._new())._eval_(source);
  552. $3=_st(function_)._valueWithPossibleArguments_(_st(_st(_st(self)._context())._locals())._values());
  553. return $3;
  554. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},smalltalk.ASTInterpreter)})},
  555. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]}),
  556. smalltalk.ASTInterpreter);
  557. smalltalk.addMethod(
  558. smalltalk.method({
  559. selector: "initialize",
  560. fn: function (){
  561. var self=this;
  562. return smalltalk.withContext(function($ctx1) {
  563. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  564. self["@shouldReturn"]=false;
  565. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ASTInterpreter)})},
  566. messageSends: ["initialize"]}),
  567. smalltalk.ASTInterpreter);
  568. smalltalk.addMethod(
  569. smalltalk.method({
  570. selector: "interpret:",
  571. fn: function (aNode){
  572. var self=this;
  573. return smalltalk.withContext(function($ctx1) {
  574. self["@shouldReturn"]=false;
  575. _st(self)._interpret_continue_(aNode,(function(value){
  576. return smalltalk.withContext(function($ctx2) {
  577. self["@result"]=value;
  578. return self["@result"];
  579. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  580. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  581. messageSends: ["interpret:continue:"]}),
  582. smalltalk.ASTInterpreter);
  583. smalltalk.addMethod(
  584. smalltalk.method({
  585. selector: "interpret:continue:",
  586. fn: function (aNode,aBlock){
  587. var self=this;
  588. return smalltalk.withContext(function($ctx1) {
  589. var $1,$2,$3;
  590. $1=self["@shouldReturn"];
  591. if(smalltalk.assert($1)){
  592. $2=self;
  593. return $2;
  594. };
  595. $3=_st(aNode)._isNode();
  596. if(smalltalk.assert($3)){
  597. self["@currentNode"]=aNode;
  598. self["@currentNode"];
  599. _st(self)._interpretNode_continue_(aNode,(function(value){
  600. return smalltalk.withContext(function($ctx2) {
  601. return _st(self)._continue_value_(aBlock,value);
  602. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  603. } else {
  604. _st(self)._continue_value_(aBlock,aNode);
  605. };
  606. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  607. messageSends: ["ifTrue:", "ifTrue:ifFalse:", "interpretNode:continue:", "continue:value:", "isNode"]}),
  608. smalltalk.ASTInterpreter);
  609. smalltalk.addMethod(
  610. smalltalk.method({
  611. selector: "interpretAll:continue:",
  612. fn: function (aCollection,aBlock){
  613. var self=this;
  614. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  615. return smalltalk.withContext(function($ctx1) {
  616. _st(self)._interpretAll_continue_result_(aCollection,aBlock,_st($OrderedCollection())._new());
  617. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:",{aCollection:aCollection,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  618. messageSends: ["interpretAll:continue:result:", "new"]}),
  619. smalltalk.ASTInterpreter);
  620. smalltalk.addMethod(
  621. smalltalk.method({
  622. selector: "interpretAll:continue:result:",
  623. fn: function (nodes,aBlock,aCollection){
  624. var self=this;
  625. return smalltalk.withContext(function($ctx1) {
  626. var $1;
  627. $1=_st(nodes)._isEmpty();
  628. if(smalltalk.assert($1)){
  629. _st(self)._continue_value_(aBlock,aCollection);
  630. } else {
  631. _st(self)._interpret_continue_(_st(nodes)._first(),(function(value){
  632. return smalltalk.withContext(function($ctx2) {
  633. return _st(self)._interpretAll_continue_result_(_st(nodes)._allButFirst(),aBlock,_st(aCollection).__comma([value]));
  634. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  635. };
  636. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:result:",{nodes:nodes,aBlock:aBlock,aCollection:aCollection},smalltalk.ASTInterpreter)})},
  637. messageSends: ["ifTrue:ifFalse:", "continue:value:", "interpret:continue:", "first", "interpretAll:continue:result:", "allButFirst", ",", "isEmpty"]}),
  638. smalltalk.ASTInterpreter);
  639. smalltalk.addMethod(
  640. smalltalk.method({
  641. selector: "interpretAssignmentNode:continue:",
  642. fn: function (aNode,aBlock){
  643. var self=this;
  644. return smalltalk.withContext(function($ctx1) {
  645. _st(self)._interpret_continue_(_st(aNode)._right(),(function(value){
  646. return smalltalk.withContext(function($ctx2) {
  647. return _st(self)._continue_value_(aBlock,_st(self)._assign_to_(_st(aNode)._left(),value));
  648. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  649. return self}, function($ctx1) {$ctx1.fill(self,"interpretAssignmentNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  650. messageSends: ["interpret:continue:", "right", "continue:value:", "assign:to:", "left"]}),
  651. smalltalk.ASTInterpreter);
  652. smalltalk.addMethod(
  653. smalltalk.method({
  654. selector: "interpretBlockNode:continue:",
  655. fn: function (aNode,aBlock){
  656. var self=this;
  657. return smalltalk.withContext(function($ctx1) {
  658. var $1,$2;
  659. _st(self)._continue_value_(aBlock,(function(){
  660. return smalltalk.withContext(function($ctx2) {
  661. return _st(self)._withBlockContext_((function(){
  662. return smalltalk.withContext(function($ctx3) {
  663. $1=self;
  664. _st($1)._interpret_(_st(_st(aNode)._nodes())._first());
  665. $2=_st($1)._result();
  666. return $2;
  667. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  668. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  669. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  670. messageSends: ["continue:value:", "withBlockContext:", "interpret:", "first", "nodes", "result"]}),
  671. smalltalk.ASTInterpreter);
  672. smalltalk.addMethod(
  673. smalltalk.method({
  674. selector: "interpretBlockSequenceNode:continue:",
  675. fn: function (aNode,aBlock){
  676. var self=this;
  677. return smalltalk.withContext(function($ctx1) {
  678. _st(self)._interpretSequenceNode_continue_(aNode,aBlock);
  679. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockSequenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  680. messageSends: ["interpretSequenceNode:continue:"]}),
  681. smalltalk.ASTInterpreter);
  682. smalltalk.addMethod(
  683. smalltalk.method({
  684. selector: "interpretCascadeNode:continue:",
  685. fn: function (aNode,aBlock){
  686. var self=this;
  687. return smalltalk.withContext(function($ctx1) {
  688. _st(self)._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  689. return smalltalk.withContext(function($ctx2) {
  690. _st(_st(aNode)._nodes())._do_((function(each){
  691. return smalltalk.withContext(function($ctx3) {
  692. return _st(each)._receiver_(receiver);
  693. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  694. return _st(self)._interpretAll_continue_(_st(_st(aNode)._nodes())._allButLast(),(function(){
  695. return smalltalk.withContext(function($ctx3) {
  696. return _st(self)._interpret_continue_(_st(_st(aNode)._nodes())._last(),(function(val){
  697. return smalltalk.withContext(function($ctx4) {
  698. return _st(self)._continue_value_(aBlock,val);
  699. }, function($ctx4) {$ctx4.fillBlock({val:val},$ctx1)})}));
  700. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  701. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  702. return self}, function($ctx1) {$ctx1.fill(self,"interpretCascadeNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  703. messageSends: ["interpret:continue:", "receiver", "do:", "receiver:", "nodes", "interpretAll:continue:", "allButLast", "last", "continue:value:"]}),
  704. smalltalk.ASTInterpreter);
  705. smalltalk.addMethod(
  706. smalltalk.method({
  707. selector: "interpretClassReferenceNode:continue:",
  708. fn: function (aNode,aBlock){
  709. var self=this;
  710. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  711. return smalltalk.withContext(function($ctx1) {
  712. _st(self)._continue_value_(aBlock,_st(_st($Smalltalk())._current())._at_(_st(aNode)._value()));
  713. return self}, function($ctx1) {$ctx1.fill(self,"interpretClassReferenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  714. messageSends: ["continue:value:", "at:", "value", "current"]}),
  715. smalltalk.ASTInterpreter);
  716. smalltalk.addMethod(
  717. smalltalk.method({
  718. selector: "interpretDynamicArrayNode:continue:",
  719. fn: function (aNode,aBlock){
  720. var self=this;
  721. return smalltalk.withContext(function($ctx1) {
  722. _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  723. return smalltalk.withContext(function($ctx2) {
  724. return _st(self)._continue_value_(aBlock,array);
  725. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  726. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicArrayNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  727. messageSends: ["interpretAll:continue:", "nodes", "continue:value:"]}),
  728. smalltalk.ASTInterpreter);
  729. smalltalk.addMethod(
  730. smalltalk.method({
  731. selector: "interpretDynamicDictionaryNode:continue:",
  732. fn: function (aNode,aBlock){
  733. var self=this;
  734. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  735. return smalltalk.withContext(function($ctx1) {
  736. _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  737. var hashedCollection;
  738. return smalltalk.withContext(function($ctx2) {
  739. hashedCollection=_st($HashedCollection())._new();
  740. hashedCollection;
  741. _st(array)._do_((function(each){
  742. return smalltalk.withContext(function($ctx3) {
  743. return _st(hashedCollection)._add_(each);
  744. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  745. return _st(self)._continue_value_(aBlock,hashedCollection);
  746. }, function($ctx2) {$ctx2.fillBlock({array:array,hashedCollection:hashedCollection},$ctx1)})}));
  747. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicDictionaryNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  748. messageSends: ["interpretAll:continue:", "nodes", "new", "do:", "add:", "continue:value:"]}),
  749. smalltalk.ASTInterpreter);
  750. smalltalk.addMethod(
  751. smalltalk.method({
  752. selector: "interpretJSStatementNode:continue:",
  753. fn: function (aNode,aBlock){
  754. var self=this;
  755. return smalltalk.withContext(function($ctx1) {
  756. self["@shouldReturn"]=true;
  757. _st(self)._continue_value_(aBlock,_st(self)._eval_(_st(aNode)._source()));
  758. return self}, function($ctx1) {$ctx1.fill(self,"interpretJSStatementNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  759. messageSends: ["continue:value:", "eval:", "source"]}),
  760. smalltalk.ASTInterpreter);
  761. smalltalk.addMethod(
  762. smalltalk.method({
  763. selector: "interpretMethodNode:continue:",
  764. fn: function (aNode,aBlock){
  765. var self=this;
  766. return smalltalk.withContext(function($ctx1) {
  767. _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  768. return smalltalk.withContext(function($ctx2) {
  769. return _st(self)._continue_value_(aBlock,_st(array)._first());
  770. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  771. return self}, function($ctx1) {$ctx1.fill(self,"interpretMethodNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  772. messageSends: ["interpretAll:continue:", "nodes", "continue:value:", "first"]}),
  773. smalltalk.ASTInterpreter);
  774. smalltalk.addMethod(
  775. smalltalk.method({
  776. selector: "interpretNode:continue:",
  777. fn: function (aNode,aBlock){
  778. var self=this;
  779. return smalltalk.withContext(function($ctx1) {
  780. _st(aNode)._interpreter_continue_(self,aBlock);
  781. return self}, function($ctx1) {$ctx1.fill(self,"interpretNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  782. messageSends: ["interpreter:continue:"]}),
  783. smalltalk.ASTInterpreter);
  784. smalltalk.addMethod(
  785. smalltalk.method({
  786. selector: "interpretReturnNode:continue:",
  787. fn: function (aNode,aBlock){
  788. var self=this;
  789. return smalltalk.withContext(function($ctx1) {
  790. _st(self)._interpret_continue_(_st(_st(aNode)._nodes())._first(),(function(value){
  791. return smalltalk.withContext(function($ctx2) {
  792. self["@shouldReturn"]=true;
  793. self["@shouldReturn"];
  794. return _st(self)._continue_value_(aBlock,value);
  795. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  796. return self}, function($ctx1) {$ctx1.fill(self,"interpretReturnNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  797. messageSends: ["interpret:continue:", "first", "nodes", "continue:value:"]}),
  798. smalltalk.ASTInterpreter);
  799. smalltalk.addMethod(
  800. smalltalk.method({
  801. selector: "interpretSendNode:continue:",
  802. fn: function (aNode,aBlock){
  803. var self=this;
  804. return smalltalk.withContext(function($ctx1) {
  805. _st(self)._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  806. return smalltalk.withContext(function($ctx2) {
  807. return _st(self)._interpretAll_continue_(_st(aNode)._arguments(),(function(args){
  808. return smalltalk.withContext(function($ctx3) {
  809. return _st(self)._messageFromSendNode_arguments_do_(aNode,args,(function(message){
  810. return smalltalk.withContext(function($ctx4) {
  811. _st(_st(self)._context())._pc_(_st(_st(_st(self)._context())._pc()).__plus((1)));
  812. return _st(self)._continue_value_(aBlock,_st(self)._sendMessage_to_superSend_(message,receiver,_st(aNode)._superSend()));
  813. }, function($ctx4) {$ctx4.fillBlock({message:message},$ctx1)})}));
  814. }, function($ctx3) {$ctx3.fillBlock({args:args},$ctx1)})}));
  815. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  816. return self}, function($ctx1) {$ctx1.fill(self,"interpretSendNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  817. messageSends: ["interpret:continue:", "receiver", "interpretAll:continue:", "arguments", "messageFromSendNode:arguments:do:", "pc:", "+", "pc", "context", "continue:value:", "sendMessage:to:superSend:", "superSend"]}),
  818. smalltalk.ASTInterpreter);
  819. smalltalk.addMethod(
  820. smalltalk.method({
  821. selector: "interpretSequenceNode:continue:",
  822. fn: function (aNode,aBlock){
  823. var self=this;
  824. return smalltalk.withContext(function($ctx1) {
  825. _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  826. return smalltalk.withContext(function($ctx2) {
  827. return _st(self)._continue_value_(aBlock,_st(array)._last());
  828. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  829. return self}, function($ctx1) {$ctx1.fill(self,"interpretSequenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  830. messageSends: ["interpretAll:continue:", "nodes", "continue:value:", "last"]}),
  831. smalltalk.ASTInterpreter);
  832. smalltalk.addMethod(
  833. smalltalk.method({
  834. selector: "interpretValueNode:continue:",
  835. fn: function (aNode,aBlock){
  836. var self=this;
  837. return smalltalk.withContext(function($ctx1) {
  838. _st(self)._continue_value_(aBlock,_st(aNode)._value());
  839. return self}, function($ctx1) {$ctx1.fill(self,"interpretValueNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  840. messageSends: ["continue:value:", "value"]}),
  841. smalltalk.ASTInterpreter);
  842. smalltalk.addMethod(
  843. smalltalk.method({
  844. selector: "interpretVariableNode:continue:",
  845. fn: function (aNode,aBlock){
  846. var self=this;
  847. return smalltalk.withContext(function($ctx1) {
  848. var $1,$2,$4,$3;
  849. $1=self;
  850. $2=aBlock;
  851. $4=_st(_st(aNode)._binding())._isInstanceVar();
  852. if(smalltalk.assert($4)){
  853. $3=_st(_st(_st(self)._context())._receiver())._instVarAt_(_st(aNode)._value());
  854. } else {
  855. $3=_st(_st(self)._context())._localAt_(_st(aNode)._value());
  856. };
  857. _st($1)._continue_value_($2,$3);
  858. return self}, function($ctx1) {$ctx1.fill(self,"interpretVariableNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  859. messageSends: ["continue:value:", "ifTrue:ifFalse:", "instVarAt:", "value", "receiver", "context", "localAt:", "isInstanceVar", "binding"]}),
  860. smalltalk.ASTInterpreter);
  861. smalltalk.addMethod(
  862. smalltalk.method({
  863. selector: "messageFromSendNode:arguments:do:",
  864. fn: function (aSendNode,aCollection,aBlock){
  865. var self=this;
  866. function $Message(){return smalltalk.Message||(typeof Message=="undefined"?nil:Message)}
  867. return smalltalk.withContext(function($ctx1) {
  868. var $1,$2;
  869. $1=_st($Message())._new();
  870. _st($1)._selector_(_st(aSendNode)._selector());
  871. _st($1)._arguments_(aCollection);
  872. $2=_st($1)._yourself();
  873. _st(self)._continue_value_(aBlock,$2);
  874. return self}, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:do:",{aSendNode:aSendNode,aCollection:aCollection,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  875. messageSends: ["continue:value:", "selector:", "selector", "new", "arguments:", "yourself"]}),
  876. smalltalk.ASTInterpreter);
  877. smalltalk.addMethod(
  878. smalltalk.method({
  879. selector: "result",
  880. fn: function (){
  881. var self=this;
  882. return smalltalk.withContext(function($ctx1) {
  883. var $1;
  884. $1=self["@result"];
  885. return $1;
  886. }, function($ctx1) {$ctx1.fill(self,"result",{},smalltalk.ASTInterpreter)})},
  887. messageSends: []}),
  888. smalltalk.ASTInterpreter);
  889. smalltalk.addMethod(
  890. smalltalk.method({
  891. selector: "sendMessage:to:superSend:",
  892. fn: function (aMessage,anObject,aBoolean){
  893. var self=this;
  894. var method;
  895. return smalltalk.withContext(function($ctx1) {
  896. var $1,$2,$3,$4,$5,$6;
  897. var $early={};
  898. try {
  899. $1=aBoolean;
  900. if(! smalltalk.assert($1)){
  901. $2=_st(aMessage)._sendTo_(anObject);
  902. return $2;
  903. };
  904. $3=_st(_st(anObject)._class())._superclass();
  905. if(($receiver = $3) == nil || $receiver == undefined){
  906. $4=_st(self)._messageNotUnderstood_receiver_(aMessage,anObject);
  907. return $4;
  908. } else {
  909. $3;
  910. };
  911. method=_st(_st(_st(_st(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_(_st(aMessage)._selector(),(function(){
  912. return smalltalk.withContext(function($ctx2) {
  913. $5=_st(self)._messageNotUnderstood_receiver_(aMessage,anObject);
  914. throw $early=[$5];
  915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  916. $6=_st(_st(method)._fn())._applyTo_arguments_(anObject,_st(aMessage)._arguments());
  917. return $6;
  918. }
  919. catch(e) {if(e===$early)return e[0]; throw e}
  920. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},smalltalk.ASTInterpreter)})},
  921. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "messageNotUnderstood:receiver:", "superclass", "class", "at:ifAbsent:", "selector", "methodDictionary", "applyTo:arguments:", "arguments", "fn"]}),
  922. smalltalk.ASTInterpreter);
  923. smalltalk.addMethod(
  924. smalltalk.method({
  925. selector: "shouldReturn",
  926. fn: function (){
  927. var self=this;
  928. return smalltalk.withContext(function($ctx1) {
  929. var $2,$1;
  930. $2=self["@shouldReturn"];
  931. if(($receiver = $2) == nil || $receiver == undefined){
  932. $1=false;
  933. } else {
  934. $1=$2;
  935. };
  936. return $1;
  937. }, function($ctx1) {$ctx1.fill(self,"shouldReturn",{},smalltalk.ASTInterpreter)})},
  938. messageSends: ["ifNil:"]}),
  939. smalltalk.ASTInterpreter);
  940. smalltalk.addMethod(
  941. smalltalk.method({
  942. selector: "withBlockContext:",
  943. fn: function (aBlock){
  944. var self=this;
  945. var blockResult;
  946. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  947. return smalltalk.withContext(function($ctx1) {
  948. var $1,$2,$3;
  949. $1=_st($AIContext())._new();
  950. _st($1)._outerContext_(_st(self)._context());
  951. $2=_st($1)._yourself();
  952. _st(self)._context_($2);
  953. blockResult=_st(aBlock)._value();
  954. _st(self)._context_(_st(_st(self)._context())._outerContext());
  955. $3=blockResult;
  956. return $3;
  957. }, function($ctx1) {$ctx1.fill(self,"withBlockContext:",{aBlock:aBlock,blockResult:blockResult},smalltalk.ASTInterpreter)})},
  958. messageSends: ["context:", "outerContext:", "context", "new", "yourself", "value", "outerContext"]}),
  959. smalltalk.ASTInterpreter);
  960. smalltalk.addClass('ASTSteppingInterpreter', smalltalk.ASTInterpreter, ['continuation', 'nextNode'], 'Compiler-Interpreter');
  961. smalltalk.addMethod(
  962. smalltalk.method({
  963. selector: "atEnd",
  964. fn: function (){
  965. var self=this;
  966. return smalltalk.withContext(function($ctx1) {
  967. var $1;
  968. $1=_st(_st(self)._shouldReturn())._or_((function(){
  969. return smalltalk.withContext(function($ctx2) {
  970. return _st(_st(self)._nextNode()).__eq_eq(_st(self)._currentNode());
  971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  972. return $1;
  973. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTSteppingInterpreter)})},
  974. messageSends: ["or:", "==", "currentNode", "nextNode", "shouldReturn"]}),
  975. smalltalk.ASTSteppingInterpreter);
  976. smalltalk.addMethod(
  977. smalltalk.method({
  978. selector: "initialize",
  979. fn: function (){
  980. var self=this;
  981. return smalltalk.withContext(function($ctx1) {
  982. smalltalk.ASTInterpreter.fn.prototype._initialize.apply(_st(self), []);
  983. self["@continuation"]=(function(){
  984. return smalltalk.withContext(function($ctx2) {
  985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  986. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ASTSteppingInterpreter)})},
  987. messageSends: ["initialize"]}),
  988. smalltalk.ASTSteppingInterpreter);
  989. smalltalk.addMethod(
  990. smalltalk.method({
  991. selector: "interpret:continue:",
  992. fn: function (aNode,aBlock){
  993. var self=this;
  994. return smalltalk.withContext(function($ctx1) {
  995. self["@nextNode"]=aNode;
  996. self["@continuation"]=(function(){
  997. return smalltalk.withContext(function($ctx2) {
  998. return smalltalk.ASTInterpreter.fn.prototype._interpret_continue_.apply(_st(self), [aNode,aBlock]);
  999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  1000. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTSteppingInterpreter)})},
  1001. messageSends: ["interpret:continue:"]}),
  1002. smalltalk.ASTSteppingInterpreter);
  1003. smalltalk.addMethod(
  1004. smalltalk.method({
  1005. selector: "nextNode",
  1006. fn: function (){
  1007. var self=this;
  1008. return smalltalk.withContext(function($ctx1) {
  1009. var $1;
  1010. $1=self["@nextNode"];
  1011. return $1;
  1012. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.ASTSteppingInterpreter)})},
  1013. messageSends: []}),
  1014. smalltalk.ASTSteppingInterpreter);
  1015. smalltalk.addMethod(
  1016. smalltalk.method({
  1017. selector: "step",
  1018. fn: function (){
  1019. var self=this;
  1020. return smalltalk.withContext(function($ctx1) {
  1021. _st(self["@continuation"])._value();
  1022. return self}, function($ctx1) {$ctx1.fill(self,"step",{},smalltalk.ASTSteppingInterpreter)})},
  1023. messageSends: ["value"]}),
  1024. smalltalk.ASTSteppingInterpreter);
  1025. smalltalk.addMethod(
  1026. smalltalk.method({
  1027. selector: "interpreter:continue:",
  1028. fn: function (anInterpreter,aBlock){
  1029. var self=this;
  1030. return smalltalk.withContext(function($ctx1) {
  1031. var $1;
  1032. $1=_st(anInterpreter)._interpretNode_continue_(self,aBlock);
  1033. return $1;
  1034. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.Node)})},
  1035. messageSends: ["interpretNode:continue:"]}),
  1036. smalltalk.Node);
  1037. smalltalk.addMethod(
  1038. smalltalk.method({
  1039. selector: "isSteppingNode",
  1040. fn: function (){
  1041. var self=this;
  1042. return smalltalk.withContext(function($ctx1) {
  1043. return false;
  1044. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.Node)})},
  1045. messageSends: []}),
  1046. smalltalk.Node);
  1047. smalltalk.addMethod(
  1048. smalltalk.method({
  1049. selector: "interpreter:continue:",
  1050. fn: function (anInterpreter,aBlock){
  1051. var self=this;
  1052. return smalltalk.withContext(function($ctx1) {
  1053. var $1;
  1054. $1=_st(anInterpreter)._interpretAssignmentNode_continue_(self,aBlock);
  1055. return $1;
  1056. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.AssignmentNode)})},
  1057. messageSends: ["interpretAssignmentNode:continue:"]}),
  1058. smalltalk.AssignmentNode);
  1059. smalltalk.addMethod(
  1060. smalltalk.method({
  1061. selector: "isSteppingNode",
  1062. fn: function (){
  1063. var self=this;
  1064. return smalltalk.withContext(function($ctx1) {
  1065. return true;
  1066. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.AssignmentNode)})},
  1067. messageSends: []}),
  1068. smalltalk.AssignmentNode);
  1069. smalltalk.addMethod(
  1070. smalltalk.method({
  1071. selector: "interpreter:continue:",
  1072. fn: function (anInterpreter,aBlock){
  1073. var self=this;
  1074. return smalltalk.withContext(function($ctx1) {
  1075. var $1;
  1076. $1=_st(anInterpreter)._interpretBlockNode_continue_(self,aBlock);
  1077. return $1;
  1078. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.BlockNode)})},
  1079. messageSends: ["interpretBlockNode:continue:"]}),
  1080. smalltalk.BlockNode);
  1081. smalltalk.addMethod(
  1082. smalltalk.method({
  1083. selector: "isSteppingNode",
  1084. fn: function (){
  1085. var self=this;
  1086. return smalltalk.withContext(function($ctx1) {
  1087. return true;
  1088. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.BlockNode)})},
  1089. messageSends: []}),
  1090. smalltalk.BlockNode);
  1091. smalltalk.addMethod(
  1092. smalltalk.method({
  1093. selector: "interpreter:continue:",
  1094. fn: function (anInterpreter,aBlock){
  1095. var self=this;
  1096. return smalltalk.withContext(function($ctx1) {
  1097. var $1;
  1098. $1=_st(anInterpreter)._interpretCascadeNode_continue_(self,aBlock);
  1099. return $1;
  1100. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.CascadeNode)})},
  1101. messageSends: ["interpretCascadeNode:continue:"]}),
  1102. smalltalk.CascadeNode);
  1103. smalltalk.addMethod(
  1104. smalltalk.method({
  1105. selector: "interpreter:continue:",
  1106. fn: function (anInterpreter,aBlock){
  1107. var self=this;
  1108. return smalltalk.withContext(function($ctx1) {
  1109. var $1;
  1110. $1=_st(anInterpreter)._interpretDynamicArrayNode_continue_(self,aBlock);
  1111. return $1;
  1112. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.DynamicArrayNode)})},
  1113. messageSends: ["interpretDynamicArrayNode:continue:"]}),
  1114. smalltalk.DynamicArrayNode);
  1115. smalltalk.addMethod(
  1116. smalltalk.method({
  1117. selector: "isSteppingNode",
  1118. fn: function (){
  1119. var self=this;
  1120. return smalltalk.withContext(function($ctx1) {
  1121. return true;
  1122. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicArrayNode)})},
  1123. messageSends: []}),
  1124. smalltalk.DynamicArrayNode);
  1125. smalltalk.addMethod(
  1126. smalltalk.method({
  1127. selector: "interpreter:continue:",
  1128. fn: function (anInterpreter,aBlock){
  1129. var self=this;
  1130. return smalltalk.withContext(function($ctx1) {
  1131. var $1;
  1132. $1=_st(anInterpreter)._interpretDynamicDictionaryNode_continue_(self,aBlock);
  1133. return $1;
  1134. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.DynamicDictionaryNode)})},
  1135. messageSends: ["interpretDynamicDictionaryNode:continue:"]}),
  1136. smalltalk.DynamicDictionaryNode);
  1137. smalltalk.addMethod(
  1138. smalltalk.method({
  1139. selector: "isSteppingNode",
  1140. fn: function (){
  1141. var self=this;
  1142. return smalltalk.withContext(function($ctx1) {
  1143. return true;
  1144. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicDictionaryNode)})},
  1145. messageSends: []}),
  1146. smalltalk.DynamicDictionaryNode);
  1147. smalltalk.addMethod(
  1148. smalltalk.method({
  1149. selector: "interpreter:continue:",
  1150. fn: function (anInterpreter,aBlock){
  1151. var self=this;
  1152. return smalltalk.withContext(function($ctx1) {
  1153. var $1;
  1154. $1=_st(anInterpreter)._interpretJSStatementNode_continue_(self,aBlock);
  1155. return $1;
  1156. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.JSStatementNode)})},
  1157. messageSends: ["interpretJSStatementNode:continue:"]}),
  1158. smalltalk.JSStatementNode);
  1159. smalltalk.addMethod(
  1160. smalltalk.method({
  1161. selector: "isSteppingNode",
  1162. fn: function (){
  1163. var self=this;
  1164. return smalltalk.withContext(function($ctx1) {
  1165. return true;
  1166. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.JSStatementNode)})},
  1167. messageSends: []}),
  1168. smalltalk.JSStatementNode);
  1169. smalltalk.addMethod(
  1170. smalltalk.method({
  1171. selector: "interpreter:continue:",
  1172. fn: function (anInterpreter,aBlock){
  1173. var self=this;
  1174. return smalltalk.withContext(function($ctx1) {
  1175. var $1;
  1176. $1=_st(anInterpreter)._interpretMethodNode_continue_(self,aBlock);
  1177. return $1;
  1178. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.MethodNode)})},
  1179. messageSends: ["interpretMethodNode:continue:"]}),
  1180. smalltalk.MethodNode);
  1181. smalltalk.addMethod(
  1182. smalltalk.method({
  1183. selector: "interpreter:continue:",
  1184. fn: function (anInterpreter,aBlock){
  1185. var self=this;
  1186. return smalltalk.withContext(function($ctx1) {
  1187. var $1;
  1188. $1=_st(anInterpreter)._interpretReturnNode_continue_(self,aBlock);
  1189. return $1;
  1190. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ReturnNode)})},
  1191. messageSends: ["interpretReturnNode:continue:"]}),
  1192. smalltalk.ReturnNode);
  1193. smalltalk.addMethod(
  1194. smalltalk.method({
  1195. selector: "interpreter:continue:",
  1196. fn: function (anInterpreter,aBlock){
  1197. var self=this;
  1198. return smalltalk.withContext(function($ctx1) {
  1199. var $1;
  1200. $1=_st(anInterpreter)._interpretSendNode_continue_(self,aBlock);
  1201. return $1;
  1202. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.SendNode)})},
  1203. messageSends: ["interpretSendNode:continue:"]}),
  1204. smalltalk.SendNode);
  1205. smalltalk.addMethod(
  1206. smalltalk.method({
  1207. selector: "isSteppingNode",
  1208. fn: function (){
  1209. var self=this;
  1210. return smalltalk.withContext(function($ctx1) {
  1211. return true;
  1212. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.SendNode)})},
  1213. messageSends: []}),
  1214. smalltalk.SendNode);
  1215. smalltalk.addMethod(
  1216. smalltalk.method({
  1217. selector: "interpreter:continue:",
  1218. fn: function (anInterpreter,aBlock){
  1219. var self=this;
  1220. return smalltalk.withContext(function($ctx1) {
  1221. var $1;
  1222. $1=_st(anInterpreter)._interpretSequenceNode_continue_(self,aBlock);
  1223. return $1;
  1224. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.SequenceNode)})},
  1225. messageSends: ["interpretSequenceNode:continue:"]}),
  1226. smalltalk.SequenceNode);
  1227. smalltalk.addMethod(
  1228. smalltalk.method({
  1229. selector: "interpreter:continue:",
  1230. fn: function (anInterpreter,aBlock){
  1231. var self=this;
  1232. return smalltalk.withContext(function($ctx1) {
  1233. var $1;
  1234. $1=_st(anInterpreter)._interpretBlockSequenceNode_continue_(self,aBlock);
  1235. return $1;
  1236. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.BlockSequenceNode)})},
  1237. messageSends: ["interpretBlockSequenceNode:continue:"]}),
  1238. smalltalk.BlockSequenceNode);
  1239. smalltalk.addMethod(
  1240. smalltalk.method({
  1241. selector: "interpreter:continue:",
  1242. fn: function (anInterpreter,aBlock){
  1243. var self=this;
  1244. return smalltalk.withContext(function($ctx1) {
  1245. var $1;
  1246. $1=_st(anInterpreter)._interpretValueNode_continue_(self,aBlock);
  1247. return $1;
  1248. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ValueNode)})},
  1249. messageSends: ["interpretValueNode:continue:"]}),
  1250. smalltalk.ValueNode);
  1251. smalltalk.addMethod(
  1252. smalltalk.method({
  1253. selector: "interpreter:continue:",
  1254. fn: function (anInterpreter,aBlock){
  1255. var self=this;
  1256. return smalltalk.withContext(function($ctx1) {
  1257. var $1;
  1258. $1=_st(anInterpreter)._interpretVariableNode_continue_(self,aBlock);
  1259. return $1;
  1260. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.VariableNode)})},
  1261. messageSends: ["interpretVariableNode:continue:"]}),
  1262. smalltalk.VariableNode);
  1263. smalltalk.addMethod(
  1264. smalltalk.method({
  1265. selector: "interpreter:continue:",
  1266. fn: function (anInterpreter,aBlock){
  1267. var self=this;
  1268. return smalltalk.withContext(function($ctx1) {
  1269. var $1;
  1270. $1=_st(anInterpreter)._interpretClassReferenceNode_continue_(self,aBlock);
  1271. return $1;
  1272. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ClassReferenceNode)})},
  1273. messageSends: ["interpretClassReferenceNode:continue:"]}),
  1274. smalltalk.ClassReferenceNode);