2
0

Compiler-Interpreter.js 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046
  1. smalltalk.addPackage('Compiler-Interpreter');
  2. smalltalk.addClass('AIContext', smalltalk.NodeVisitor, ['methodContext', 'outerContext', 'pc', 'locals', 'method'], 'Compiler-Interpreter');
  3. smalltalk.AIContext.comment="I am like a `MethodContext`, used by the `ASTInterpreter`.\x0aUnlike a `MethodContext`, my instances are not read-only.\x0a\x0aWhen debugging, my instances are created by copying the current `MethodContext` (thisContext)";
  4. smalltalk.addMethod(
  5. smalltalk.method({
  6. selector: "asString",
  7. category: 'converting',
  8. fn: function (){
  9. var self=this;
  10. return smalltalk.withContext(function($ctx1) {
  11. var $1;
  12. $1=_st(self["@methodContext"])._asString();
  13. return $1;
  14. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.AIContext)})},
  15. args: [],
  16. source: "asString\x0a\x09^ methodContext asString",
  17. messageSends: ["asString"],
  18. referencedClasses: []
  19. }),
  20. smalltalk.AIContext);
  21. smalltalk.addMethod(
  22. smalltalk.method({
  23. selector: "home",
  24. category: 'accessing',
  25. fn: function (){
  26. var self=this;
  27. return smalltalk.withContext(function($ctx1) {
  28. var $2,$1;
  29. $2=_st(self)._isBlockContext();
  30. if(smalltalk.assert($2)){
  31. $1=_st(_st(self)._outerContext())._methodContext();
  32. } else {
  33. $1=self;
  34. };
  35. return $1;
  36. }, function($ctx1) {$ctx1.fill(self,"home",{},smalltalk.AIContext)})},
  37. args: [],
  38. source: "home\x0a\x09^ self isBlockContext \x0a\x09\x09ifTrue: [ self outerContext methodContext ]\x0a\x09\x09ifFalse: [ self ]",
  39. messageSends: ["ifTrue:ifFalse:", "methodContext", "outerContext", "isBlockContext"],
  40. referencedClasses: []
  41. }),
  42. smalltalk.AIContext);
  43. smalltalk.addMethod(
  44. smalltalk.method({
  45. selector: "initializeFromMethodContext:",
  46. category: 'initialization',
  47. fn: function (aMethodContext){
  48. var self=this;
  49. return smalltalk.withContext(function($ctx1) {
  50. var $1,$2;
  51. self["@methodContext"]=aMethodContext;
  52. _st(self)._pc_(_st(aMethodContext)._pc());
  53. _st(self)._receiver_(_st(aMethodContext)._receiver());
  54. _st(self)._method_(_st(aMethodContext)._method());
  55. $1=_st(aMethodContext)._outerContext();
  56. if(($receiver = $1) == nil || $receiver == undefined){
  57. $1;
  58. } else {
  59. var outer;
  60. outer=$receiver;
  61. $2=_st(outer)._methodContext();
  62. if(($receiver = $2) == nil || $receiver == undefined){
  63. $2;
  64. } else {
  65. _st(self)._outerContext_(_st(_st(self)._class())._fromMethodContext_(_st(aMethodContext)._outerContext()));
  66. };
  67. _st(_st(aMethodContext)._locals())._keysAndValuesDo_((function(key,value){
  68. return smalltalk.withContext(function($ctx2) {
  69. return _st(_st(self)._locals())._at_put_(key,value);
  70. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  71. };
  72. return self}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext)})},
  73. args: ["aMethodContext"],
  74. source: "initializeFromMethodContext: aMethodContext\x0a\x09methodContext := aMethodContext.\x0a\x09\x0a\x09self pc: aMethodContext pc.\x0a\x09self receiver: aMethodContext receiver.\x0a\x09self method: aMethodContext method.\x0a\x09aMethodContext outerContext ifNotNil: [ :outer |\x0a\x09\x09\x22If the method context is nil, the block was defined in JS, so ignore it\x22\x0a\x09\x09outer methodContext ifNotNil: [\x0a\x09\x09\x09self outerContext: (self class fromMethodContext: aMethodContext outerContext) ].\x0a\x09\x09\x09aMethodContext locals keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09\x09self locals at: key put: value ] ]",
  75. messageSends: ["pc:", "pc", "receiver:", "receiver", "method:", "method", "ifNotNil:", "outerContext:", "fromMethodContext:", "outerContext", "class", "methodContext", "keysAndValuesDo:", "at:put:", "locals"],
  76. referencedClasses: []
  77. }),
  78. smalltalk.AIContext);
  79. smalltalk.addMethod(
  80. smalltalk.method({
  81. selector: "initializeLocals",
  82. category: 'initialization',
  83. fn: function (){
  84. var self=this;
  85. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  86. return smalltalk.withContext(function($ctx1) {
  87. self["@locals"]=_st($Dictionary())._new();
  88. _st(self["@locals"])._at_put_("thisContext",self);
  89. return self}, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},smalltalk.AIContext)})},
  90. args: [],
  91. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  92. messageSends: ["new", "at:put:"],
  93. referencedClasses: ["Dictionary"]
  94. }),
  95. smalltalk.AIContext);
  96. smalltalk.addMethod(
  97. smalltalk.method({
  98. selector: "isBlockContext",
  99. category: 'testing',
  100. fn: function (){
  101. var self=this;
  102. return smalltalk.withContext(function($ctx1) {
  103. var $1;
  104. $1=_st(self["@methodContext"])._isBlockContext();
  105. return $1;
  106. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},smalltalk.AIContext)})},
  107. args: [],
  108. source: "isBlockContext\x0a\x09^ methodContext isBlockContext",
  109. messageSends: ["isBlockContext"],
  110. referencedClasses: []
  111. }),
  112. smalltalk.AIContext);
  113. smalltalk.addMethod(
  114. smalltalk.method({
  115. selector: "localAt:",
  116. category: 'accessing',
  117. fn: function (aString){
  118. var self=this;
  119. return smalltalk.withContext(function($ctx1) {
  120. var $1;
  121. $1=_st(_st(self)._locals())._at_ifAbsent_(aString,(function(){
  122. return smalltalk.withContext(function($ctx2) {
  123. return nil;
  124. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  125. return $1;
  126. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString},smalltalk.AIContext)})},
  127. args: ["aString"],
  128. source: "localAt: aString\x0a\x09^ self locals at: aString ifAbsent: [ nil ]",
  129. messageSends: ["at:ifAbsent:", "locals"],
  130. referencedClasses: []
  131. }),
  132. smalltalk.AIContext);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "localAt:put:",
  136. category: 'accessing',
  137. fn: function (aString,anObject){
  138. var self=this;
  139. return smalltalk.withContext(function($ctx1) {
  140. _st(_st(self)._locals())._at_put_(aString,anObject);
  141. return self}, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject},smalltalk.AIContext)})},
  142. args: ["aString", "anObject"],
  143. source: "localAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  144. messageSends: ["at:put:", "locals"],
  145. referencedClasses: []
  146. }),
  147. smalltalk.AIContext);
  148. smalltalk.addMethod(
  149. smalltalk.method({
  150. selector: "locals",
  151. category: 'accessing',
  152. fn: function (){
  153. var self=this;
  154. return smalltalk.withContext(function($ctx1) {
  155. var $1,$2;
  156. $1=self["@locals"];
  157. if(($receiver = $1) == nil || $receiver == undefined){
  158. _st(self)._initializeLocals();
  159. } else {
  160. $1;
  161. };
  162. $2=self["@locals"];
  163. return $2;
  164. }, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.AIContext)})},
  165. args: [],
  166. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  167. messageSends: ["ifNil:", "initializeLocals"],
  168. referencedClasses: []
  169. }),
  170. smalltalk.AIContext);
  171. smalltalk.addMethod(
  172. smalltalk.method({
  173. selector: "method",
  174. category: 'accessing',
  175. fn: function (){
  176. var self=this;
  177. return smalltalk.withContext(function($ctx1) {
  178. var $1;
  179. $1=self["@method"];
  180. return $1;
  181. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.AIContext)})},
  182. args: [],
  183. source: "method\x0a\x09^ method",
  184. messageSends: [],
  185. referencedClasses: []
  186. }),
  187. smalltalk.AIContext);
  188. smalltalk.addMethod(
  189. smalltalk.method({
  190. selector: "method:",
  191. category: 'accessing',
  192. fn: function (aCompiledMethod){
  193. var self=this;
  194. return smalltalk.withContext(function($ctx1) {
  195. self["@method"]=aCompiledMethod;
  196. return self}, function($ctx1) {$ctx1.fill(self,"method:",{aCompiledMethod:aCompiledMethod},smalltalk.AIContext)})},
  197. args: ["aCompiledMethod"],
  198. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  199. messageSends: [],
  200. referencedClasses: []
  201. }),
  202. smalltalk.AIContext);
  203. smalltalk.addMethod(
  204. smalltalk.method({
  205. selector: "outerContext",
  206. category: 'accessing',
  207. fn: function (){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. var $1;
  211. $1=self["@outerContext"];
  212. return $1;
  213. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.AIContext)})},
  214. args: [],
  215. source: "outerContext\x0a\x09^ outerContext",
  216. messageSends: [],
  217. referencedClasses: []
  218. }),
  219. smalltalk.AIContext);
  220. smalltalk.addMethod(
  221. smalltalk.method({
  222. selector: "outerContext:",
  223. category: 'accessing',
  224. fn: function (anAIContext){
  225. var self=this;
  226. return smalltalk.withContext(function($ctx1) {
  227. self["@outerContext"]=anAIContext;
  228. return self}, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},smalltalk.AIContext)})},
  229. args: ["anAIContext"],
  230. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext",
  231. messageSends: [],
  232. referencedClasses: []
  233. }),
  234. smalltalk.AIContext);
  235. smalltalk.addMethod(
  236. smalltalk.method({
  237. selector: "pc",
  238. category: 'accessing',
  239. fn: function (){
  240. var self=this;
  241. return smalltalk.withContext(function($ctx1) {
  242. var $2,$1;
  243. $2=self["@pc"];
  244. if(($receiver = $2) == nil || $receiver == undefined){
  245. self["@pc"]=(0);
  246. $1=self["@pc"];
  247. } else {
  248. $1=$2;
  249. };
  250. return $1;
  251. }, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.AIContext)})},
  252. args: [],
  253. source: "pc\x0a\x09^ pc ifNil: [ pc := 0 ]",
  254. messageSends: ["ifNil:"],
  255. referencedClasses: []
  256. }),
  257. smalltalk.AIContext);
  258. smalltalk.addMethod(
  259. smalltalk.method({
  260. selector: "pc:",
  261. category: 'accessing',
  262. fn: function (anInteger){
  263. var self=this;
  264. return smalltalk.withContext(function($ctx1) {
  265. self["@pc"]=anInteger;
  266. return self}, function($ctx1) {$ctx1.fill(self,"pc:",{anInteger:anInteger},smalltalk.AIContext)})},
  267. args: ["anInteger"],
  268. source: "pc: anInteger\x0a\x09pc := anInteger",
  269. messageSends: [],
  270. referencedClasses: []
  271. }),
  272. smalltalk.AIContext);
  273. smalltalk.addMethod(
  274. smalltalk.method({
  275. selector: "receiver",
  276. category: 'accessing',
  277. fn: function (){
  278. var self=this;
  279. return smalltalk.withContext(function($ctx1) {
  280. var $1;
  281. $1=_st(self)._localAt_("self");
  282. return $1;
  283. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.AIContext)})},
  284. args: [],
  285. source: "receiver\x0a\x09^ self localAt: 'self'",
  286. messageSends: ["localAt:"],
  287. referencedClasses: []
  288. }),
  289. smalltalk.AIContext);
  290. smalltalk.addMethod(
  291. smalltalk.method({
  292. selector: "receiver:",
  293. category: 'accessing',
  294. fn: function (anObject){
  295. var self=this;
  296. return smalltalk.withContext(function($ctx1) {
  297. _st(self)._localAt_put_("self",anObject);
  298. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.AIContext)})},
  299. args: ["anObject"],
  300. source: "receiver: anObject\x0a\x09self localAt: 'self' put: anObject",
  301. messageSends: ["localAt:put:"],
  302. referencedClasses: []
  303. }),
  304. smalltalk.AIContext);
  305. smalltalk.addMethod(
  306. smalltalk.method({
  307. selector: "selector",
  308. category: 'accessing',
  309. fn: function (){
  310. var self=this;
  311. return smalltalk.withContext(function($ctx1) {
  312. var $2,$1;
  313. $2=_st(self)._method();
  314. if(($receiver = $2) == nil || $receiver == undefined){
  315. $1=$2;
  316. } else {
  317. $1=_st(_st(self)._method())._selector();
  318. };
  319. return $1;
  320. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.AIContext)})},
  321. args: [],
  322. source: "selector\x0a\x09^ self method\x0a\x09\x09ifNotNil: [ self method selector ]",
  323. messageSends: ["ifNotNil:", "selector", "method"],
  324. referencedClasses: []
  325. }),
  326. smalltalk.AIContext);
  327. smalltalk.addMethod(
  328. smalltalk.method({
  329. selector: "fromMethodContext:",
  330. category: 'instance creation',
  331. fn: function (aMethodContext){
  332. var self=this;
  333. return smalltalk.withContext(function($ctx1) {
  334. var $2,$3,$1;
  335. $2=_st(self)._new();
  336. _st($2)._initializeFromMethodContext_(aMethodContext);
  337. $3=_st($2)._yourself();
  338. $1=$3;
  339. return $1;
  340. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext.klass)})},
  341. args: ["aMethodContext"],
  342. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  343. messageSends: ["initializeFromMethodContext:", "new", "yourself"],
  344. referencedClasses: []
  345. }),
  346. smalltalk.AIContext.klass);
  347. smalltalk.addClass('ASTDebugger', smalltalk.Object, ['interpreter', 'context'], 'Compiler-Interpreter');
  348. smalltalk.ASTDebugger.comment="I am a stepping debugger interface for Amber code.\x0aI internally use an instance of `ASTSteppingInterpreter` to actually step through node and interpret them.\x0a\x0aMy instances are created from a `MethodContext` with `ASTDebugger class >> context:`.\x0aThey hold an `AIContext` instance internally, recursive copy of the `MethodContext`.\x0a\x0a## API\x0a\x0aUse the methods of the `'stepping'` protocol to do stepping.";
  349. smalltalk.addMethod(
  350. smalltalk.method({
  351. selector: "atEnd",
  352. category: 'testing',
  353. fn: function (){
  354. var self=this;
  355. return smalltalk.withContext(function($ctx1) {
  356. var $1;
  357. $1=_st(_st(self)._interpreter())._atEnd();
  358. return $1;
  359. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTDebugger)})},
  360. args: [],
  361. source: "atEnd\x0a\x09^ self interpreter atEnd",
  362. messageSends: ["atEnd", "interpreter"],
  363. referencedClasses: []
  364. }),
  365. smalltalk.ASTDebugger);
  366. smalltalk.addMethod(
  367. smalltalk.method({
  368. selector: "buildAST",
  369. category: 'initialization',
  370. fn: function (){
  371. var self=this;
  372. var ast;
  373. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  374. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  375. return smalltalk.withContext(function($ctx1) {
  376. var $1;
  377. ast=_st(_st($Smalltalk())._current())._parse_(_st(_st(self)._method())._source());
  378. _st(_st($SemanticAnalyzer())._on_(_st(_st(_st(self)._context())._receiver())._class()))._visit_(ast);
  379. $1=ast;
  380. return $1;
  381. }, function($ctx1) {$ctx1.fill(self,"buildAST",{ast:ast},smalltalk.ASTDebugger)})},
  382. args: [],
  383. source: "buildAST\x0a\x09\x22Build the AST tree from the method source code.\x0a\x09The AST is annotated with a SemanticAnalyzer,\x0a\x09to know the semantics and bindings of each node needed for later debugging\x22\x0a\x09\x0a\x09| ast |\x0a\x09\x0a\x09ast := Smalltalk current parse: self method source.\x0a\x09(SemanticAnalyzer on: self context receiver class)\x0a\x09\x09visit: ast.\x0a\x09\x0a\x09^ ast",
  384. messageSends: ["parse:", "source", "method", "current", "visit:", "on:", "class", "receiver", "context"],
  385. referencedClasses: ["Smalltalk", "SemanticAnalyzer"]
  386. }),
  387. smalltalk.ASTDebugger);
  388. smalltalk.addMethod(
  389. smalltalk.method({
  390. selector: "context",
  391. category: 'accessing',
  392. fn: function (){
  393. var self=this;
  394. return smalltalk.withContext(function($ctx1) {
  395. var $1;
  396. $1=self["@context"];
  397. return $1;
  398. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTDebugger)})},
  399. args: [],
  400. source: "context\x0a\x09^ context",
  401. messageSends: [],
  402. referencedClasses: []
  403. }),
  404. smalltalk.ASTDebugger);
  405. smalltalk.addMethod(
  406. smalltalk.method({
  407. selector: "context:",
  408. category: 'accessing',
  409. fn: function (aContext){
  410. var self=this;
  411. return smalltalk.withContext(function($ctx1) {
  412. self["@context"]=aContext;
  413. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTDebugger)})},
  414. args: ["aContext"],
  415. source: "context: aContext\x0a\x09context := aContext",
  416. messageSends: [],
  417. referencedClasses: []
  418. }),
  419. smalltalk.ASTDebugger);
  420. smalltalk.addMethod(
  421. smalltalk.method({
  422. selector: "defaultInterpreterClass",
  423. category: 'defaults',
  424. fn: function (){
  425. var self=this;
  426. function $ASTSteppingInterpreter(){return smalltalk.ASTSteppingInterpreter||(typeof ASTSteppingInterpreter=="undefined"?nil:ASTSteppingInterpreter)}
  427. return smalltalk.withContext(function($ctx1) {
  428. var $1;
  429. $1=$ASTSteppingInterpreter();
  430. return $1;
  431. }, function($ctx1) {$ctx1.fill(self,"defaultInterpreterClass",{},smalltalk.ASTDebugger)})},
  432. args: [],
  433. source: "defaultInterpreterClass\x0a\x09^ ASTSteppingInterpreter",
  434. messageSends: [],
  435. referencedClasses: ["ASTSteppingInterpreter"]
  436. }),
  437. smalltalk.ASTDebugger);
  438. smalltalk.addMethod(
  439. smalltalk.method({
  440. selector: "initializeInterpreter",
  441. category: 'initialization',
  442. fn: function (){
  443. var self=this;
  444. var ast,next;
  445. function $ASTPCNodeVisitor(){return smalltalk.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  446. return smalltalk.withContext(function($ctx1) {
  447. var $1,$2;
  448. ast=_st(self)._buildAST();
  449. $1=_st($ASTPCNodeVisitor())._new();
  450. _st($1)._context_(_st(self)._context());
  451. _st($1)._visit_(ast);
  452. $2=_st($1)._currentNode();
  453. next=$2;
  454. _st(_st(self)._interpreter())._interpret_(next);
  455. return self}, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{ast:ast,next:next},smalltalk.ASTDebugger)})},
  456. args: [],
  457. source: "initializeInterpreter\x0a\x09| ast next |\x0a\x09ast := self buildAST.\x0a\x09next := ASTPCNodeVisitor new\x0a\x09\x09context: self context;\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode.\x0a\x09self interpreter interpret: next",
  458. messageSends: ["buildAST", "context:", "context", "new", "visit:", "currentNode", "interpret:", "interpreter"],
  459. referencedClasses: ["ASTPCNodeVisitor"]
  460. }),
  461. smalltalk.ASTDebugger);
  462. smalltalk.addMethod(
  463. smalltalk.method({
  464. selector: "initializeWithContext:",
  465. category: 'initialization',
  466. fn: function (aContext){
  467. var self=this;
  468. return smalltalk.withContext(function($ctx1) {
  469. _st(self)._context_(aContext);
  470. _st(self)._initializeInterpreter();
  471. return self}, function($ctx1) {$ctx1.fill(self,"initializeWithContext:",{aContext:aContext},smalltalk.ASTDebugger)})},
  472. args: ["aContext"],
  473. source: "initializeWithContext: aContext\x0a\x09\x22TODO: do we need to handle block contexts?\x22\x0a\x09\x0a\x09self context: aContext.\x0a\x09self initializeInterpreter",
  474. messageSends: ["context:", "initializeInterpreter"],
  475. referencedClasses: []
  476. }),
  477. smalltalk.ASTDebugger);
  478. smalltalk.addMethod(
  479. smalltalk.method({
  480. selector: "interpreter",
  481. category: 'accessing',
  482. fn: function (){
  483. var self=this;
  484. return smalltalk.withContext(function($ctx1) {
  485. var $2,$1;
  486. $2=self["@interpreter"];
  487. if(($receiver = $2) == nil || $receiver == undefined){
  488. self["@interpreter"]=_st(_st(self)._defaultInterpreterClass())._new();
  489. $1=self["@interpreter"];
  490. } else {
  491. $1=$2;
  492. };
  493. return $1;
  494. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.ASTDebugger)})},
  495. args: [],
  496. source: "interpreter\x0a\x09^ interpreter ifNil: [ interpreter := self defaultInterpreterClass new ]",
  497. messageSends: ["ifNil:", "new", "defaultInterpreterClass"],
  498. referencedClasses: []
  499. }),
  500. smalltalk.ASTDebugger);
  501. smalltalk.addMethod(
  502. smalltalk.method({
  503. selector: "interpreter:",
  504. category: 'accessing',
  505. fn: function (anInterpreter){
  506. var self=this;
  507. return smalltalk.withContext(function($ctx1) {
  508. self["@interpreter"]=anInterpreter;
  509. return self}, function($ctx1) {$ctx1.fill(self,"interpreter:",{anInterpreter:anInterpreter},smalltalk.ASTDebugger)})},
  510. args: ["anInterpreter"],
  511. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  512. messageSends: [],
  513. referencedClasses: []
  514. }),
  515. smalltalk.ASTDebugger);
  516. smalltalk.addMethod(
  517. smalltalk.method({
  518. selector: "method",
  519. category: 'accessing',
  520. fn: function (){
  521. var self=this;
  522. return smalltalk.withContext(function($ctx1) {
  523. var $1;
  524. $1=_st(_st(self)._context())._method();
  525. return $1;
  526. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.ASTDebugger)})},
  527. args: [],
  528. source: "method\x0a\x09^ self context method",
  529. messageSends: ["method", "context"],
  530. referencedClasses: []
  531. }),
  532. smalltalk.ASTDebugger);
  533. smalltalk.addMethod(
  534. smalltalk.method({
  535. selector: "nextNode",
  536. category: 'accessing',
  537. fn: function (){
  538. var self=this;
  539. return smalltalk.withContext(function($ctx1) {
  540. var $1;
  541. $1=_st(_st(self)._interpreter())._nextNode();
  542. return $1;
  543. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.ASTDebugger)})},
  544. args: [],
  545. source: "nextNode\x0a\x09^ self interpreter nextNode",
  546. messageSends: ["nextNode", "interpreter"],
  547. referencedClasses: []
  548. }),
  549. smalltalk.ASTDebugger);
  550. smalltalk.addMethod(
  551. smalltalk.method({
  552. selector: "proceed",
  553. category: 'stepping',
  554. fn: function (){
  555. var self=this;
  556. return smalltalk.withContext(function($ctx1) {
  557. _st(self)._shouldBeImplemented();
  558. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.ASTDebugger)})},
  559. args: [],
  560. source: "proceed\x0a\x09self shouldBeImplemented",
  561. messageSends: ["shouldBeImplemented"],
  562. referencedClasses: []
  563. }),
  564. smalltalk.ASTDebugger);
  565. smalltalk.addMethod(
  566. smalltalk.method({
  567. selector: "restart",
  568. category: 'stepping',
  569. fn: function (){
  570. var self=this;
  571. return smalltalk.withContext(function($ctx1) {
  572. _st(self)._shouldBeImplemented();
  573. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},smalltalk.ASTDebugger)})},
  574. args: [],
  575. source: "restart\x0a\x09self shouldBeImplemented",
  576. messageSends: ["shouldBeImplemented"],
  577. referencedClasses: []
  578. }),
  579. smalltalk.ASTDebugger);
  580. smalltalk.addMethod(
  581. smalltalk.method({
  582. selector: "step",
  583. category: 'stepping',
  584. fn: function (){
  585. var self=this;
  586. return smalltalk.withContext(function($ctx1) {
  587. _st((function(){
  588. return smalltalk.withContext(function($ctx2) {
  589. return _st(_st(_st(_st(_st(self)._interpreter())._nextNode())._notNil())._and_((function(){
  590. return smalltalk.withContext(function($ctx3) {
  591. return _st(_st(_st(self)._interpreter())._nextNode())._stopOnStepping();
  592. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})))._or_((function(){
  593. return smalltalk.withContext(function($ctx3) {
  594. return _st(_st(_st(self)._interpreter())._atEnd())._not();
  595. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  597. return smalltalk.withContext(function($ctx2) {
  598. _st(_st(self)._interpreter())._step();
  599. return _st(self)._step();
  600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  601. return self}, function($ctx1) {$ctx1.fill(self,"step",{},smalltalk.ASTDebugger)})},
  602. args: [],
  603. source: "step\x0a\x09\x22The ASTSteppingInterpreter stops at each node interpretation.\x0a\x09One step will interpret nodes until:\x0a\x09- we get at the end\x0a\x09- the next node is a stepping node (send, assignment, etc.)\x22\x0a\x09\x0a\x09[ (self interpreter nextNode notNil and: [ self interpreter nextNode stopOnStepping ])\x0a\x09\x09or: [ self interpreter atEnd not ] ]\x0a\x09\x09\x09whileFalse: [\x0a\x09\x09\x09\x09self interpreter step.\x0a\x09\x09\x09\x09self step ]",
  604. messageSends: ["whileFalse:", "step", "interpreter", "or:", "not", "atEnd", "and:", "stopOnStepping", "nextNode", "notNil"],
  605. referencedClasses: []
  606. }),
  607. smalltalk.ASTDebugger);
  608. smalltalk.addMethod(
  609. smalltalk.method({
  610. selector: "stepInto",
  611. category: 'stepping',
  612. fn: function (){
  613. var self=this;
  614. return smalltalk.withContext(function($ctx1) {
  615. _st(self)._shouldBeImplemented();
  616. return self}, function($ctx1) {$ctx1.fill(self,"stepInto",{},smalltalk.ASTDebugger)})},
  617. args: [],
  618. source: "stepInto\x0a\x09self shouldBeImplemented",
  619. messageSends: ["shouldBeImplemented"],
  620. referencedClasses: []
  621. }),
  622. smalltalk.ASTDebugger);
  623. smalltalk.addMethod(
  624. smalltalk.method({
  625. selector: "stepOver",
  626. category: 'stepping',
  627. fn: function (){
  628. var self=this;
  629. return smalltalk.withContext(function($ctx1) {
  630. _st(self)._step();
  631. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},smalltalk.ASTDebugger)})},
  632. args: [],
  633. source: "stepOver\x0a\x09self step",
  634. messageSends: ["step"],
  635. referencedClasses: []
  636. }),
  637. smalltalk.ASTDebugger);
  638. smalltalk.addMethod(
  639. smalltalk.method({
  640. selector: "context:",
  641. category: 'instance creation',
  642. fn: function (aContext){
  643. var self=this;
  644. return smalltalk.withContext(function($ctx1) {
  645. var $2,$3,$1;
  646. $2=_st(self)._new();
  647. _st($2)._initializeWithContext_(aContext);
  648. $3=_st($2)._yourself();
  649. $1=$3;
  650. return $1;
  651. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTDebugger.klass)})},
  652. args: ["aContext"],
  653. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext;\x0a\x09\x09yourself",
  654. messageSends: ["initializeWithContext:", "new", "yourself"],
  655. referencedClasses: []
  656. }),
  657. smalltalk.ASTDebugger.klass);
  658. smalltalk.addClass('ASTInterpreter', smalltalk.Object, ['currentNode', 'context', 'shouldReturn', 'result'], 'Compiler-Interpreter');
  659. smalltalk.ASTInterpreter.comment="I am like a `NodeVisitor`, interpreting nodes one after each other.\x0aI am built using Continuation Passing Style for stepping purposes.\x0a\x0a## Usage example:\x0a\x0a\x09| ast interpreter |\x0a\x09ast := Smalltalk current parse: 'foo 1+2+4'.\x0a\x09(SemanticAnalyzer on: Object) visit: ast.\x0a\x0a\x09ASTInterpreter new\x0a\x09\x09interpret: ast nodes first;\x0a\x09\x09result \x22Answers 7\x22";
  660. smalltalk.addMethod(
  661. smalltalk.method({
  662. selector: "assign:to:",
  663. category: 'private',
  664. fn: function (aNode,anObject){
  665. var self=this;
  666. return smalltalk.withContext(function($ctx1) {
  667. var $2,$1;
  668. $2=_st(_st(aNode)._binding())._isInstanceVar();
  669. if(smalltalk.assert($2)){
  670. $1=_st(_st(_st(self)._context())._receiver())._instVarAt_put_(_st(aNode)._value(),anObject);
  671. } else {
  672. $1=_st(_st(self)._context())._localAt_put_(_st(aNode)._value(),anObject);
  673. };
  674. return $1;
  675. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},smalltalk.ASTInterpreter)})},
  676. args: ["aNode", "anObject"],
  677. source: "assign: aNode to: anObject\x0a\x09^ aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]\x0a\x09\x09ifFalse: [ self context localAt: aNode value put: anObject ]",
  678. messageSends: ["ifTrue:ifFalse:", "instVarAt:put:", "value", "receiver", "context", "localAt:put:", "isInstanceVar", "binding"],
  679. referencedClasses: []
  680. }),
  681. smalltalk.ASTInterpreter);
  682. smalltalk.addMethod(
  683. smalltalk.method({
  684. selector: "context",
  685. category: 'accessing',
  686. fn: function (){
  687. var self=this;
  688. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  689. return smalltalk.withContext(function($ctx1) {
  690. var $2,$1;
  691. $2=self["@context"];
  692. if(($receiver = $2) == nil || $receiver == undefined){
  693. self["@context"]=_st($AIContext())._new();
  694. $1=self["@context"];
  695. } else {
  696. $1=$2;
  697. };
  698. return $1;
  699. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTInterpreter)})},
  700. args: [],
  701. source: "context\x0a\x09^ context ifNil: [ context := AIContext new ]",
  702. messageSends: ["ifNil:", "new"],
  703. referencedClasses: ["AIContext"]
  704. }),
  705. smalltalk.ASTInterpreter);
  706. smalltalk.addMethod(
  707. smalltalk.method({
  708. selector: "context:",
  709. category: 'accessing',
  710. fn: function (anAIContext){
  711. var self=this;
  712. return smalltalk.withContext(function($ctx1) {
  713. self["@context"]=anAIContext;
  714. return self}, function($ctx1) {$ctx1.fill(self,"context:",{anAIContext:anAIContext},smalltalk.ASTInterpreter)})},
  715. args: ["anAIContext"],
  716. source: "context: anAIContext\x0a\x09context := anAIContext",
  717. messageSends: [],
  718. referencedClasses: []
  719. }),
  720. smalltalk.ASTInterpreter);
  721. smalltalk.addMethod(
  722. smalltalk.method({
  723. selector: "continue:value:",
  724. category: 'private',
  725. fn: function (aBlock,anObject){
  726. var self=this;
  727. return smalltalk.withContext(function($ctx1) {
  728. self["@result"]=anObject;
  729. _st(aBlock)._value_(anObject);
  730. return self}, function($ctx1) {$ctx1.fill(self,"continue:value:",{aBlock:aBlock,anObject:anObject},smalltalk.ASTInterpreter)})},
  731. args: ["aBlock", "anObject"],
  732. source: "continue: aBlock value: anObject\x0a\x09result := anObject.\x0a\x09aBlock value: anObject",
  733. messageSends: ["value:"],
  734. referencedClasses: []
  735. }),
  736. smalltalk.ASTInterpreter);
  737. smalltalk.addMethod(
  738. smalltalk.method({
  739. selector: "currentNode",
  740. category: 'accessing',
  741. fn: function (){
  742. var self=this;
  743. return smalltalk.withContext(function($ctx1) {
  744. var $1;
  745. $1=self["@currentNode"];
  746. return $1;
  747. }, function($ctx1) {$ctx1.fill(self,"currentNode",{},smalltalk.ASTInterpreter)})},
  748. args: [],
  749. source: "currentNode\x0a\x09^ currentNode",
  750. messageSends: [],
  751. referencedClasses: []
  752. }),
  753. smalltalk.ASTInterpreter);
  754. smalltalk.addMethod(
  755. smalltalk.method({
  756. selector: "eval:",
  757. category: 'private',
  758. fn: function (aString){
  759. var self=this;
  760. var source,function_;
  761. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  762. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  763. return smalltalk.withContext(function($ctx1) {
  764. var $1,$2,$3;
  765. source=_st($String())._streamContents_((function(str){
  766. return smalltalk.withContext(function($ctx2) {
  767. _st(str)._nextPutAll_("(function(");
  768. _st(_st(_st(_st(self)._context())._locals())._keys())._do_separatedBy_((function(each){
  769. return smalltalk.withContext(function($ctx3) {
  770. return _st(str)._nextPutAll_(each);
  771. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  772. return smalltalk.withContext(function($ctx3) {
  773. return _st(str)._nextPutAll_(",");
  774. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  775. $1=str;
  776. _st($1)._nextPutAll_("){ return (function() {");
  777. _st($1)._nextPutAll_(aString);
  778. $2=_st($1)._nextPutAll_("})() })");
  779. return $2;
  780. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1)})}));
  781. function_=_st(_st($Compiler())._new())._eval_(source);
  782. $3=_st(function_)._valueWithPossibleArguments_(_st(_st(_st(self)._context())._locals())._values());
  783. return $3;
  784. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},smalltalk.ASTInterpreter)})},
  785. args: ["aString"],
  786. source: "eval: aString\x0a\x09\x22Evaluate aString as JS source inside an JS function.\x0a\x09aString is not sandboxed.\x22\x0a\x09\x0a\x09| source function |\x0a\x09\x0a\x09source := String streamContents: [ :str |\x0a\x09\x09str nextPutAll: '(function('.\x0a\x09\x09self context locals keys\x0a\x09\x09\x09do: [ :each | str nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ str nextPutAll: ',' ].\x0a\x09\x09str\x0a\x09\x09\x09nextPutAll: '){ return (function() {';\x0a\x09\x09\x09nextPutAll: aString;\x0a\x09\x09\x09nextPutAll: '})() })' ].\x0a\x09\x09\x09\x0a\x09function := Compiler new eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values",
  787. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"],
  788. referencedClasses: ["String", "Compiler"]
  789. }),
  790. smalltalk.ASTInterpreter);
  791. smalltalk.addMethod(
  792. smalltalk.method({
  793. selector: "initialize",
  794. category: 'initialization',
  795. fn: function (){
  796. var self=this;
  797. return smalltalk.withContext(function($ctx1) {
  798. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  799. self["@shouldReturn"]=false;
  800. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ASTInterpreter)})},
  801. args: [],
  802. source: "initialize\x0a\x09super initialize.\x0a\x09shouldReturn := false",
  803. messageSends: ["initialize"],
  804. referencedClasses: []
  805. }),
  806. smalltalk.ASTInterpreter);
  807. smalltalk.addMethod(
  808. smalltalk.method({
  809. selector: "interpret:",
  810. category: 'interpreting',
  811. fn: function (aNode){
  812. var self=this;
  813. return smalltalk.withContext(function($ctx1) {
  814. self["@shouldReturn"]=false;
  815. _st(self)._interpret_continue_(aNode,(function(value){
  816. return smalltalk.withContext(function($ctx2) {
  817. self["@result"]=value;
  818. return self["@result"];
  819. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  820. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  821. args: ["aNode"],
  822. source: "interpret: aNode\x0a\x09shouldReturn := false.\x0a\x09self interpret: aNode continue: [ :value |\x0a\x09\x09result := value ]",
  823. messageSends: ["interpret:continue:"],
  824. referencedClasses: []
  825. }),
  826. smalltalk.ASTInterpreter);
  827. smalltalk.addMethod(
  828. smalltalk.method({
  829. selector: "interpret:continue:",
  830. category: 'interpreting',
  831. fn: function (aNode,aBlock){
  832. var self=this;
  833. return smalltalk.withContext(function($ctx1) {
  834. var $1,$2,$3;
  835. $1=self["@shouldReturn"];
  836. if(smalltalk.assert($1)){
  837. $2=self;
  838. return $2;
  839. };
  840. $3=_st(aNode)._isNode();
  841. if(smalltalk.assert($3)){
  842. self["@currentNode"]=aNode;
  843. self["@currentNode"];
  844. _st(self)._interpretNode_continue_(aNode,(function(value){
  845. return smalltalk.withContext(function($ctx2) {
  846. return _st(self)._continue_value_(aBlock,value);
  847. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  848. } else {
  849. _st(self)._continue_value_(aBlock,aNode);
  850. };
  851. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  852. args: ["aNode", "aBlock"],
  853. source: "interpret: aNode continue: aBlock\x0a\x09shouldReturn ifTrue: [ ^ self ].\x0a\x0a\x09aNode isNode\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09currentNode := aNode.\x0a\x09\x09\x09self interpretNode: aNode continue: [ :value |\x0a\x09\x09\x09\x09self continue: aBlock value: value ] ]\x0a\x09\x09ifFalse: [ self continue: aBlock value: aNode ]",
  854. messageSends: ["ifTrue:", "ifTrue:ifFalse:", "interpretNode:continue:", "continue:value:", "isNode"],
  855. referencedClasses: []
  856. }),
  857. smalltalk.ASTInterpreter);
  858. smalltalk.addMethod(
  859. smalltalk.method({
  860. selector: "interpretAll:continue:",
  861. category: 'private',
  862. fn: function (aCollection,aBlock){
  863. var self=this;
  864. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  865. return smalltalk.withContext(function($ctx1) {
  866. _st(self)._interpretAll_continue_result_(aCollection,aBlock,_st($OrderedCollection())._new());
  867. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:",{aCollection:aCollection,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  868. args: ["aCollection", "aBlock"],
  869. source: "interpretAll: aCollection continue: aBlock\x0a\x09self\x0a\x09\x09interpretAll: aCollection\x0a\x09\x09continue: aBlock\x0a\x09\x09result: OrderedCollection new",
  870. messageSends: ["interpretAll:continue:result:", "new"],
  871. referencedClasses: ["OrderedCollection"]
  872. }),
  873. smalltalk.ASTInterpreter);
  874. smalltalk.addMethod(
  875. smalltalk.method({
  876. selector: "interpretAll:continue:result:",
  877. category: 'private',
  878. fn: function (nodes,aBlock,aCollection){
  879. var self=this;
  880. return smalltalk.withContext(function($ctx1) {
  881. var $1;
  882. $1=_st(nodes)._isEmpty();
  883. if(smalltalk.assert($1)){
  884. _st(self)._continue_value_(aBlock,aCollection);
  885. } else {
  886. _st(self)._interpret_continue_(_st(nodes)._first(),(function(value){
  887. return smalltalk.withContext(function($ctx2) {
  888. return _st(self)._interpretAll_continue_result_(_st(nodes)._allButFirst(),aBlock,_st(aCollection).__comma([value]));
  889. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  890. };
  891. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:result:",{nodes:nodes,aBlock:aBlock,aCollection:aCollection},smalltalk.ASTInterpreter)})},
  892. args: ["nodes", "aBlock", "aCollection"],
  893. source: "interpretAll: nodes continue: aBlock result: aCollection\x0a\x09nodes isEmpty\x0a\x09\x09ifTrue: [ self continue: aBlock value: aCollection ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self interpret: nodes first continue: [:value |\x0a\x09\x09\x09\x09self\x0a\x09\x09\x09\x09\x09interpretAll: nodes allButFirst\x0a\x09\x09\x09\x09\x09continue: aBlock\x0a\x09\x09\x09\x09\x09result: aCollection, { value } ] ]",
  894. messageSends: ["ifTrue:ifFalse:", "continue:value:", "interpret:continue:", "first", "interpretAll:continue:result:", "allButFirst", ",", "isEmpty"],
  895. referencedClasses: []
  896. }),
  897. smalltalk.ASTInterpreter);
  898. smalltalk.addMethod(
  899. smalltalk.method({
  900. selector: "interpretAssignmentNode:continue:",
  901. category: 'interpreting',
  902. fn: function (aNode,aBlock){
  903. var self=this;
  904. return smalltalk.withContext(function($ctx1) {
  905. _st(self)._interpret_continue_(_st(aNode)._right(),(function(value){
  906. return smalltalk.withContext(function($ctx2) {
  907. return _st(self)._continue_value_(aBlock,_st(self)._assign_to_(_st(aNode)._left(),value));
  908. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  909. return self}, function($ctx1) {$ctx1.fill(self,"interpretAssignmentNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  910. args: ["aNode", "aBlock"],
  911. source: "interpretAssignmentNode: aNode continue: aBlock\x0a\x09self interpret: aNode right continue: [ :value |\x0a\x09\x09self\x0a\x09\x09\x09continue: aBlock\x0a\x09\x09\x09value: (self assign: aNode left to: value) ]",
  912. messageSends: ["interpret:continue:", "right", "continue:value:", "assign:to:", "left"],
  913. referencedClasses: []
  914. }),
  915. smalltalk.ASTInterpreter);
  916. smalltalk.addMethod(
  917. smalltalk.method({
  918. selector: "interpretBlockNode:continue:",
  919. category: 'interpreting',
  920. fn: function (aNode,aBlock){
  921. var self=this;
  922. return smalltalk.withContext(function($ctx1) {
  923. var $1,$2;
  924. _st(self)._continue_value_(aBlock,(function(){
  925. return smalltalk.withContext(function($ctx2) {
  926. return _st(self)._withBlockContext_((function(){
  927. return smalltalk.withContext(function($ctx3) {
  928. $1=self;
  929. _st($1)._interpret_(_st(_st(aNode)._nodes())._first());
  930. $2=_st($1)._result();
  931. return $2;
  932. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  934. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  935. args: ["aNode", "aBlock"],
  936. source: "interpretBlockNode: aNode continue: aBlock\x0a\x09self\x0a\x09\x09continue: aBlock\x0a\x09\x09value: [ \x0a\x09\x09\x09self withBlockContext: [ \x0a\x09\x09\x09\x09self interpret: aNode nodes first; result ] ]",
  937. messageSends: ["continue:value:", "withBlockContext:", "interpret:", "first", "nodes", "result"],
  938. referencedClasses: []
  939. }),
  940. smalltalk.ASTInterpreter);
  941. smalltalk.addMethod(
  942. smalltalk.method({
  943. selector: "interpretBlockSequenceNode:continue:",
  944. category: 'interpreting',
  945. fn: function (aNode,aBlock){
  946. var self=this;
  947. return smalltalk.withContext(function($ctx1) {
  948. _st(self)._interpretSequenceNode_continue_(aNode,aBlock);
  949. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockSequenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  950. args: ["aNode", "aBlock"],
  951. source: "interpretBlockSequenceNode: aNode continue: aBlock\x0a\x09self interpretSequenceNode: aNode continue: aBlock",
  952. messageSends: ["interpretSequenceNode:continue:"],
  953. referencedClasses: []
  954. }),
  955. smalltalk.ASTInterpreter);
  956. smalltalk.addMethod(
  957. smalltalk.method({
  958. selector: "interpretCascadeNode:continue:",
  959. category: 'interpreting',
  960. fn: function (aNode,aBlock){
  961. var self=this;
  962. return smalltalk.withContext(function($ctx1) {
  963. _st(self)._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  964. return smalltalk.withContext(function($ctx2) {
  965. _st(_st(aNode)._nodes())._do_((function(each){
  966. return smalltalk.withContext(function($ctx3) {
  967. return _st(each)._receiver_(receiver);
  968. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  969. return _st(self)._interpretAll_continue_(_st(_st(aNode)._nodes())._allButLast(),(function(){
  970. return smalltalk.withContext(function($ctx3) {
  971. return _st(self)._interpret_continue_(_st(_st(aNode)._nodes())._last(),(function(val){
  972. return smalltalk.withContext(function($ctx4) {
  973. return _st(self)._continue_value_(aBlock,val);
  974. }, function($ctx4) {$ctx4.fillBlock({val:val},$ctx1)})}));
  975. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  976. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  977. return self}, function($ctx1) {$ctx1.fill(self,"interpretCascadeNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  978. args: ["aNode", "aBlock"],
  979. source: "interpretCascadeNode: aNode continue: aBlock\x0a\x09\x22TODO: Handle super sends\x22\x0a\x09\x0a\x09self interpret: aNode receiver continue: [ :receiver |\x0a\x09\x09\x22Only interpret the receiver once\x22\x0a\x09\x09aNode nodes do: [ :each | each receiver: receiver ].\x0a\x0a\x09\x09self\x0a\x09\x09\x09interpretAll: aNode nodes allButLast\x0a\x09\x09\x09continue: [\x0a\x09\x09\x09\x09self\x0a\x09\x09\x09\x09\x09interpret: aNode nodes last\x0a\x09\x09\x09\x09\x09continue: [ :val | self continue: aBlock value: val ] ] ]",
  980. messageSends: ["interpret:continue:", "receiver", "do:", "receiver:", "nodes", "interpretAll:continue:", "allButLast", "last", "continue:value:"],
  981. referencedClasses: []
  982. }),
  983. smalltalk.ASTInterpreter);
  984. smalltalk.addMethod(
  985. smalltalk.method({
  986. selector: "interpretClassReferenceNode:continue:",
  987. category: 'interpreting',
  988. fn: function (aNode,aBlock){
  989. var self=this;
  990. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  991. return smalltalk.withContext(function($ctx1) {
  992. _st(self)._continue_value_(aBlock,_st(_st($Smalltalk())._current())._at_(_st(aNode)._value()));
  993. return self}, function($ctx1) {$ctx1.fill(self,"interpretClassReferenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  994. args: ["aNode", "aBlock"],
  995. source: "interpretClassReferenceNode: aNode continue: aBlock\x0a\x09self continue: aBlock value: (Smalltalk current at: aNode value)",
  996. messageSends: ["continue:value:", "at:", "value", "current"],
  997. referencedClasses: ["Smalltalk"]
  998. }),
  999. smalltalk.ASTInterpreter);
  1000. smalltalk.addMethod(
  1001. smalltalk.method({
  1002. selector: "interpretDynamicArrayNode:continue:",
  1003. category: 'interpreting',
  1004. fn: function (aNode,aBlock){
  1005. var self=this;
  1006. return smalltalk.withContext(function($ctx1) {
  1007. _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  1008. return smalltalk.withContext(function($ctx2) {
  1009. return _st(self)._continue_value_(aBlock,array);
  1010. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  1011. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicArrayNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1012. args: ["aNode", "aBlock"],
  1013. source: "interpretDynamicArrayNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array |\x0a\x09\x09self\x0a\x09\x09\x09continue: aBlock\x0a\x09\x09\x09value: array ]",
  1014. messageSends: ["interpretAll:continue:", "nodes", "continue:value:"],
  1015. referencedClasses: []
  1016. }),
  1017. smalltalk.ASTInterpreter);
  1018. smalltalk.addMethod(
  1019. smalltalk.method({
  1020. selector: "interpretDynamicDictionaryNode:continue:",
  1021. category: 'interpreting',
  1022. fn: function (aNode,aBlock){
  1023. var self=this;
  1024. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1025. return smalltalk.withContext(function($ctx1) {
  1026. _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  1027. var hashedCollection;
  1028. return smalltalk.withContext(function($ctx2) {
  1029. hashedCollection=_st($HashedCollection())._new();
  1030. hashedCollection;
  1031. _st(array)._do_((function(each){
  1032. return smalltalk.withContext(function($ctx3) {
  1033. return _st(hashedCollection)._add_(each);
  1034. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  1035. return _st(self)._continue_value_(aBlock,hashedCollection);
  1036. }, function($ctx2) {$ctx2.fillBlock({array:array,hashedCollection:hashedCollection},$ctx1)})}));
  1037. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicDictionaryNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1038. args: ["aNode", "aBlock"],
  1039. source: "interpretDynamicDictionaryNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array | | hashedCollection |\x0a\x09\x09hashedCollection := HashedCollection new.\x0a\x09\x09array do: [ :each | hashedCollection add: each ].\x0a\x09\x09self\x0a\x09\x09\x09continue: aBlock\x0a\x09\x09\x09value: hashedCollection ]",
  1040. messageSends: ["interpretAll:continue:", "nodes", "new", "do:", "add:", "continue:value:"],
  1041. referencedClasses: ["HashedCollection"]
  1042. }),
  1043. smalltalk.ASTInterpreter);
  1044. smalltalk.addMethod(
  1045. smalltalk.method({
  1046. selector: "interpretJSStatementNode:continue:",
  1047. category: 'interpreting',
  1048. fn: function (aNode,aBlock){
  1049. var self=this;
  1050. return smalltalk.withContext(function($ctx1) {
  1051. self["@shouldReturn"]=true;
  1052. _st(self)._continue_value_(aBlock,_st(self)._eval_(_st(aNode)._source()));
  1053. return self}, function($ctx1) {$ctx1.fill(self,"interpretJSStatementNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1054. args: ["aNode", "aBlock"],
  1055. source: "interpretJSStatementNode: aNode continue: aBlock\x0a\x09shouldReturn := true.\x0a\x09self continue: aBlock value: (self eval: aNode source)",
  1056. messageSends: ["continue:value:", "eval:", "source"],
  1057. referencedClasses: []
  1058. }),
  1059. smalltalk.ASTInterpreter);
  1060. smalltalk.addMethod(
  1061. smalltalk.method({
  1062. selector: "interpretMethodNode:continue:",
  1063. category: 'interpreting',
  1064. fn: function (aNode,aBlock){
  1065. var self=this;
  1066. return smalltalk.withContext(function($ctx1) {
  1067. _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  1068. return smalltalk.withContext(function($ctx2) {
  1069. return _st(self)._continue_value_(aBlock,_st(array)._first());
  1070. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  1071. return self}, function($ctx1) {$ctx1.fill(self,"interpretMethodNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1072. args: ["aNode", "aBlock"],
  1073. source: "interpretMethodNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array |\x0a\x09\x09self continue: aBlock value: array first ]",
  1074. messageSends: ["interpretAll:continue:", "nodes", "continue:value:", "first"],
  1075. referencedClasses: []
  1076. }),
  1077. smalltalk.ASTInterpreter);
  1078. smalltalk.addMethod(
  1079. smalltalk.method({
  1080. selector: "interpretNode:continue:",
  1081. category: 'interpreting',
  1082. fn: function (aNode,aBlock){
  1083. var self=this;
  1084. return smalltalk.withContext(function($ctx1) {
  1085. _st(aNode)._interpreter_continue_(self,aBlock);
  1086. return self}, function($ctx1) {$ctx1.fill(self,"interpretNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1087. args: ["aNode", "aBlock"],
  1088. source: "interpretNode: aNode continue: aBlock\x0a\x09aNode interpreter: self continue: aBlock",
  1089. messageSends: ["interpreter:continue:"],
  1090. referencedClasses: []
  1091. }),
  1092. smalltalk.ASTInterpreter);
  1093. smalltalk.addMethod(
  1094. smalltalk.method({
  1095. selector: "interpretReturnNode:continue:",
  1096. category: 'interpreting',
  1097. fn: function (aNode,aBlock){
  1098. var self=this;
  1099. return smalltalk.withContext(function($ctx1) {
  1100. _st(self)._interpret_continue_(_st(_st(aNode)._nodes())._first(),(function(value){
  1101. return smalltalk.withContext(function($ctx2) {
  1102. self["@shouldReturn"]=true;
  1103. self["@shouldReturn"];
  1104. return _st(self)._continue_value_(aBlock,value);
  1105. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})}));
  1106. return self}, function($ctx1) {$ctx1.fill(self,"interpretReturnNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1107. args: ["aNode", "aBlock"],
  1108. source: "interpretReturnNode: aNode continue: aBlock\x0a\x09self interpret: aNode nodes first continue: [ :value |\x0a\x09\x09shouldReturn := true.\x0a\x09\x09self continue: aBlock value: value ]",
  1109. messageSends: ["interpret:continue:", "first", "nodes", "continue:value:"],
  1110. referencedClasses: []
  1111. }),
  1112. smalltalk.ASTInterpreter);
  1113. smalltalk.addMethod(
  1114. smalltalk.method({
  1115. selector: "interpretSendNode:continue:",
  1116. category: 'interpreting',
  1117. fn: function (aNode,aBlock){
  1118. var self=this;
  1119. return smalltalk.withContext(function($ctx1) {
  1120. _st(self)._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  1121. return smalltalk.withContext(function($ctx2) {
  1122. return _st(self)._interpretAll_continue_(_st(aNode)._arguments(),(function(args){
  1123. return smalltalk.withContext(function($ctx3) {
  1124. return _st(self)._messageFromSendNode_arguments_do_(aNode,args,(function(message){
  1125. return smalltalk.withContext(function($ctx4) {
  1126. _st(_st(self)._context())._pc_(_st(_st(_st(self)._context())._pc()).__plus((1)));
  1127. return _st(self)._continue_value_(aBlock,_st(self)._sendMessage_to_superSend_(message,receiver,_st(aNode)._superSend()));
  1128. }, function($ctx4) {$ctx4.fillBlock({message:message},$ctx1)})}));
  1129. }, function($ctx3) {$ctx3.fillBlock({args:args},$ctx1)})}));
  1130. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1)})}));
  1131. return self}, function($ctx1) {$ctx1.fill(self,"interpretSendNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1132. args: ["aNode", "aBlock"],
  1133. source: "interpretSendNode: aNode continue: aBlock\x0a\x09self interpret: aNode receiver continue: [ :receiver |\x0a\x09\x09self interpretAll: aNode arguments continue: [ :args |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09messageFromSendNode: aNode\x0a\x09\x09\x09\x09arguments: args\x0a\x09\x09\x09\x09do: [ :message |\x0a\x09\x09\x09\x09\x09self context pc: self context pc + 1.\x0a\x09\x09\x09\x09\x09self\x0a\x09\x09\x09\x09\x09\x09continue: aBlock\x0a\x09\x09\x09\x09\x09\x09value: (self sendMessage: message to: receiver superSend: aNode superSend) ] ] ]",
  1134. messageSends: ["interpret:continue:", "receiver", "interpretAll:continue:", "arguments", "messageFromSendNode:arguments:do:", "pc:", "+", "pc", "context", "continue:value:", "sendMessage:to:superSend:", "superSend"],
  1135. referencedClasses: []
  1136. }),
  1137. smalltalk.ASTInterpreter);
  1138. smalltalk.addMethod(
  1139. smalltalk.method({
  1140. selector: "interpretSequenceNode:continue:",
  1141. category: 'interpreting',
  1142. fn: function (aNode,aBlock){
  1143. var self=this;
  1144. return smalltalk.withContext(function($ctx1) {
  1145. _st(self)._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  1146. return smalltalk.withContext(function($ctx2) {
  1147. return _st(self)._continue_value_(aBlock,_st(array)._last());
  1148. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1)})}));
  1149. return self}, function($ctx1) {$ctx1.fill(self,"interpretSequenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1150. args: ["aNode", "aBlock"],
  1151. source: "interpretSequenceNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array |\x0a\x09\x09self continue: aBlock value: array last ]",
  1152. messageSends: ["interpretAll:continue:", "nodes", "continue:value:", "last"],
  1153. referencedClasses: []
  1154. }),
  1155. smalltalk.ASTInterpreter);
  1156. smalltalk.addMethod(
  1157. smalltalk.method({
  1158. selector: "interpretValueNode:continue:",
  1159. category: 'interpreting',
  1160. fn: function (aNode,aBlock){
  1161. var self=this;
  1162. return smalltalk.withContext(function($ctx1) {
  1163. _st(self)._continue_value_(aBlock,_st(aNode)._value());
  1164. return self}, function($ctx1) {$ctx1.fill(self,"interpretValueNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1165. args: ["aNode", "aBlock"],
  1166. source: "interpretValueNode: aNode continue: aBlock\x0a\x09self continue: aBlock value: aNode value",
  1167. messageSends: ["continue:value:", "value"],
  1168. referencedClasses: []
  1169. }),
  1170. smalltalk.ASTInterpreter);
  1171. smalltalk.addMethod(
  1172. smalltalk.method({
  1173. selector: "interpretVariableNode:continue:",
  1174. category: 'interpreting',
  1175. fn: function (aNode,aBlock){
  1176. var self=this;
  1177. return smalltalk.withContext(function($ctx1) {
  1178. var $1,$2,$4,$3;
  1179. $1=self;
  1180. $2=aBlock;
  1181. $4=_st(_st(aNode)._binding())._isInstanceVar();
  1182. if(smalltalk.assert($4)){
  1183. $3=_st(_st(_st(self)._context())._receiver())._instVarAt_(_st(aNode)._value());
  1184. } else {
  1185. $3=_st(_st(self)._context())._localAt_(_st(aNode)._value());
  1186. };
  1187. _st($1)._continue_value_($2,$3);
  1188. return self}, function($ctx1) {$ctx1.fill(self,"interpretVariableNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1189. args: ["aNode", "aBlock"],
  1190. source: "interpretVariableNode: aNode continue: aBlock\x0a\x09self\x0a\x09\x09continue: aBlock\x0a\x09\x09value: (aNode binding isInstanceVar\x0a\x09\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09\x09ifFalse: [ self context localAt: aNode value ])",
  1191. messageSends: ["continue:value:", "ifTrue:ifFalse:", "instVarAt:", "value", "receiver", "context", "localAt:", "isInstanceVar", "binding"],
  1192. referencedClasses: []
  1193. }),
  1194. smalltalk.ASTInterpreter);
  1195. smalltalk.addMethod(
  1196. smalltalk.method({
  1197. selector: "messageFromSendNode:arguments:do:",
  1198. category: 'private',
  1199. fn: function (aSendNode,aCollection,aBlock){
  1200. var self=this;
  1201. function $Message(){return smalltalk.Message||(typeof Message=="undefined"?nil:Message)}
  1202. return smalltalk.withContext(function($ctx1) {
  1203. var $1,$2;
  1204. $1=_st($Message())._new();
  1205. _st($1)._selector_(_st(aSendNode)._selector());
  1206. _st($1)._arguments_(aCollection);
  1207. $2=_st($1)._yourself();
  1208. _st(self)._continue_value_(aBlock,$2);
  1209. return self}, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:do:",{aSendNode:aSendNode,aCollection:aCollection,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1210. args: ["aSendNode", "aCollection", "aBlock"],
  1211. source: "messageFromSendNode: aSendNode arguments: aCollection do: aBlock\x0a\x09self\x0a\x09\x09continue: aBlock\x0a\x09\x09value: (Message new\x0a\x09\x09\x09selector: aSendNode selector;\x0a\x09\x09\x09arguments: aCollection;\x0a\x09\x09\x09yourself)",
  1212. messageSends: ["continue:value:", "selector:", "selector", "new", "arguments:", "yourself"],
  1213. referencedClasses: ["Message"]
  1214. }),
  1215. smalltalk.ASTInterpreter);
  1216. smalltalk.addMethod(
  1217. smalltalk.method({
  1218. selector: "result",
  1219. category: 'accessing',
  1220. fn: function (){
  1221. var self=this;
  1222. return smalltalk.withContext(function($ctx1) {
  1223. var $1;
  1224. $1=self["@result"];
  1225. return $1;
  1226. }, function($ctx1) {$ctx1.fill(self,"result",{},smalltalk.ASTInterpreter)})},
  1227. args: [],
  1228. source: "result\x0a\x09^ result",
  1229. messageSends: [],
  1230. referencedClasses: []
  1231. }),
  1232. smalltalk.ASTInterpreter);
  1233. smalltalk.addMethod(
  1234. smalltalk.method({
  1235. selector: "sendMessage:to:superSend:",
  1236. category: 'private',
  1237. fn: function (aMessage,anObject,aBoolean){
  1238. var self=this;
  1239. var method;
  1240. return smalltalk.withContext(function($ctx1) {
  1241. var $1,$2,$3,$4,$5,$6;
  1242. var $early={};
  1243. try {
  1244. $1=aBoolean;
  1245. if(! smalltalk.assert($1)){
  1246. $2=_st(aMessage)._sendTo_(anObject);
  1247. return $2;
  1248. };
  1249. $3=_st(_st(anObject)._class())._superclass();
  1250. if(($receiver = $3) == nil || $receiver == undefined){
  1251. $4=_st(self)._messageNotUnderstood_receiver_(aMessage,anObject);
  1252. return $4;
  1253. } else {
  1254. $3;
  1255. };
  1256. method=_st(_st(_st(_st(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_(_st(aMessage)._selector(),(function(){
  1257. return smalltalk.withContext(function($ctx2) {
  1258. $5=_st(self)._messageNotUnderstood_receiver_(aMessage,anObject);
  1259. throw $early=[$5];
  1260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1261. $6=_st(_st(method)._fn())._applyTo_arguments_(anObject,_st(aMessage)._arguments());
  1262. return $6;
  1263. }
  1264. catch(e) {if(e===$early)return e[0]; throw e}
  1265. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},smalltalk.ASTInterpreter)})},
  1266. args: ["aMessage", "anObject", "aBoolean"],
  1267. source: "sendMessage: aMessage to: anObject superSend: aBoolean\x0a\x09| method |\x0a\x09\x0a\x09aBoolean ifFalse: [ ^ aMessage sendTo: anObject ].\x0a\x09anObject class superclass ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09method := anObject class superclass methodDictionary\x0a\x09\x09at: aMessage selector\x0a\x09\x09ifAbsent: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ method fn applyTo: anObject arguments: aMessage arguments\x0a\x09\x09\x0a\x09\x0a\x09",
  1268. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "messageNotUnderstood:receiver:", "superclass", "class", "at:ifAbsent:", "selector", "methodDictionary", "applyTo:arguments:", "arguments", "fn"],
  1269. referencedClasses: []
  1270. }),
  1271. smalltalk.ASTInterpreter);
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "shouldReturn",
  1275. category: 'testing',
  1276. fn: function (){
  1277. var self=this;
  1278. return smalltalk.withContext(function($ctx1) {
  1279. var $2,$1;
  1280. $2=self["@shouldReturn"];
  1281. if(($receiver = $2) == nil || $receiver == undefined){
  1282. $1=false;
  1283. } else {
  1284. $1=$2;
  1285. };
  1286. return $1;
  1287. }, function($ctx1) {$ctx1.fill(self,"shouldReturn",{},smalltalk.ASTInterpreter)})},
  1288. args: [],
  1289. source: "shouldReturn\x0a\x09^ shouldReturn ifNil: [ false ]",
  1290. messageSends: ["ifNil:"],
  1291. referencedClasses: []
  1292. }),
  1293. smalltalk.ASTInterpreter);
  1294. smalltalk.addMethod(
  1295. smalltalk.method({
  1296. selector: "withBlockContext:",
  1297. category: 'private',
  1298. fn: function (aBlock){
  1299. var self=this;
  1300. var blockResult;
  1301. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  1302. return smalltalk.withContext(function($ctx1) {
  1303. var $1,$2,$3;
  1304. $1=_st($AIContext())._new();
  1305. _st($1)._outerContext_(_st(self)._context());
  1306. $2=_st($1)._yourself();
  1307. _st(self)._context_($2);
  1308. blockResult=_st(aBlock)._value();
  1309. _st(self)._context_(_st(_st(self)._context())._outerContext());
  1310. $3=blockResult;
  1311. return $3;
  1312. }, function($ctx1) {$ctx1.fill(self,"withBlockContext:",{aBlock:aBlock,blockResult:blockResult},smalltalk.ASTInterpreter)})},
  1313. args: ["aBlock"],
  1314. source: "withBlockContext: aBlock\x0a\x09\x22Evaluate aBlock with a BlockContext:\x0a\x09- a context is pushed before aBlock evaluation.\x0a\x09- the context is poped after aBlock evaluation\x0a\x09- the result of aBlock evaluation is answered\x22\x0a\x09\x0a\x09| blockResult |\x0a\x09\x09\x09\x0a\x09self context: (AIContext new\x0a\x09\x09outerContext: self context;\x0a\x09\x09yourself).\x0a\x09\x0a\x09blockResult := aBlock value.\x0a\x09\x0a\x09self context: self context outerContext.\x0a\x09^ blockResult",
  1315. messageSends: ["context:", "outerContext:", "context", "new", "yourself", "value", "outerContext"],
  1316. referencedClasses: ["AIContext"]
  1317. }),
  1318. smalltalk.ASTInterpreter);
  1319. smalltalk.addClass('ASTSteppingInterpreter', smalltalk.ASTInterpreter, ['continuation', 'nextNode'], 'Compiler-Interpreter');
  1320. smalltalk.ASTSteppingInterpreter.comment="I am an interpreter with stepping capabilities. The higher level `ASTDebugger` class should be used as a debugger model, as it provides convenience methods for debugging.\x0a\x0a## API\x0a\x0aUse `#step` to actually interpret the next node. Interpretation stops at each node evaluation, weither it's a message node or not.\x0a\x0a\x0a## Usage example:\x0a\x0a\x09| ast interpreter |\x0a\x09ast := Smalltalk current parse: 'foo 1+2+4'.\x0a\x09(SemanticAnalyzer on: Object) visit: ast.\x0a\x0a\x09interpreter := ASTSteppingInterpreter new\x0a\x09\x09interpret: ast nodes first;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09interpreter step; step.\x0a\x09interpreter step; step.\x0a\x09interpreter result.\x22Answers 1\x22\x0a\x09interpreter step.\x0a\x09interpreter result. \x22Answers 3\x22\x0a\x09interpreter step.\x0a\x09interpreter result. \x22Answers 7\x22";
  1321. smalltalk.addMethod(
  1322. smalltalk.method({
  1323. selector: "atEnd",
  1324. category: 'testing',
  1325. fn: function (){
  1326. var self=this;
  1327. return smalltalk.withContext(function($ctx1) {
  1328. var $1;
  1329. $1=_st(_st(self)._shouldReturn())._or_((function(){
  1330. return smalltalk.withContext(function($ctx2) {
  1331. return _st(_st(self)._nextNode()).__eq_eq(_st(self)._currentNode());
  1332. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1333. return $1;
  1334. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTSteppingInterpreter)})},
  1335. args: [],
  1336. source: "atEnd\x0a\x09^ self shouldReturn or: [ self nextNode == self currentNode ]",
  1337. messageSends: ["or:", "==", "currentNode", "nextNode", "shouldReturn"],
  1338. referencedClasses: []
  1339. }),
  1340. smalltalk.ASTSteppingInterpreter);
  1341. smalltalk.addMethod(
  1342. smalltalk.method({
  1343. selector: "initialize",
  1344. category: 'initialization',
  1345. fn: function (){
  1346. var self=this;
  1347. return smalltalk.withContext(function($ctx1) {
  1348. smalltalk.ASTInterpreter.fn.prototype._initialize.apply(_st(self), []);
  1349. self["@continuation"]=(function(){
  1350. return smalltalk.withContext(function($ctx2) {
  1351. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  1352. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ASTSteppingInterpreter)})},
  1353. args: [],
  1354. source: "initialize\x0a\x09super initialize.\x0a\x09continuation := []",
  1355. messageSends: ["initialize"],
  1356. referencedClasses: []
  1357. }),
  1358. smalltalk.ASTSteppingInterpreter);
  1359. smalltalk.addMethod(
  1360. smalltalk.method({
  1361. selector: "interpret:continue:",
  1362. category: 'interpreting',
  1363. fn: function (aNode,aBlock){
  1364. var self=this;
  1365. return smalltalk.withContext(function($ctx1) {
  1366. self["@nextNode"]=aNode;
  1367. self["@continuation"]=(function(){
  1368. return smalltalk.withContext(function($ctx2) {
  1369. return smalltalk.ASTInterpreter.fn.prototype._interpret_continue_.apply(_st(self), [aNode,aBlock]);
  1370. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  1371. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTSteppingInterpreter)})},
  1372. args: ["aNode", "aBlock"],
  1373. source: "interpret: aNode continue: aBlock\x0a\x09nextNode := aNode.\x0a\x09continuation := [\x0a\x09\x09super interpret: aNode continue: aBlock ]",
  1374. messageSends: ["interpret:continue:"],
  1375. referencedClasses: []
  1376. }),
  1377. smalltalk.ASTSteppingInterpreter);
  1378. smalltalk.addMethod(
  1379. smalltalk.method({
  1380. selector: "nextNode",
  1381. category: 'accessing',
  1382. fn: function (){
  1383. var self=this;
  1384. return smalltalk.withContext(function($ctx1) {
  1385. var $1;
  1386. $1=self["@nextNode"];
  1387. return $1;
  1388. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.ASTSteppingInterpreter)})},
  1389. args: [],
  1390. source: "nextNode\x0a\x09^ nextNode",
  1391. messageSends: [],
  1392. referencedClasses: []
  1393. }),
  1394. smalltalk.ASTSteppingInterpreter);
  1395. smalltalk.addMethod(
  1396. smalltalk.method({
  1397. selector: "step",
  1398. category: 'stepping',
  1399. fn: function (){
  1400. var self=this;
  1401. return smalltalk.withContext(function($ctx1) {
  1402. _st(self["@continuation"])._value();
  1403. return self}, function($ctx1) {$ctx1.fill(self,"step",{},smalltalk.ASTSteppingInterpreter)})},
  1404. args: [],
  1405. source: "step\x0a\x09continuation value",
  1406. messageSends: ["value"],
  1407. referencedClasses: []
  1408. }),
  1409. smalltalk.ASTSteppingInterpreter);
  1410. smalltalk.addClass('ASTPCNodeVisitor', smalltalk.NodeVisitor, ['useInlinings', 'pc', 'context', 'currentNode'], 'Compiler-Interpreter');
  1411. smalltalk.ASTPCNodeVisitor.comment="I visit an AST until I get to the current pc node and answer it.\x0a\x0a## API\x0a\x0aMy instances must be filled with a context object using `#context:`.\x0a\x0aAfter visiting the AST the current node corresponding to the `pc` is answered by `#currentNode`";
  1412. smalltalk.addMethod(
  1413. smalltalk.method({
  1414. selector: "context",
  1415. category: 'accessing',
  1416. fn: function (){
  1417. var self=this;
  1418. return smalltalk.withContext(function($ctx1) {
  1419. var $1;
  1420. $1=self["@context"];
  1421. return $1;
  1422. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTPCNodeVisitor)})},
  1423. args: [],
  1424. source: "context\x0a\x09^ context",
  1425. messageSends: [],
  1426. referencedClasses: []
  1427. }),
  1428. smalltalk.ASTPCNodeVisitor);
  1429. smalltalk.addMethod(
  1430. smalltalk.method({
  1431. selector: "context:",
  1432. category: 'accessing',
  1433. fn: function (aContext){
  1434. var self=this;
  1435. return smalltalk.withContext(function($ctx1) {
  1436. self["@context"]=aContext;
  1437. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTPCNodeVisitor)})},
  1438. args: ["aContext"],
  1439. source: "context: aContext\x0a\x09context := aContext",
  1440. messageSends: [],
  1441. referencedClasses: []
  1442. }),
  1443. smalltalk.ASTPCNodeVisitor);
  1444. smalltalk.addMethod(
  1445. smalltalk.method({
  1446. selector: "currentNode",
  1447. category: 'accessing',
  1448. fn: function (){
  1449. var self=this;
  1450. return smalltalk.withContext(function($ctx1) {
  1451. var $1;
  1452. $1=self["@currentNode"];
  1453. return $1;
  1454. }, function($ctx1) {$ctx1.fill(self,"currentNode",{},smalltalk.ASTPCNodeVisitor)})},
  1455. args: [],
  1456. source: "currentNode\x0a\x09^ currentNode",
  1457. messageSends: [],
  1458. referencedClasses: []
  1459. }),
  1460. smalltalk.ASTPCNodeVisitor);
  1461. smalltalk.addMethod(
  1462. smalltalk.method({
  1463. selector: "pc",
  1464. category: 'accessing',
  1465. fn: function (){
  1466. var self=this;
  1467. return smalltalk.withContext(function($ctx1) {
  1468. var $2,$1;
  1469. $2=self["@pc"];
  1470. if(($receiver = $2) == nil || $receiver == undefined){
  1471. $1=(0);
  1472. } else {
  1473. $1=$2;
  1474. };
  1475. return $1;
  1476. }, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.ASTPCNodeGetter)})},
  1477. args: [],
  1478. source: "pc\x0a\x09^ pc ifNil: [ 0 ]",
  1479. messageSends: ["ifNil:"],
  1480. referencedClasses: []
  1481. }),
  1482. smalltalk.ASTPCNodeVisitor);
  1483. smalltalk.addMethod(
  1484. smalltalk.method({
  1485. selector: "pc:",
  1486. category: 'accessing',
  1487. fn: function (anInteger){
  1488. var self=this;
  1489. return smalltalk.withContext(function($ctx1) {
  1490. self["@pc"]=anInteger;
  1491. return self}, function($ctx1) {$ctx1.fill(self,"pc:",{anInteger:anInteger},smalltalk.ASTPCNodeGetter)})},
  1492. args: ["anInteger"],
  1493. source: "pc: anInteger\x0a\x09pc := anInteger",
  1494. messageSends: [],
  1495. referencedClasses: []
  1496. }),
  1497. smalltalk.ASTPCNodeVisitor);
  1498. smalltalk.addMethod(
  1499. smalltalk.method({
  1500. selector: "useInlinings",
  1501. category: 'accessing',
  1502. fn: function (){
  1503. var self=this;
  1504. return smalltalk.withContext(function($ctx1) {
  1505. var $2,$1;
  1506. $2=self["@useInlinings"];
  1507. if(($receiver = $2) == nil || $receiver == undefined){
  1508. $1=true;
  1509. } else {
  1510. $1=$2;
  1511. };
  1512. return $1;
  1513. }, function($ctx1) {$ctx1.fill(self,"useInlinings",{},smalltalk.ASTPCNodeGetter)})},
  1514. args: [],
  1515. source: "useInlinings\x0a\x09^ useInlinings ifNil: [ true ]",
  1516. messageSends: ["ifNil:"],
  1517. referencedClasses: []
  1518. }),
  1519. smalltalk.ASTPCNodeVisitor);
  1520. smalltalk.addMethod(
  1521. smalltalk.method({
  1522. selector: "useInlinings:",
  1523. category: 'accessing',
  1524. fn: function (aBoolean){
  1525. var self=this;
  1526. return smalltalk.withContext(function($ctx1) {
  1527. self["@useInlinings"]=aBoolean;
  1528. return self}, function($ctx1) {$ctx1.fill(self,"useInlinings:",{aBoolean:aBoolean},smalltalk.ASTPCNodeGetter)})},
  1529. args: ["aBoolean"],
  1530. source: "useInlinings: aBoolean\x0a\x09useInlinings := aBoolean",
  1531. messageSends: [],
  1532. referencedClasses: []
  1533. }),
  1534. smalltalk.ASTPCNodeVisitor);
  1535. smalltalk.addMethod(
  1536. smalltalk.method({
  1537. selector: "visitJSStatementNode:",
  1538. category: 'visiting',
  1539. fn: function (aNode){
  1540. var self=this;
  1541. return smalltalk.withContext(function($ctx1) {
  1542. self["@currentNode"]=aNode;
  1543. return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.ASTPCNodeVisitor)})},
  1544. args: ["aNode"],
  1545. source: "visitJSStatementNode: aNode\x0a\x09currentNode := aNode",
  1546. messageSends: [],
  1547. referencedClasses: []
  1548. }),
  1549. smalltalk.ASTPCNodeVisitor);
  1550. smalltalk.addMethod(
  1551. smalltalk.method({
  1552. selector: "visitSendNode:",
  1553. category: 'visiting',
  1554. fn: function (aNode){
  1555. var self=this;
  1556. return smalltalk.withContext(function($ctx1) {
  1557. var $1,$2;
  1558. smalltalk.NodeVisitor.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
  1559. $1=_st(_st(self)._pc()).__eq(_st(_st(self)._context())._pc());
  1560. if(! smalltalk.assert($1)){
  1561. $2=_st(aNode)._shouldBeInlined();
  1562. if(! smalltalk.assert($2)){
  1563. _st(self)._pc_(_st(_st(self)._pc()).__plus((1)));
  1564. self["@currentNode"]=aNode;
  1565. self["@currentNode"];
  1566. };
  1567. };
  1568. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},smalltalk.ASTPCNodeVisitor)})},
  1569. args: ["aNode"],
  1570. source: "visitSendNode: aNode\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self pc = self context pc ifFalse: [\x0a\x09\x09aNode shouldBeInlined ifFalse: [ \x0a\x09\x09\x09self pc: self pc + 1.\x0a\x09\x09\x09currentNode := aNode ] ]",
  1571. messageSends: ["visitSendNode:", "ifFalse:", "pc:", "+", "pc", "shouldBeInlined", "=", "context"],
  1572. referencedClasses: []
  1573. }),
  1574. smalltalk.ASTPCNodeVisitor);
  1575. smalltalk.addMethod(
  1576. smalltalk.method({
  1577. selector: "interpreter:continue:",
  1578. category: '*Compiler-Interpreter',
  1579. fn: function (anInterpreter,aBlock){
  1580. var self=this;
  1581. return smalltalk.withContext(function($ctx1) {
  1582. var $1;
  1583. $1=_st(anInterpreter)._interpretNode_continue_(self,aBlock);
  1584. return $1;
  1585. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.Node)})},
  1586. args: ["anInterpreter", "aBlock"],
  1587. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretNode: self continue: aBlock",
  1588. messageSends: ["interpretNode:continue:"],
  1589. referencedClasses: []
  1590. }),
  1591. smalltalk.Node);
  1592. smalltalk.addMethod(
  1593. smalltalk.method({
  1594. selector: "isSteppingNode",
  1595. category: '*Compiler-Interpreter',
  1596. fn: function (){
  1597. var self=this;
  1598. return smalltalk.withContext(function($ctx1) {
  1599. return false;
  1600. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.Node)})},
  1601. args: [],
  1602. source: "isSteppingNode\x0a\x09^ false",
  1603. messageSends: [],
  1604. referencedClasses: []
  1605. }),
  1606. smalltalk.Node);
  1607. smalltalk.addMethod(
  1608. smalltalk.method({
  1609. selector: "interpreter:continue:",
  1610. category: '*Compiler-Interpreter',
  1611. fn: function (anInterpreter,aBlock){
  1612. var self=this;
  1613. return smalltalk.withContext(function($ctx1) {
  1614. var $1;
  1615. $1=_st(anInterpreter)._interpretAssignmentNode_continue_(self,aBlock);
  1616. return $1;
  1617. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.AssignmentNode)})},
  1618. args: ["anInterpreter", "aBlock"],
  1619. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretAssignmentNode: self continue: aBlock",
  1620. messageSends: ["interpretAssignmentNode:continue:"],
  1621. referencedClasses: []
  1622. }),
  1623. smalltalk.AssignmentNode);
  1624. smalltalk.addMethod(
  1625. smalltalk.method({
  1626. selector: "isSteppingNode",
  1627. category: '*Compiler-Interpreter',
  1628. fn: function (){
  1629. var self=this;
  1630. return smalltalk.withContext(function($ctx1) {
  1631. return true;
  1632. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.AssignmentNode)})},
  1633. args: [],
  1634. source: "isSteppingNode\x0a\x09^ true",
  1635. messageSends: [],
  1636. referencedClasses: []
  1637. }),
  1638. smalltalk.AssignmentNode);
  1639. smalltalk.addMethod(
  1640. smalltalk.method({
  1641. selector: "interpreter:continue:",
  1642. category: '*Compiler-Interpreter',
  1643. fn: function (anInterpreter,aBlock){
  1644. var self=this;
  1645. return smalltalk.withContext(function($ctx1) {
  1646. var $1;
  1647. $1=_st(anInterpreter)._interpretBlockNode_continue_(self,aBlock);
  1648. return $1;
  1649. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.BlockNode)})},
  1650. args: ["anInterpreter", "aBlock"],
  1651. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretBlockNode: self continue: aBlock",
  1652. messageSends: ["interpretBlockNode:continue:"],
  1653. referencedClasses: []
  1654. }),
  1655. smalltalk.BlockNode);
  1656. smalltalk.addMethod(
  1657. smalltalk.method({
  1658. selector: "isSteppingNode",
  1659. category: '*Compiler-Interpreter',
  1660. fn: function (){
  1661. var self=this;
  1662. return smalltalk.withContext(function($ctx1) {
  1663. return true;
  1664. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.BlockNode)})},
  1665. args: [],
  1666. source: "isSteppingNode\x0a\x09^ true",
  1667. messageSends: [],
  1668. referencedClasses: []
  1669. }),
  1670. smalltalk.BlockNode);
  1671. smalltalk.addMethod(
  1672. smalltalk.method({
  1673. selector: "interpreter:continue:",
  1674. category: '*Compiler-Interpreter',
  1675. fn: function (anInterpreter,aBlock){
  1676. var self=this;
  1677. return smalltalk.withContext(function($ctx1) {
  1678. var $1;
  1679. $1=_st(anInterpreter)._interpretCascadeNode_continue_(self,aBlock);
  1680. return $1;
  1681. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.CascadeNode)})},
  1682. args: ["anInterpreter", "aBlock"],
  1683. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretCascadeNode: self continue: aBlock",
  1684. messageSends: ["interpretCascadeNode:continue:"],
  1685. referencedClasses: []
  1686. }),
  1687. smalltalk.CascadeNode);
  1688. smalltalk.addMethod(
  1689. smalltalk.method({
  1690. selector: "interpreter:continue:",
  1691. category: '*Compiler-Interpreter',
  1692. fn: function (anInterpreter,aBlock){
  1693. var self=this;
  1694. return smalltalk.withContext(function($ctx1) {
  1695. var $1;
  1696. $1=_st(anInterpreter)._interpretDynamicArrayNode_continue_(self,aBlock);
  1697. return $1;
  1698. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.DynamicArrayNode)})},
  1699. args: ["anInterpreter", "aBlock"],
  1700. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretDynamicArrayNode: self continue: aBlock",
  1701. messageSends: ["interpretDynamicArrayNode:continue:"],
  1702. referencedClasses: []
  1703. }),
  1704. smalltalk.DynamicArrayNode);
  1705. smalltalk.addMethod(
  1706. smalltalk.method({
  1707. selector: "isSteppingNode",
  1708. category: '*Compiler-Interpreter',
  1709. fn: function (){
  1710. var self=this;
  1711. return smalltalk.withContext(function($ctx1) {
  1712. return true;
  1713. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicArrayNode)})},
  1714. args: [],
  1715. source: "isSteppingNode\x0a\x09^ true",
  1716. messageSends: [],
  1717. referencedClasses: []
  1718. }),
  1719. smalltalk.DynamicArrayNode);
  1720. smalltalk.addMethod(
  1721. smalltalk.method({
  1722. selector: "interpreter:continue:",
  1723. category: '*Compiler-Interpreter',
  1724. fn: function (anInterpreter,aBlock){
  1725. var self=this;
  1726. return smalltalk.withContext(function($ctx1) {
  1727. var $1;
  1728. $1=_st(anInterpreter)._interpretDynamicDictionaryNode_continue_(self,aBlock);
  1729. return $1;
  1730. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.DynamicDictionaryNode)})},
  1731. args: ["anInterpreter", "aBlock"],
  1732. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretDynamicDictionaryNode: self continue: aBlock",
  1733. messageSends: ["interpretDynamicDictionaryNode:continue:"],
  1734. referencedClasses: []
  1735. }),
  1736. smalltalk.DynamicDictionaryNode);
  1737. smalltalk.addMethod(
  1738. smalltalk.method({
  1739. selector: "isSteppingNode",
  1740. category: '*Compiler-Interpreter',
  1741. fn: function (){
  1742. var self=this;
  1743. return smalltalk.withContext(function($ctx1) {
  1744. return true;
  1745. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicDictionaryNode)})},
  1746. args: [],
  1747. source: "isSteppingNode\x0a\x09^ true",
  1748. messageSends: [],
  1749. referencedClasses: []
  1750. }),
  1751. smalltalk.DynamicDictionaryNode);
  1752. smalltalk.addMethod(
  1753. smalltalk.method({
  1754. selector: "interpreter:continue:",
  1755. category: '*Compiler-Interpreter',
  1756. fn: function (anInterpreter,aBlock){
  1757. var self=this;
  1758. return smalltalk.withContext(function($ctx1) {
  1759. var $1;
  1760. $1=_st(anInterpreter)._interpretJSStatementNode_continue_(self,aBlock);
  1761. return $1;
  1762. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.JSStatementNode)})},
  1763. args: ["anInterpreter", "aBlock"],
  1764. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretJSStatementNode: self continue: aBlock",
  1765. messageSends: ["interpretJSStatementNode:continue:"],
  1766. referencedClasses: []
  1767. }),
  1768. smalltalk.JSStatementNode);
  1769. smalltalk.addMethod(
  1770. smalltalk.method({
  1771. selector: "isSteppingNode",
  1772. category: '*Compiler-Interpreter',
  1773. fn: function (){
  1774. var self=this;
  1775. return smalltalk.withContext(function($ctx1) {
  1776. return true;
  1777. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.JSStatementNode)})},
  1778. args: [],
  1779. source: "isSteppingNode\x0a\x09^ true",
  1780. messageSends: [],
  1781. referencedClasses: []
  1782. }),
  1783. smalltalk.JSStatementNode);
  1784. smalltalk.addMethod(
  1785. smalltalk.method({
  1786. selector: "interpreter:continue:",
  1787. category: '*Compiler-Interpreter',
  1788. fn: function (anInterpreter,aBlock){
  1789. var self=this;
  1790. return smalltalk.withContext(function($ctx1) {
  1791. var $1;
  1792. $1=_st(anInterpreter)._interpretMethodNode_continue_(self,aBlock);
  1793. return $1;
  1794. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.MethodNode)})},
  1795. args: ["anInterpreter", "aBlock"],
  1796. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretMethodNode: self continue: aBlock",
  1797. messageSends: ["interpretMethodNode:continue:"],
  1798. referencedClasses: []
  1799. }),
  1800. smalltalk.MethodNode);
  1801. smalltalk.addMethod(
  1802. smalltalk.method({
  1803. selector: "interpreter:continue:",
  1804. category: '*Compiler-Interpreter',
  1805. fn: function (anInterpreter,aBlock){
  1806. var self=this;
  1807. return smalltalk.withContext(function($ctx1) {
  1808. var $1;
  1809. $1=_st(anInterpreter)._interpretReturnNode_continue_(self,aBlock);
  1810. return $1;
  1811. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ReturnNode)})},
  1812. args: ["anInterpreter", "aBlock"],
  1813. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretReturnNode: self continue: aBlock",
  1814. messageSends: ["interpretReturnNode:continue:"],
  1815. referencedClasses: []
  1816. }),
  1817. smalltalk.ReturnNode);
  1818. smalltalk.addMethod(
  1819. smalltalk.method({
  1820. selector: "interpreter:continue:",
  1821. category: '*Compiler-Interpreter',
  1822. fn: function (anInterpreter,aBlock){
  1823. var self=this;
  1824. return smalltalk.withContext(function($ctx1) {
  1825. var $1;
  1826. $1=_st(anInterpreter)._interpretSendNode_continue_(self,aBlock);
  1827. return $1;
  1828. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.SendNode)})},
  1829. args: ["anInterpreter", "aBlock"],
  1830. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretSendNode: self continue: aBlock",
  1831. messageSends: ["interpretSendNode:continue:"],
  1832. referencedClasses: []
  1833. }),
  1834. smalltalk.SendNode);
  1835. smalltalk.addMethod(
  1836. smalltalk.method({
  1837. selector: "isSteppingNode",
  1838. category: '*Compiler-Interpreter',
  1839. fn: function (){
  1840. var self=this;
  1841. return smalltalk.withContext(function($ctx1) {
  1842. return true;
  1843. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.SendNode)})},
  1844. args: [],
  1845. source: "isSteppingNode\x0a\x09^ true",
  1846. messageSends: [],
  1847. referencedClasses: []
  1848. }),
  1849. smalltalk.SendNode);
  1850. smalltalk.addMethod(
  1851. smalltalk.method({
  1852. selector: "interpreter:continue:",
  1853. category: '*Compiler-Interpreter',
  1854. fn: function (anInterpreter,aBlock){
  1855. var self=this;
  1856. return smalltalk.withContext(function($ctx1) {
  1857. var $1;
  1858. $1=_st(anInterpreter)._interpretSequenceNode_continue_(self,aBlock);
  1859. return $1;
  1860. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.SequenceNode)})},
  1861. args: ["anInterpreter", "aBlock"],
  1862. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretSequenceNode: self continue: aBlock",
  1863. messageSends: ["interpretSequenceNode:continue:"],
  1864. referencedClasses: []
  1865. }),
  1866. smalltalk.SequenceNode);
  1867. smalltalk.addMethod(
  1868. smalltalk.method({
  1869. selector: "interpreter:continue:",
  1870. category: '*Compiler-Interpreter',
  1871. fn: function (anInterpreter,aBlock){
  1872. var self=this;
  1873. return smalltalk.withContext(function($ctx1) {
  1874. var $1;
  1875. $1=_st(anInterpreter)._interpretBlockSequenceNode_continue_(self,aBlock);
  1876. return $1;
  1877. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.BlockSequenceNode)})},
  1878. args: ["anInterpreter", "aBlock"],
  1879. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretBlockSequenceNode: self continue: aBlock",
  1880. messageSends: ["interpretBlockSequenceNode:continue:"],
  1881. referencedClasses: []
  1882. }),
  1883. smalltalk.BlockSequenceNode);
  1884. smalltalk.addMethod(
  1885. smalltalk.method({
  1886. selector: "interpreter:continue:",
  1887. category: '*Compiler-Interpreter',
  1888. fn: function (anInterpreter,aBlock){
  1889. var self=this;
  1890. return smalltalk.withContext(function($ctx1) {
  1891. var $1;
  1892. $1=_st(anInterpreter)._interpretValueNode_continue_(self,aBlock);
  1893. return $1;
  1894. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ValueNode)})},
  1895. args: ["anInterpreter", "aBlock"],
  1896. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretValueNode: self continue: aBlock",
  1897. messageSends: ["interpretValueNode:continue:"],
  1898. referencedClasses: []
  1899. }),
  1900. smalltalk.ValueNode);
  1901. smalltalk.addMethod(
  1902. smalltalk.method({
  1903. selector: "interpreter:continue:",
  1904. category: '*Compiler-Interpreter',
  1905. fn: function (anInterpreter,aBlock){
  1906. var self=this;
  1907. return smalltalk.withContext(function($ctx1) {
  1908. var $1;
  1909. $1=_st(anInterpreter)._interpretVariableNode_continue_(self,aBlock);
  1910. return $1;
  1911. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.VariableNode)})},
  1912. args: ["anInterpreter", "aBlock"],
  1913. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretVariableNode: self continue: aBlock",
  1914. messageSends: ["interpretVariableNode:continue:"],
  1915. referencedClasses: []
  1916. }),
  1917. smalltalk.VariableNode);
  1918. smalltalk.addMethod(
  1919. smalltalk.method({
  1920. selector: "interpreter:continue:",
  1921. category: '*Compiler-Interpreter',
  1922. fn: function (anInterpreter,aBlock){
  1923. var self=this;
  1924. return smalltalk.withContext(function($ctx1) {
  1925. var $1;
  1926. $1=_st(anInterpreter)._interpretClassReferenceNode_continue_(self,aBlock);
  1927. return $1;
  1928. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ClassReferenceNode)})},
  1929. args: ["anInterpreter", "aBlock"],
  1930. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretClassReferenceNode: self continue: aBlock",
  1931. messageSends: ["interpretClassReferenceNode:continue:"],
  1932. referencedClasses: []
  1933. }),
  1934. smalltalk.ClassReferenceNode);