Compiler-Interpreter.js 84 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448
  1. define("amber_core/Compiler-Interpreter", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects", "amber_core/Compiler-Core", "amber_core/Kernel-Exceptions", "amber_core/Compiler-AST"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Compiler-Interpreter');
  3. smalltalk.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AIBlockClosure', smalltalk.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  5. smalltalk.AIBlockClosure.comment="I am a special `BlockClosure` subclass used by an interpreter to interpret a block node.\x0a\x0aWhile I am polymorphic with `BlockClosure`, some methods such as `#new` will raise interpretation errors. Unlike a `BlockClosure`, my instance are not JavaScript functions.\x0a\x0aEvaluating an instance will result in interpreting the `node` instance variable (instance of `BlockNode`).";
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "applyTo:arguments:",
  9. category: 'evaluating',
  10. fn: function (anObject,aCollection){
  11. var self=this;
  12. return smalltalk.withContext(function($ctx1) {
  13. self._interpreterError();
  14. return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},smalltalk.AIBlockClosure)})},
  15. args: ["anObject", "aCollection"],
  16. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  17. messageSends: ["interpreterError"],
  18. referencedClasses: []
  19. }),
  20. smalltalk.AIBlockClosure);
  21. smalltalk.addMethod(
  22. smalltalk.method({
  23. selector: "compiledSource",
  24. category: 'accessing',
  25. fn: function (){
  26. var self=this;
  27. return smalltalk.withContext(function($ctx1) {
  28. return "[ AST Block closure ]";
  29. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},smalltalk.AIBlockClosure)})},
  30. args: [],
  31. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  32. messageSends: [],
  33. referencedClasses: []
  34. }),
  35. smalltalk.AIBlockClosure);
  36. smalltalk.addMethod(
  37. smalltalk.method({
  38. selector: "currySelf",
  39. category: 'converting',
  40. fn: function (){
  41. var self=this;
  42. return smalltalk.withContext(function($ctx1) {
  43. self._interpreterError();
  44. return self}, function($ctx1) {$ctx1.fill(self,"currySelf",{},smalltalk.AIBlockClosure)})},
  45. args: [],
  46. source: "currySelf\x0a\x09self interpreterError",
  47. messageSends: ["interpreterError"],
  48. referencedClasses: []
  49. }),
  50. smalltalk.AIBlockClosure);
  51. smalltalk.addMethod(
  52. smalltalk.method({
  53. selector: "initializeWithContext:node:",
  54. category: 'initialization',
  55. fn: function (aContext,aNode){
  56. var self=this;
  57. return smalltalk.withContext(function($ctx1) {
  58. self["@node"]=aNode;
  59. self["@outerContext"]=aContext;
  60. return self}, function($ctx1) {$ctx1.fill(self,"initializeWithContext:node:",{aContext:aContext,aNode:aNode},smalltalk.AIBlockClosure)})},
  61. args: ["aContext", "aNode"],
  62. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  63. messageSends: [],
  64. referencedClasses: []
  65. }),
  66. smalltalk.AIBlockClosure);
  67. smalltalk.addMethod(
  68. smalltalk.method({
  69. selector: "interpreterError",
  70. category: 'error handling',
  71. fn: function (){
  72. var self=this;
  73. function $ASTInterpreterError(){return smalltalk.ASTInterpreterError||(typeof ASTInterpreterError=="undefined"?nil:ASTInterpreterError)}
  74. return smalltalk.withContext(function($ctx1) {
  75. _st($ASTInterpreterError())._signal_("Method cannot be interpreted by the interpreter.");
  76. return self}, function($ctx1) {$ctx1.fill(self,"interpreterError",{},smalltalk.AIBlockClosure)})},
  77. args: [],
  78. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  79. messageSends: ["signal:"],
  80. referencedClasses: ["ASTInterpreterError"]
  81. }),
  82. smalltalk.AIBlockClosure);
  83. smalltalk.addMethod(
  84. smalltalk.method({
  85. selector: "numArgs",
  86. category: 'accessing',
  87. fn: function (){
  88. var self=this;
  89. return smalltalk.withContext(function($ctx1) {
  90. var $1;
  91. $1=_st(_st(self["@node"])._temps())._size();
  92. return $1;
  93. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},smalltalk.AIBlockClosure)})},
  94. args: [],
  95. source: "numArgs\x0a\x09^ node temps size",
  96. messageSends: ["size", "temps"],
  97. referencedClasses: []
  98. }),
  99. smalltalk.AIBlockClosure);
  100. smalltalk.addMethod(
  101. smalltalk.method({
  102. selector: "value",
  103. category: 'evaluating',
  104. fn: function (){
  105. var self=this;
  106. return smalltalk.withContext(function($ctx1) {
  107. var $1;
  108. $1=self._valueWithPossibleArguments_([]);
  109. return $1;
  110. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.AIBlockClosure)})},
  111. args: [],
  112. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  113. messageSends: ["valueWithPossibleArguments:"],
  114. referencedClasses: []
  115. }),
  116. smalltalk.AIBlockClosure);
  117. smalltalk.addMethod(
  118. smalltalk.method({
  119. selector: "value:",
  120. category: 'evaluating',
  121. fn: function (anArgument){
  122. var self=this;
  123. return smalltalk.withContext(function($ctx1) {
  124. var $1;
  125. $1=self._valueWithPossibleArguments_([anArgument]);
  126. return $1;
  127. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},smalltalk.AIBlockClosure)})},
  128. args: ["anArgument"],
  129. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  130. messageSends: ["valueWithPossibleArguments:"],
  131. referencedClasses: []
  132. }),
  133. smalltalk.AIBlockClosure);
  134. smalltalk.addMethod(
  135. smalltalk.method({
  136. selector: "value:value:",
  137. category: 'evaluating',
  138. fn: function (firstArgument,secondArgument){
  139. var self=this;
  140. return smalltalk.withContext(function($ctx1) {
  141. var $1;
  142. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  143. return $1;
  144. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},smalltalk.AIBlockClosure)})},
  145. args: ["firstArgument", "secondArgument"],
  146. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  147. messageSends: ["valueWithPossibleArguments:"],
  148. referencedClasses: []
  149. }),
  150. smalltalk.AIBlockClosure);
  151. smalltalk.addMethod(
  152. smalltalk.method({
  153. selector: "value:value:value:",
  154. category: 'evaluating',
  155. fn: function (firstArgument,secondArgument,thirdArgument){
  156. var self=this;
  157. return smalltalk.withContext(function($ctx1) {
  158. var $1;
  159. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  160. return $1;
  161. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},smalltalk.AIBlockClosure)})},
  162. args: ["firstArgument", "secondArgument", "thirdArgument"],
  163. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  164. messageSends: ["valueWithPossibleArguments:"],
  165. referencedClasses: []
  166. }),
  167. smalltalk.AIBlockClosure);
  168. smalltalk.addMethod(
  169. smalltalk.method({
  170. selector: "valueWithPossibleArguments:",
  171. category: 'evaluating',
  172. fn: function (aCollection){
  173. var self=this;
  174. var context,sequenceNode;
  175. return smalltalk.withContext(function($ctx1) {
  176. var $1,$2,$3,$4,$5,$7,$6;
  177. context=_st(self["@outerContext"])._newBlockContext();
  178. $1=_st(_st(_st(self["@node"])._nodes())._first())._copy();
  179. _st($1)._parent_(nil);
  180. $2=_st($1)._yourself();
  181. sequenceNode=$2;
  182. _st(_st(self["@node"])._parameters())._withIndexDo_((function(each,index){
  183. return smalltalk.withContext(function($ctx2) {
  184. return _st(context)._localAt_put_(each,_st(aCollection)._at_ifAbsent_(index,(function(){
  185. return smalltalk.withContext(function($ctx3) {
  186. return nil;
  187. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})})));
  188. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  189. $3=_st(context)._interpreter();
  190. $ctx1.sendIdx["interpreter"]=1;
  191. _st($3)._node_(_st(sequenceNode)._nextChild());
  192. $4=_st($3)._proceed();
  193. $5=_st(self["@outerContext"])._interpreter();
  194. $ctx1.sendIdx["interpreter"]=2;
  195. _st($5)._setNonLocalReturnFromContext_(context);
  196. $7=_st(context)._interpreter();
  197. $6=_st($7)._pop();
  198. return $6;
  199. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},smalltalk.AIBlockClosure)})},
  200. args: ["aCollection"],
  201. source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newBlockContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node nodes first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode nextChild;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
  202. messageSends: ["newBlockContext", "parent:", "copy", "first", "nodes", "yourself", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "nextChild", "proceed", "setNonLocalReturnFromContext:", "pop"],
  203. referencedClasses: []
  204. }),
  205. smalltalk.AIBlockClosure);
  206. smalltalk.addMethod(
  207. smalltalk.method({
  208. selector: "forContext:node:",
  209. category: 'instance creation',
  210. fn: function (aContext,aNode){
  211. var self=this;
  212. return smalltalk.withContext(function($ctx1) {
  213. var $2,$3,$1;
  214. $2=self._new();
  215. _st($2)._initializeWithContext_node_(aContext,aNode);
  216. $3=_st($2)._yourself();
  217. $1=$3;
  218. return $1;
  219. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},smalltalk.AIBlockClosure.klass)})},
  220. args: ["aContext", "aNode"],
  221. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  222. messageSends: ["initializeWithContext:node:", "new", "yourself"],
  223. referencedClasses: []
  224. }),
  225. smalltalk.AIBlockClosure.klass);
  226. smalltalk.addClass('AIContext', smalltalk.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter'], 'Compiler-Interpreter');
  227. 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)";
  228. smalltalk.addMethod(
  229. smalltalk.method({
  230. selector: "arguments",
  231. category: 'interpreting',
  232. fn: function (){
  233. var self=this;
  234. return smalltalk.withContext(function($ctx1) {
  235. var $1;
  236. $1=_st(_st(self._ast())._arguments())._collect_((function(each){
  237. return smalltalk.withContext(function($ctx2) {
  238. return self._localAt_(each);
  239. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  240. return $1;
  241. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.AIContext)})},
  242. args: [],
  243. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ]",
  244. messageSends: ["collect:", "arguments", "ast", "localAt:"],
  245. referencedClasses: []
  246. }),
  247. smalltalk.AIContext);
  248. smalltalk.addMethod(
  249. smalltalk.method({
  250. selector: "ast",
  251. category: 'interpreting',
  252. fn: function (){
  253. var self=this;
  254. return smalltalk.withContext(function($ctx1) {
  255. var $1,$3,$2,$4,$5;
  256. $1=self._isBlockContext();
  257. if(smalltalk.assert($1)){
  258. $3=self._outerContext();
  259. if(($receiver = $3) == nil || $receiver == null){
  260. $2=$3;
  261. } else {
  262. var context;
  263. context=$receiver;
  264. $2=_st(context)._ast();
  265. };
  266. return $2;
  267. };
  268. $4=self["@ast"];
  269. if(($receiver = $4) == nil || $receiver == null){
  270. self._initializeAST();
  271. } else {
  272. $4;
  273. };
  274. $5=self["@ast"];
  275. return $5;
  276. }, function($ctx1) {$ctx1.fill(self,"ast",{},smalltalk.AIContext)})},
  277. args: [],
  278. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  279. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"],
  280. referencedClasses: []
  281. }),
  282. smalltalk.AIContext);
  283. smalltalk.addMethod(
  284. smalltalk.method({
  285. selector: "evaluatedSelector",
  286. category: 'accessing',
  287. fn: function (){
  288. var self=this;
  289. return smalltalk.withContext(function($ctx1) {
  290. var $1;
  291. $1=self["@evaluatedSelector"];
  292. return $1;
  293. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},smalltalk.AIContext)})},
  294. args: [],
  295. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  296. messageSends: [],
  297. referencedClasses: []
  298. }),
  299. smalltalk.AIContext);
  300. smalltalk.addMethod(
  301. smalltalk.method({
  302. selector: "evaluatedSelector:",
  303. category: 'accessing',
  304. fn: function (aString){
  305. var self=this;
  306. return smalltalk.withContext(function($ctx1) {
  307. self["@evaluatedSelector"]=aString;
  308. return self}, function($ctx1) {$ctx1.fill(self,"evaluatedSelector:",{aString:aString},smalltalk.AIContext)})},
  309. args: ["aString"],
  310. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  311. messageSends: [],
  312. referencedClasses: []
  313. }),
  314. smalltalk.AIContext);
  315. smalltalk.addMethod(
  316. smalltalk.method({
  317. selector: "index",
  318. category: 'accessing',
  319. fn: function (){
  320. var self=this;
  321. return smalltalk.withContext(function($ctx1) {
  322. var $2,$1;
  323. $2=self["@index"];
  324. if(($receiver = $2) == nil || $receiver == null){
  325. $1=(0);
  326. } else {
  327. $1=$2;
  328. };
  329. return $1;
  330. }, function($ctx1) {$ctx1.fill(self,"index",{},smalltalk.AIContext)})},
  331. args: [],
  332. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  333. messageSends: ["ifNil:"],
  334. referencedClasses: []
  335. }),
  336. smalltalk.AIContext);
  337. smalltalk.addMethod(
  338. smalltalk.method({
  339. selector: "index:",
  340. category: 'accessing',
  341. fn: function (anInteger){
  342. var self=this;
  343. return smalltalk.withContext(function($ctx1) {
  344. self["@index"]=anInteger;
  345. return self}, function($ctx1) {$ctx1.fill(self,"index:",{anInteger:anInteger},smalltalk.AIContext)})},
  346. args: ["anInteger"],
  347. source: "index: anInteger\x0a\x09index := anInteger",
  348. messageSends: [],
  349. referencedClasses: []
  350. }),
  351. smalltalk.AIContext);
  352. smalltalk.addMethod(
  353. smalltalk.method({
  354. selector: "initializeAST",
  355. category: 'initialization',
  356. fn: function (){
  357. var self=this;
  358. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  359. return smalltalk.withContext(function($ctx1) {
  360. var $1,$4,$3,$2;
  361. $1=self._method();
  362. $ctx1.sendIdx["method"]=1;
  363. self["@ast"]=_st($1)._ast();
  364. $4=self._method();
  365. $3=_st($4)._methodClass();
  366. $2=_st($SemanticAnalyzer())._on_($3);
  367. _st($2)._visit_(self["@ast"]);
  368. return self}, function($ctx1) {$ctx1.fill(self,"initializeAST",{},smalltalk.AIContext)})},
  369. args: [],
  370. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  371. messageSends: ["ast", "method", "visit:", "on:", "methodClass"],
  372. referencedClasses: ["SemanticAnalyzer"]
  373. }),
  374. smalltalk.AIContext);
  375. smalltalk.addMethod(
  376. smalltalk.method({
  377. selector: "initializeFromMethodContext:",
  378. category: 'initialization',
  379. fn: function (aMethodContext){
  380. var self=this;
  381. return smalltalk.withContext(function($ctx1) {
  382. var $1,$2,$3,$5,$6,$4,$7,$8;
  383. self._evaluatedSelector_(_st(aMethodContext)._evaluatedSelector());
  384. self._index_(_st(aMethodContext)._index());
  385. self._sendIndexes_(_st(aMethodContext)._sendIndexes());
  386. self._receiver_(_st(aMethodContext)._receiver());
  387. $1=self._selector_(_st(aMethodContext)._selector());
  388. $2=_st(aMethodContext)._outerContext();
  389. $ctx1.sendIdx["outerContext"]=1;
  390. if(($receiver = $2) == nil || $receiver == null){
  391. $2;
  392. } else {
  393. var outer;
  394. outer=$receiver;
  395. $3=_st(outer)._methodContext();
  396. if(($receiver = $3) == nil || $receiver == null){
  397. $3;
  398. } else {
  399. $5=self._class();
  400. $6=_st(aMethodContext)._outerContext();
  401. $4=_st($5)._fromMethodContext_($6);
  402. self._outerContext_($4);
  403. };
  404. $7=_st(aMethodContext)._locals();
  405. $ctx1.sendIdx["locals"]=1;
  406. _st($7)._keysAndValuesDo_((function(key,value){
  407. return smalltalk.withContext(function($ctx2) {
  408. $8=self._locals();
  409. return _st($8)._at_put_(key,value);
  410. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)})}));
  411. };
  412. return self}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext)})},
  413. args: ["aMethodContext"],
  414. source: "initializeFromMethodContext: aMethodContext\x0a\x0a\x09self\x0a\x09\x09evaluatedSelector: aMethodContext evaluatedSelector;\x0a\x09\x09index: aMethodContext index;\x0a\x09\x09sendIndexes: aMethodContext sendIndexes;\x0a\x09\x09receiver: aMethodContext receiver;\x0a\x09\x09selector: aMethodContext selector.\x0a\x09\x09\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 ] ]",
  415. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"],
  416. referencedClasses: []
  417. }),
  418. smalltalk.AIContext);
  419. smalltalk.addMethod(
  420. smalltalk.method({
  421. selector: "initializeInterpreter",
  422. category: 'initialization',
  423. fn: function (){
  424. var self=this;
  425. function $ASTInterpreter(){return smalltalk.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  426. return smalltalk.withContext(function($ctx1) {
  427. var $1,$2,$3;
  428. $1=_st($ASTInterpreter())._new();
  429. _st($1)._context_(self);
  430. $2=_st($1)._yourself();
  431. self["@interpreter"]=$2;
  432. $3=self._innerContext();
  433. if(($receiver = $3) == nil || $receiver == null){
  434. $3;
  435. } else {
  436. self._setupInterpreter_(self["@interpreter"]);
  437. };
  438. return self}, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},smalltalk.AIContext)})},
  439. args: [],
  440. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  441. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"],
  442. referencedClasses: ["ASTInterpreter"]
  443. }),
  444. smalltalk.AIContext);
  445. smalltalk.addMethod(
  446. smalltalk.method({
  447. selector: "initializeLocals",
  448. category: 'initialization',
  449. fn: function (){
  450. var self=this;
  451. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  452. return smalltalk.withContext(function($ctx1) {
  453. self["@locals"]=_st($Dictionary())._new();
  454. _st(self["@locals"])._at_put_("thisContext",self);
  455. return self}, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},smalltalk.AIContext)})},
  456. args: [],
  457. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  458. messageSends: ["new", "at:put:"],
  459. referencedClasses: ["Dictionary"]
  460. }),
  461. smalltalk.AIContext);
  462. smalltalk.addMethod(
  463. smalltalk.method({
  464. selector: "innerContext",
  465. category: 'accessing',
  466. fn: function (){
  467. var self=this;
  468. return smalltalk.withContext(function($ctx1) {
  469. var $1;
  470. $1=self["@innerContext"];
  471. return $1;
  472. }, function($ctx1) {$ctx1.fill(self,"innerContext",{},smalltalk.AIContext)})},
  473. args: [],
  474. source: "innerContext\x0a\x09^ innerContext",
  475. messageSends: [],
  476. referencedClasses: []
  477. }),
  478. smalltalk.AIContext);
  479. smalltalk.addMethod(
  480. smalltalk.method({
  481. selector: "innerContext:",
  482. category: 'accessing',
  483. fn: function (anAIContext){
  484. var self=this;
  485. return smalltalk.withContext(function($ctx1) {
  486. self["@innerContext"]=anAIContext;
  487. return self}, function($ctx1) {$ctx1.fill(self,"innerContext:",{anAIContext:anAIContext},smalltalk.AIContext)})},
  488. args: ["anAIContext"],
  489. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  490. messageSends: [],
  491. referencedClasses: []
  492. }),
  493. smalltalk.AIContext);
  494. smalltalk.addMethod(
  495. smalltalk.method({
  496. selector: "interpreter",
  497. category: 'interpreting',
  498. fn: function (){
  499. var self=this;
  500. return smalltalk.withContext(function($ctx1) {
  501. var $1,$2;
  502. $1=self["@interpreter"];
  503. if(($receiver = $1) == nil || $receiver == null){
  504. self._initializeInterpreter();
  505. } else {
  506. $1;
  507. };
  508. $2=self["@interpreter"];
  509. return $2;
  510. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.AIContext)})},
  511. args: [],
  512. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  513. messageSends: ["ifNil:", "initializeInterpreter"],
  514. referencedClasses: []
  515. }),
  516. smalltalk.AIContext);
  517. smalltalk.addMethod(
  518. smalltalk.method({
  519. selector: "interpreter:",
  520. category: 'interpreting',
  521. fn: function (anInterpreter){
  522. var self=this;
  523. return smalltalk.withContext(function($ctx1) {
  524. self["@interpreter"]=anInterpreter;
  525. return self}, function($ctx1) {$ctx1.fill(self,"interpreter:",{anInterpreter:anInterpreter},smalltalk.AIContext)})},
  526. args: ["anInterpreter"],
  527. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  528. messageSends: [],
  529. referencedClasses: []
  530. }),
  531. smalltalk.AIContext);
  532. smalltalk.addMethod(
  533. smalltalk.method({
  534. selector: "localAt:",
  535. category: 'accessing',
  536. fn: function (aString){
  537. var self=this;
  538. return smalltalk.withContext(function($ctx1) {
  539. var $2,$1;
  540. $1=_st(self._locals())._at_ifAbsent_(aString,(function(){
  541. return smalltalk.withContext(function($ctx2) {
  542. $2=self._outerContext();
  543. if(($receiver = $2) == nil || $receiver == null){
  544. return $2;
  545. } else {
  546. var context;
  547. context=$receiver;
  548. return _st(context)._localAt_(aString);
  549. };
  550. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  551. return $1;
  552. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString},smalltalk.AIContext)})},
  553. args: ["aString"],
  554. source: "localAt: aString\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09^ self locals at: aString ifAbsent: [ \x0a\x09\x09self outerContext ifNotNil: [ :context | \x0a\x09\x09\x09context localAt: aString ] ]",
  555. messageSends: ["at:ifAbsent:", "locals", "ifNotNil:", "outerContext", "localAt:"],
  556. referencedClasses: []
  557. }),
  558. smalltalk.AIContext);
  559. smalltalk.addMethod(
  560. smalltalk.method({
  561. selector: "localAt:ifAbsent:",
  562. category: 'accessing',
  563. fn: function (aString,aBlock){
  564. var self=this;
  565. return smalltalk.withContext(function($ctx1) {
  566. var $2,$1;
  567. $1=_st(self._locals())._at_ifAbsent_(aString,(function(){
  568. return smalltalk.withContext(function($ctx2) {
  569. $2=self._outerContext();
  570. if(($receiver = $2) == nil || $receiver == null){
  571. return _st(aBlock)._value();
  572. } else {
  573. var context;
  574. context=$receiver;
  575. return _st(context)._localAt_ifAbsent_(aString,aBlock);
  576. };
  577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  578. return $1;
  579. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock},smalltalk.AIContext)})},
  580. args: ["aString", "aBlock"],
  581. source: "localAt: aString ifAbsent: aBlock\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09^ self locals at: aString ifAbsent: [ \x0a\x09\x09self outerContext \x0a\x09\x09\x09ifNotNil: [ :context | context localAt: aString ifAbsent: aBlock ]\x0a\x09\x09\x09ifNil: [aBlock value] ]",
  582. messageSends: ["at:ifAbsent:", "locals", "ifNotNil:ifNil:", "outerContext", "localAt:ifAbsent:", "value"],
  583. referencedClasses: []
  584. }),
  585. smalltalk.AIContext);
  586. smalltalk.addMethod(
  587. smalltalk.method({
  588. selector: "localAt:put:",
  589. category: 'accessing',
  590. fn: function (aString,anObject){
  591. var self=this;
  592. return smalltalk.withContext(function($ctx1) {
  593. _st(self._locals())._at_put_(aString,anObject);
  594. return self}, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject},smalltalk.AIContext)})},
  595. args: ["aString", "anObject"],
  596. source: "localAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  597. messageSends: ["at:put:", "locals"],
  598. referencedClasses: []
  599. }),
  600. smalltalk.AIContext);
  601. smalltalk.addMethod(
  602. smalltalk.method({
  603. selector: "locals",
  604. category: 'accessing',
  605. fn: function (){
  606. var self=this;
  607. return smalltalk.withContext(function($ctx1) {
  608. var $1,$2;
  609. $1=self["@locals"];
  610. if(($receiver = $1) == nil || $receiver == null){
  611. self._initializeLocals();
  612. } else {
  613. $1;
  614. };
  615. $2=self["@locals"];
  616. return $2;
  617. }, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.AIContext)})},
  618. args: [],
  619. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  620. messageSends: ["ifNil:", "initializeLocals"],
  621. referencedClasses: []
  622. }),
  623. smalltalk.AIContext);
  624. smalltalk.addMethod(
  625. smalltalk.method({
  626. selector: "method",
  627. category: 'accessing',
  628. fn: function (){
  629. var self=this;
  630. return smalltalk.withContext(function($ctx1) {
  631. var $2,$5,$4,$3,$7,$6,$1;
  632. $2=self._methodContext();
  633. $ctx1.sendIdx["methodContext"]=1;
  634. if(($receiver = $2) == nil || $receiver == null){
  635. $1=$2;
  636. } else {
  637. $5=self._methodContext();
  638. $ctx1.sendIdx["methodContext"]=2;
  639. $4=_st($5)._receiver();
  640. $3=_st($4)._class();
  641. $7=self._methodContext();
  642. $6=_st($7)._selector();
  643. $1=_st($3)._lookupSelector_($6);
  644. };
  645. return $1;
  646. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.AIContext)})},
  647. args: [],
  648. source: "method\x0a\x09^ self methodContext ifNotNil: [\x0a\x09\x09self methodContext receiver class lookupSelector: self methodContext selector ]",
  649. messageSends: ["ifNotNil:", "methodContext", "lookupSelector:", "class", "receiver", "selector"],
  650. referencedClasses: []
  651. }),
  652. smalltalk.AIContext);
  653. smalltalk.addMethod(
  654. smalltalk.method({
  655. selector: "newBlockContext",
  656. category: 'factory',
  657. fn: function (){
  658. var self=this;
  659. return smalltalk.withContext(function($ctx1) {
  660. var $2,$3,$1;
  661. $2=_st(self._class())._new();
  662. _st($2)._outerContext_(self);
  663. $3=_st($2)._yourself();
  664. $1=$3;
  665. return $1;
  666. }, function($ctx1) {$ctx1.fill(self,"newBlockContext",{},smalltalk.AIContext)})},
  667. args: [],
  668. source: "newBlockContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  669. messageSends: ["outerContext:", "new", "class", "yourself"],
  670. referencedClasses: []
  671. }),
  672. smalltalk.AIContext);
  673. smalltalk.addMethod(
  674. smalltalk.method({
  675. selector: "outerContext",
  676. category: 'accessing',
  677. fn: function (){
  678. var self=this;
  679. return smalltalk.withContext(function($ctx1) {
  680. var $1;
  681. $1=self["@outerContext"];
  682. return $1;
  683. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.AIContext)})},
  684. args: [],
  685. source: "outerContext\x0a\x09^ outerContext",
  686. messageSends: [],
  687. referencedClasses: []
  688. }),
  689. smalltalk.AIContext);
  690. smalltalk.addMethod(
  691. smalltalk.method({
  692. selector: "outerContext:",
  693. category: 'accessing',
  694. fn: function (anAIContext){
  695. var self=this;
  696. return smalltalk.withContext(function($ctx1) {
  697. self["@outerContext"]=anAIContext;
  698. _st(self["@outerContext"])._innerContext_(self);
  699. return self}, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},smalltalk.AIContext)})},
  700. args: ["anAIContext"],
  701. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext innerContext: self",
  702. messageSends: ["innerContext:"],
  703. referencedClasses: []
  704. }),
  705. smalltalk.AIContext);
  706. smalltalk.addMethod(
  707. smalltalk.method({
  708. selector: "receiver",
  709. category: 'interpreting',
  710. fn: function (){
  711. var self=this;
  712. return smalltalk.withContext(function($ctx1) {
  713. var $1;
  714. $1=self._localAt_("self");
  715. return $1;
  716. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.AIContext)})},
  717. args: [],
  718. source: "receiver\x0a\x09^ self localAt: 'self'",
  719. messageSends: ["localAt:"],
  720. referencedClasses: []
  721. }),
  722. smalltalk.AIContext);
  723. smalltalk.addMethod(
  724. smalltalk.method({
  725. selector: "receiver:",
  726. category: 'interpreting',
  727. fn: function (anObject){
  728. var self=this;
  729. return smalltalk.withContext(function($ctx1) {
  730. self._localAt_put_("self",anObject);
  731. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.AIContext)})},
  732. args: ["anObject"],
  733. source: "receiver: anObject\x0a\x09self localAt: 'self' put: anObject",
  734. messageSends: ["localAt:put:"],
  735. referencedClasses: []
  736. }),
  737. smalltalk.AIContext);
  738. smalltalk.addMethod(
  739. smalltalk.method({
  740. selector: "selector",
  741. category: 'accessing',
  742. fn: function (){
  743. var self=this;
  744. return smalltalk.withContext(function($ctx1) {
  745. var $1;
  746. $1=self["@selector"];
  747. return $1;
  748. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.AIContext)})},
  749. args: [],
  750. source: "selector\x0a\x09^ selector",
  751. messageSends: [],
  752. referencedClasses: []
  753. }),
  754. smalltalk.AIContext);
  755. smalltalk.addMethod(
  756. smalltalk.method({
  757. selector: "selector:",
  758. category: 'accessing',
  759. fn: function (aString){
  760. var self=this;
  761. return smalltalk.withContext(function($ctx1) {
  762. self["@selector"]=aString;
  763. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.AIContext)})},
  764. args: ["aString"],
  765. source: "selector: aString\x0a\x09selector := aString",
  766. messageSends: [],
  767. referencedClasses: []
  768. }),
  769. smalltalk.AIContext);
  770. smalltalk.addMethod(
  771. smalltalk.method({
  772. selector: "sendIndexAt:",
  773. category: 'accessing',
  774. fn: function (aString){
  775. var self=this;
  776. return smalltalk.withContext(function($ctx1) {
  777. var $1;
  778. $1=_st(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  779. return smalltalk.withContext(function($ctx2) {
  780. return (0);
  781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  782. return $1;
  783. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},smalltalk.AIContext)})},
  784. args: ["aString"],
  785. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  786. messageSends: ["at:ifAbsent:", "sendIndexes"],
  787. referencedClasses: []
  788. }),
  789. smalltalk.AIContext);
  790. smalltalk.addMethod(
  791. smalltalk.method({
  792. selector: "sendIndexes",
  793. category: 'accessing',
  794. fn: function (){
  795. var self=this;
  796. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  797. return smalltalk.withContext(function($ctx1) {
  798. var $2,$1;
  799. $2=self["@sendIndexes"];
  800. if(($receiver = $2) == nil || $receiver == null){
  801. $1=_st($Dictionary())._new();
  802. } else {
  803. $1=$2;
  804. };
  805. return $1;
  806. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},smalltalk.AIContext)})},
  807. args: [],
  808. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  809. messageSends: ["ifNil:", "new"],
  810. referencedClasses: ["Dictionary"]
  811. }),
  812. smalltalk.AIContext);
  813. smalltalk.addMethod(
  814. smalltalk.method({
  815. selector: "sendIndexes:",
  816. category: 'accessing',
  817. fn: function (aDictionary){
  818. var self=this;
  819. return smalltalk.withContext(function($ctx1) {
  820. self["@sendIndexes"]=aDictionary;
  821. return self}, function($ctx1) {$ctx1.fill(self,"sendIndexes:",{aDictionary:aDictionary},smalltalk.AIContext)})},
  822. args: ["aDictionary"],
  823. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  824. messageSends: [],
  825. referencedClasses: []
  826. }),
  827. smalltalk.AIContext);
  828. smalltalk.addMethod(
  829. smalltalk.method({
  830. selector: "setupInterpreter:",
  831. category: 'interpreting',
  832. fn: function (anInterpreter){
  833. var self=this;
  834. var currentNode;
  835. function $ASTPCNodeVisitor(){return smalltalk.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  836. return smalltalk.withContext(function($ctx1) {
  837. var $1,$2,$5,$4,$3,$7,$6;
  838. $1=_st($ASTPCNodeVisitor())._new();
  839. _st($1)._selector_(self._evaluatedSelector());
  840. _st($1)._context_(self);
  841. _st($1)._visit_(self._ast());
  842. $2=_st($1)._currentNode();
  843. currentNode=$2;
  844. _st(anInterpreter)._node_(currentNode);
  845. $5=self._innerContext();
  846. $ctx1.sendIdx["innerContext"]=1;
  847. $4=_st($5)._arguments();
  848. $3=_st($4)._reversed();
  849. _st($3)._do_((function(each){
  850. return smalltalk.withContext(function($ctx2) {
  851. return _st(anInterpreter)._push_(each);
  852. $ctx2.sendIdx["push:"]=1;
  853. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  854. $7=self._innerContext();
  855. $6=_st($7)._receiver();
  856. _st(anInterpreter)._push_($6);
  857. return self}, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},smalltalk.AIContext)})},
  858. args: ["anInterpreter"],
  859. source: "setupInterpreter: anInterpreter\x0a\x09| currentNode |\x0a\x09\x0a\x09\x22Retrieve the current node\x22\x0a\x09currentNode := ASTPCNodeVisitor new\x0a\x09\x09\x09selector: self evaluatedSelector;\x0a\x09\x09\x09context: self;\x0a\x09\x09\x09visit: self ast;\x0a\x09\x09\x09currentNode.\x0a\x09\x0a\x09anInterpreter node: currentNode.\x0a\x0a\x09\x22Push the send args and receiver to the interpreter stack\x22\x09\x0a\x09self innerContext arguments reversed do: [ :each | \x0a\x09\x09anInterpreter push: each ].\x0a\x09\x09\x0a\x09anInterpreter push: (self innerContext receiver)",
  860. messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "node:", "do:", "reversed", "arguments", "innerContext", "push:", "receiver"],
  861. referencedClasses: ["ASTPCNodeVisitor"]
  862. }),
  863. smalltalk.AIContext);
  864. smalltalk.addMethod(
  865. smalltalk.method({
  866. selector: "fromMethodContext:",
  867. category: 'instance creation',
  868. fn: function (aMethodContext){
  869. var self=this;
  870. return smalltalk.withContext(function($ctx1) {
  871. var $2,$3,$1;
  872. $2=self._new();
  873. _st($2)._initializeFromMethodContext_(aMethodContext);
  874. $3=_st($2)._yourself();
  875. $1=$3;
  876. return $1;
  877. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext.klass)})},
  878. args: ["aMethodContext"],
  879. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  880. messageSends: ["initializeFromMethodContext:", "new", "yourself"],
  881. referencedClasses: []
  882. }),
  883. smalltalk.AIContext.klass);
  884. smalltalk.addClass('ASTDebugger', smalltalk.Object, ['interpreter', 'context'], 'Compiler-Interpreter');
  885. smalltalk.ASTDebugger.comment="I am a stepping debugger interface for Amber code.\x0aI internally use an instance of `ASTInterpreter` to actually step through node and interpret them.\x0a\x0aMy instances are created from an `AIContext` 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.";
  886. smalltalk.addMethod(
  887. smalltalk.method({
  888. selector: "atEnd",
  889. category: 'testing',
  890. fn: function (){
  891. var self=this;
  892. return smalltalk.withContext(function($ctx1) {
  893. var $1;
  894. $1=_st(self._interpreter())._atEnd();
  895. return $1;
  896. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTDebugger)})},
  897. args: [],
  898. source: "atEnd\x0a\x09^ self interpreter atEnd",
  899. messageSends: ["atEnd", "interpreter"],
  900. referencedClasses: []
  901. }),
  902. smalltalk.ASTDebugger);
  903. smalltalk.addMethod(
  904. smalltalk.method({
  905. selector: "buildAST",
  906. category: 'initialization',
  907. fn: function (){
  908. var self=this;
  909. var ast;
  910. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  911. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  912. return smalltalk.withContext(function($ctx1) {
  913. var $1;
  914. ast=_st(_st($Smalltalk())._current())._parse_(_st(self._method())._source());
  915. _st(_st($SemanticAnalyzer())._on_(_st(_st(self._context())._receiver())._class()))._visit_(ast);
  916. $1=ast;
  917. return $1;
  918. }, function($ctx1) {$ctx1.fill(self,"buildAST",{ast:ast},smalltalk.ASTDebugger)})},
  919. args: [],
  920. 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",
  921. messageSends: ["parse:", "current", "source", "method", "visit:", "on:", "class", "receiver", "context"],
  922. referencedClasses: ["Smalltalk", "SemanticAnalyzer"]
  923. }),
  924. smalltalk.ASTDebugger);
  925. smalltalk.addMethod(
  926. smalltalk.method({
  927. selector: "context",
  928. category: 'accessing',
  929. fn: function (){
  930. var self=this;
  931. return smalltalk.withContext(function($ctx1) {
  932. var $1;
  933. $1=self["@context"];
  934. return $1;
  935. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTDebugger)})},
  936. args: [],
  937. source: "context\x0a\x09^ context",
  938. messageSends: [],
  939. referencedClasses: []
  940. }),
  941. smalltalk.ASTDebugger);
  942. smalltalk.addMethod(
  943. smalltalk.method({
  944. selector: "context:",
  945. category: 'accessing',
  946. fn: function (aContext){
  947. var self=this;
  948. return smalltalk.withContext(function($ctx1) {
  949. self["@context"]=aContext;
  950. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTDebugger)})},
  951. args: ["aContext"],
  952. source: "context: aContext\x0a\x09context := aContext",
  953. messageSends: [],
  954. referencedClasses: []
  955. }),
  956. smalltalk.ASTDebugger);
  957. smalltalk.addMethod(
  958. smalltalk.method({
  959. selector: "defaultInterpreterClass",
  960. category: 'defaults',
  961. fn: function (){
  962. var self=this;
  963. function $ASTInterpreter(){return smalltalk.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  964. return smalltalk.withContext(function($ctx1) {
  965. return $ASTInterpreter();
  966. }, function($ctx1) {$ctx1.fill(self,"defaultInterpreterClass",{},smalltalk.ASTDebugger)})},
  967. args: [],
  968. source: "defaultInterpreterClass\x0a\x09^ ASTInterpreter",
  969. messageSends: [],
  970. referencedClasses: ["ASTInterpreter"]
  971. }),
  972. smalltalk.ASTDebugger);
  973. smalltalk.addMethod(
  974. smalltalk.method({
  975. selector: "initializeInterpreter",
  976. category: 'initialization',
  977. fn: function (){
  978. var self=this;
  979. var ast,next;
  980. function $ASTPCNodeVisitor(){return smalltalk.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  981. return smalltalk.withContext(function($ctx1) {
  982. var $1,$2;
  983. ast=self._buildAST();
  984. $1=_st($ASTPCNodeVisitor())._new();
  985. _st($1)._context_(self._context());
  986. _st($1)._visit_(ast);
  987. $2=_st($1)._currentNode();
  988. next=$2;
  989. _st(self._interpreter())._node_(next);
  990. return self}, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{ast:ast,next:next},smalltalk.ASTDebugger)})},
  991. args: [],
  992. 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 node: next",
  993. messageSends: ["buildAST", "context:", "new", "context", "visit:", "currentNode", "node:", "interpreter"],
  994. referencedClasses: ["ASTPCNodeVisitor"]
  995. }),
  996. smalltalk.ASTDebugger);
  997. smalltalk.addMethod(
  998. smalltalk.method({
  999. selector: "initializeWithContext:",
  1000. category: 'initialization',
  1001. fn: function (aContext){
  1002. var self=this;
  1003. return smalltalk.withContext(function($ctx1) {
  1004. self._context_(aContext);
  1005. self._initializeInterpreter();
  1006. return self}, function($ctx1) {$ctx1.fill(self,"initializeWithContext:",{aContext:aContext},smalltalk.ASTDebugger)})},
  1007. args: ["aContext"],
  1008. source: "initializeWithContext: aContext\x0a\x09\x22TODO: do we need to handle block contexts?\x22\x0a\x09\x0a\x09self context: aContext.\x0a\x09self initializeInterpreter",
  1009. messageSends: ["context:", "initializeInterpreter"],
  1010. referencedClasses: []
  1011. }),
  1012. smalltalk.ASTDebugger);
  1013. smalltalk.addMethod(
  1014. smalltalk.method({
  1015. selector: "interpreter",
  1016. category: 'accessing',
  1017. fn: function (){
  1018. var self=this;
  1019. return smalltalk.withContext(function($ctx1) {
  1020. var $2,$1;
  1021. $2=self["@interpreter"];
  1022. if(($receiver = $2) == nil || $receiver == null){
  1023. self["@interpreter"]=_st(self._defaultInterpreterClass())._new();
  1024. $1=self["@interpreter"];
  1025. } else {
  1026. $1=$2;
  1027. };
  1028. return $1;
  1029. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.ASTDebugger)})},
  1030. args: [],
  1031. source: "interpreter\x0a\x09^ interpreter ifNil: [ interpreter := self defaultInterpreterClass new ]",
  1032. messageSends: ["ifNil:", "new", "defaultInterpreterClass"],
  1033. referencedClasses: []
  1034. }),
  1035. smalltalk.ASTDebugger);
  1036. smalltalk.addMethod(
  1037. smalltalk.method({
  1038. selector: "interpreter:",
  1039. category: 'accessing',
  1040. fn: function (anInterpreter){
  1041. var self=this;
  1042. return smalltalk.withContext(function($ctx1) {
  1043. self["@interpreter"]=anInterpreter;
  1044. return self}, function($ctx1) {$ctx1.fill(self,"interpreter:",{anInterpreter:anInterpreter},smalltalk.ASTDebugger)})},
  1045. args: ["anInterpreter"],
  1046. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  1047. messageSends: [],
  1048. referencedClasses: []
  1049. }),
  1050. smalltalk.ASTDebugger);
  1051. smalltalk.addMethod(
  1052. smalltalk.method({
  1053. selector: "method",
  1054. category: 'accessing',
  1055. fn: function (){
  1056. var self=this;
  1057. return smalltalk.withContext(function($ctx1) {
  1058. var $1;
  1059. $1=_st(self._context())._method();
  1060. return $1;
  1061. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.ASTDebugger)})},
  1062. args: [],
  1063. source: "method\x0a\x09^ self context method",
  1064. messageSends: ["method", "context"],
  1065. referencedClasses: []
  1066. }),
  1067. smalltalk.ASTDebugger);
  1068. smalltalk.addMethod(
  1069. smalltalk.method({
  1070. selector: "nextNode",
  1071. category: 'accessing',
  1072. fn: function (){
  1073. var self=this;
  1074. return smalltalk.withContext(function($ctx1) {
  1075. var $1;
  1076. $1=_st(self._interpreter())._nextNode();
  1077. return $1;
  1078. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.ASTDebugger)})},
  1079. args: [],
  1080. source: "nextNode\x0a\x09^ self interpreter nextNode",
  1081. messageSends: ["nextNode", "interpreter"],
  1082. referencedClasses: []
  1083. }),
  1084. smalltalk.ASTDebugger);
  1085. smalltalk.addMethod(
  1086. smalltalk.method({
  1087. selector: "proceed",
  1088. category: 'stepping',
  1089. fn: function (){
  1090. var self=this;
  1091. return smalltalk.withContext(function($ctx1) {
  1092. self._shouldBeImplemented();
  1093. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.ASTDebugger)})},
  1094. args: [],
  1095. source: "proceed\x0a\x09self shouldBeImplemented",
  1096. messageSends: ["shouldBeImplemented"],
  1097. referencedClasses: []
  1098. }),
  1099. smalltalk.ASTDebugger);
  1100. smalltalk.addMethod(
  1101. smalltalk.method({
  1102. selector: "restart",
  1103. category: 'stepping',
  1104. fn: function (){
  1105. var self=this;
  1106. return smalltalk.withContext(function($ctx1) {
  1107. _st(self._interpreter())._restart();
  1108. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},smalltalk.ASTDebugger)})},
  1109. args: [],
  1110. source: "restart\x0a\x09self interpreter restart",
  1111. messageSends: ["restart", "interpreter"],
  1112. referencedClasses: []
  1113. }),
  1114. smalltalk.ASTDebugger);
  1115. smalltalk.addMethod(
  1116. smalltalk.method({
  1117. selector: "skip",
  1118. category: 'stepping',
  1119. fn: function (){
  1120. var self=this;
  1121. return smalltalk.withContext(function($ctx1) {
  1122. _st(self._interpreter())._skip();
  1123. return self}, function($ctx1) {$ctx1.fill(self,"skip",{},smalltalk.ASTDebugger)})},
  1124. args: [],
  1125. source: "skip\x0a\x09self interpreter skip",
  1126. messageSends: ["skip", "interpreter"],
  1127. referencedClasses: []
  1128. }),
  1129. smalltalk.ASTDebugger);
  1130. smalltalk.addMethod(
  1131. smalltalk.method({
  1132. selector: "stepInto",
  1133. category: 'stepping',
  1134. fn: function (){
  1135. var self=this;
  1136. return smalltalk.withContext(function($ctx1) {
  1137. self._shouldBeImplemented();
  1138. return self}, function($ctx1) {$ctx1.fill(self,"stepInto",{},smalltalk.ASTDebugger)})},
  1139. args: [],
  1140. source: "stepInto\x0a\x09self shouldBeImplemented",
  1141. messageSends: ["shouldBeImplemented"],
  1142. referencedClasses: []
  1143. }),
  1144. smalltalk.ASTDebugger);
  1145. smalltalk.addMethod(
  1146. smalltalk.method({
  1147. selector: "stepOver",
  1148. category: 'stepping',
  1149. fn: function (){
  1150. var self=this;
  1151. return smalltalk.withContext(function($ctx1) {
  1152. _st(self._interpreter())._stepOver();
  1153. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},smalltalk.ASTDebugger)})},
  1154. args: [],
  1155. source: "stepOver\x0a\x09self interpreter stepOver",
  1156. messageSends: ["stepOver", "interpreter"],
  1157. referencedClasses: []
  1158. }),
  1159. smalltalk.ASTDebugger);
  1160. smalltalk.addMethod(
  1161. smalltalk.method({
  1162. selector: "context:",
  1163. category: 'instance creation',
  1164. fn: function (aContext){
  1165. var self=this;
  1166. return smalltalk.withContext(function($ctx1) {
  1167. var $2,$3,$1;
  1168. $2=self._new();
  1169. _st($2)._initializeWithContext_(aContext);
  1170. $3=_st($2)._yourself();
  1171. $1=$3;
  1172. return $1;
  1173. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTDebugger.klass)})},
  1174. args: ["aContext"],
  1175. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext;\x0a\x09\x09yourself",
  1176. messageSends: ["initializeWithContext:", "new", "yourself"],
  1177. referencedClasses: []
  1178. }),
  1179. smalltalk.ASTDebugger.klass);
  1180. smalltalk.addClass('ASTInterpreter', smalltalk.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned'], 'Compiler-Interpreter');
  1181. smalltalk.ASTInterpreter.comment="I visit an AST, interpreting (evaluating) nodes one after the other, using a small stack machine.\x0a\x0a## API\x0a\x0aWhile my instances should be used from within an `ASTDebugger`, which provides a more high level interface,\x0ayou can use methods from the `interpreting` protocol:\x0a\x0a- `#step` evaluates the current `node` only\x0a- `#stepOver` evaluates the AST from the current `node` up to the next stepping node (most likely the next send node)\x0a- `#proceed` evaluates eagerly the AST\x0a- `#restart` select the first node of the AST\x0a- `#skip` skips the current node, moving to the next one if any";
  1182. smalltalk.addMethod(
  1183. smalltalk.method({
  1184. selector: "assign:to:",
  1185. category: 'private',
  1186. fn: function (aNode,anObject){
  1187. var self=this;
  1188. return smalltalk.withContext(function($ctx1) {
  1189. var $1,$3,$2,$4,$5,$6;
  1190. $1=_st(_st(aNode)._binding())._isInstanceVar();
  1191. if(smalltalk.assert($1)){
  1192. $3=self._context();
  1193. $ctx1.sendIdx["context"]=1;
  1194. $2=_st($3)._receiver();
  1195. $4=_st(aNode)._value();
  1196. $ctx1.sendIdx["value"]=1;
  1197. _st($2)._instVarAt_put_($4,anObject);
  1198. } else {
  1199. $5=self._context();
  1200. $6=_st(aNode)._value();
  1201. _st($5)._localAt_put_($6,anObject);
  1202. };
  1203. return self}, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},smalltalk.ASTInterpreter)})},
  1204. args: ["aNode", "anObject"],
  1205. source: "assign: aNode to: anObject\x0a\x09aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]\x0a\x09\x09ifFalse: [ self context localAt: aNode value put: anObject ]",
  1206. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"],
  1207. referencedClasses: []
  1208. }),
  1209. smalltalk.ASTInterpreter);
  1210. smalltalk.addMethod(
  1211. smalltalk.method({
  1212. selector: "atEnd",
  1213. category: 'testing',
  1214. fn: function (){
  1215. var self=this;
  1216. return smalltalk.withContext(function($ctx1) {
  1217. var $1;
  1218. $1=_st(self._hasReturned())._or_((function(){
  1219. return smalltalk.withContext(function($ctx2) {
  1220. return _st(self._node())._isNil();
  1221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1222. return $1;
  1223. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTInterpreter)})},
  1224. args: [],
  1225. source: "atEnd\x0a\x09^ self hasReturned or: [ self node isNil ]",
  1226. messageSends: ["or:", "hasReturned", "isNil", "node"],
  1227. referencedClasses: []
  1228. }),
  1229. smalltalk.ASTInterpreter);
  1230. smalltalk.addMethod(
  1231. smalltalk.method({
  1232. selector: "context",
  1233. category: 'accessing',
  1234. fn: function (){
  1235. var self=this;
  1236. return smalltalk.withContext(function($ctx1) {
  1237. var $1;
  1238. $1=self["@context"];
  1239. return $1;
  1240. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTInterpreter)})},
  1241. args: [],
  1242. source: "context\x0a\x09^ context",
  1243. messageSends: [],
  1244. referencedClasses: []
  1245. }),
  1246. smalltalk.ASTInterpreter);
  1247. smalltalk.addMethod(
  1248. smalltalk.method({
  1249. selector: "context:",
  1250. category: 'accessing',
  1251. fn: function (aContext){
  1252. var self=this;
  1253. return smalltalk.withContext(function($ctx1) {
  1254. self["@context"]=aContext;
  1255. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTInterpreter)})},
  1256. args: ["aContext"],
  1257. source: "context: aContext\x0a\x09context := aContext",
  1258. messageSends: [],
  1259. referencedClasses: []
  1260. }),
  1261. smalltalk.ASTInterpreter);
  1262. smalltalk.addMethod(
  1263. smalltalk.method({
  1264. selector: "eval:",
  1265. category: 'private',
  1266. fn: function (aString){
  1267. var self=this;
  1268. var source,function_;
  1269. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1270. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  1271. return smalltalk.withContext(function($ctx1) {
  1272. var $3,$2,$1,$4,$6,$9,$8,$7,$5;
  1273. source=_st($String())._streamContents_((function(str){
  1274. return smalltalk.withContext(function($ctx2) {
  1275. _st(str)._nextPutAll_("(function(");
  1276. $ctx2.sendIdx["nextPutAll:"]=1;
  1277. $3=self._context();
  1278. $ctx2.sendIdx["context"]=1;
  1279. $2=_st($3)._locals();
  1280. $ctx2.sendIdx["locals"]=1;
  1281. $1=_st($2)._keys();
  1282. _st($1)._do_separatedBy_((function(each){
  1283. return smalltalk.withContext(function($ctx3) {
  1284. return _st(str)._nextPutAll_(each);
  1285. $ctx3.sendIdx["nextPutAll:"]=2;
  1286. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  1287. return smalltalk.withContext(function($ctx3) {
  1288. return _st(str)._nextPutAll_(",");
  1289. $ctx3.sendIdx["nextPutAll:"]=3;
  1290. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  1291. _st(str)._nextPutAll_("){ return (function() {");
  1292. $ctx2.sendIdx["nextPutAll:"]=4;
  1293. _st(str)._nextPutAll_(aString);
  1294. $ctx2.sendIdx["nextPutAll:"]=5;
  1295. $4=_st(str)._nextPutAll_("})() })");
  1296. return $4;
  1297. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  1298. function_=_st(_st($Compiler())._new())._eval_(source);
  1299. $6=function_;
  1300. $9=self._context();
  1301. $8=_st($9)._locals();
  1302. $7=_st($8)._values();
  1303. $5=_st($6)._valueWithPossibleArguments_($7);
  1304. return $5;
  1305. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},smalltalk.ASTInterpreter)})},
  1306. args: ["aString"],
  1307. 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",
  1308. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"],
  1309. referencedClasses: ["String", "Compiler"]
  1310. }),
  1311. smalltalk.ASTInterpreter);
  1312. smalltalk.addMethod(
  1313. smalltalk.method({
  1314. selector: "hasReturned",
  1315. category: 'testing',
  1316. fn: function (){
  1317. var self=this;
  1318. return smalltalk.withContext(function($ctx1) {
  1319. var $2,$1;
  1320. $2=self["@returned"];
  1321. if(($receiver = $2) == nil || $receiver == null){
  1322. $1=false;
  1323. } else {
  1324. $1=$2;
  1325. };
  1326. return $1;
  1327. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},smalltalk.ASTInterpreter)})},
  1328. args: [],
  1329. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  1330. messageSends: ["ifNil:"],
  1331. referencedClasses: []
  1332. }),
  1333. smalltalk.ASTInterpreter);
  1334. smalltalk.addMethod(
  1335. smalltalk.method({
  1336. selector: "interpret",
  1337. category: 'interpreting',
  1338. fn: function (){
  1339. var self=this;
  1340. return smalltalk.withContext(function($ctx1) {
  1341. self._visit_(self._node());
  1342. return self}, function($ctx1) {$ctx1.fill(self,"interpret",{},smalltalk.ASTInterpreter)})},
  1343. args: [],
  1344. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  1345. messageSends: ["visit:", "node"],
  1346. referencedClasses: []
  1347. }),
  1348. smalltalk.ASTInterpreter);
  1349. smalltalk.addMethod(
  1350. smalltalk.method({
  1351. selector: "interpret:",
  1352. category: 'interpreting',
  1353. fn: function (aNode){
  1354. var self=this;
  1355. return smalltalk.withContext(function($ctx1) {
  1356. self._node_(aNode);
  1357. self._interpret();
  1358. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1359. args: ["aNode"],
  1360. source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret",
  1361. messageSends: ["node:", "interpret"],
  1362. referencedClasses: []
  1363. }),
  1364. smalltalk.ASTInterpreter);
  1365. smalltalk.addMethod(
  1366. smalltalk.method({
  1367. selector: "messageFromSendNode:arguments:",
  1368. category: 'private',
  1369. fn: function (aSendNode,aCollection){
  1370. var self=this;
  1371. function $Message(){return smalltalk.Message||(typeof Message=="undefined"?nil:Message)}
  1372. return smalltalk.withContext(function($ctx1) {
  1373. var $2,$3,$1;
  1374. $2=_st($Message())._new();
  1375. _st($2)._selector_(_st(aSendNode)._selector());
  1376. _st($2)._arguments_(aCollection);
  1377. $3=_st($2)._yourself();
  1378. $1=$3;
  1379. return $1;
  1380. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},smalltalk.ASTInterpreter)})},
  1381. args: ["aSendNode", "aCollection"],
  1382. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  1383. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"],
  1384. referencedClasses: ["Message"]
  1385. }),
  1386. smalltalk.ASTInterpreter);
  1387. smalltalk.addMethod(
  1388. smalltalk.method({
  1389. selector: "messageNotUnderstood:receiver:",
  1390. category: 'private',
  1391. fn: function (aMessage,anObject){
  1392. var self=this;
  1393. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1394. return smalltalk.withContext(function($ctx1) {
  1395. var $1,$2;
  1396. $1=_st($MessageNotUnderstood())._new();
  1397. _st($1)._meesage_(aMessage);
  1398. _st($1)._receiver_(anObject);
  1399. $2=_st($1)._signal();
  1400. return self}, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},smalltalk.ASTInterpreter)})},
  1401. args: ["aMessage", "anObject"],
  1402. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  1403. messageSends: ["meesage:", "new", "receiver:", "signal"],
  1404. referencedClasses: ["MessageNotUnderstood"]
  1405. }),
  1406. smalltalk.ASTInterpreter);
  1407. smalltalk.addMethod(
  1408. smalltalk.method({
  1409. selector: "next",
  1410. category: 'interpreting',
  1411. fn: function (){
  1412. var self=this;
  1413. return smalltalk.withContext(function($ctx1) {
  1414. self._node_(_st(self._node())._nextNode());
  1415. return self}, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.ASTInterpreter)})},
  1416. args: [],
  1417. source: "next\x0a\x09self node: self node nextNode",
  1418. messageSends: ["node:", "nextNode", "node"],
  1419. referencedClasses: []
  1420. }),
  1421. smalltalk.ASTInterpreter);
  1422. smalltalk.addMethod(
  1423. smalltalk.method({
  1424. selector: "node",
  1425. category: 'accessing',
  1426. fn: function (){
  1427. var self=this;
  1428. return smalltalk.withContext(function($ctx1) {
  1429. var $1;
  1430. $1=self["@node"];
  1431. return $1;
  1432. }, function($ctx1) {$ctx1.fill(self,"node",{},smalltalk.ASTInterpreter)})},
  1433. args: [],
  1434. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  1435. messageSends: [],
  1436. referencedClasses: []
  1437. }),
  1438. smalltalk.ASTInterpreter);
  1439. smalltalk.addMethod(
  1440. smalltalk.method({
  1441. selector: "node:",
  1442. category: 'accessing',
  1443. fn: function (aNode){
  1444. var self=this;
  1445. return smalltalk.withContext(function($ctx1) {
  1446. self["@node"]=aNode;
  1447. return self}, function($ctx1) {$ctx1.fill(self,"node:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1448. args: ["aNode"],
  1449. source: "node: aNode\x0a\x09node := aNode",
  1450. messageSends: [],
  1451. referencedClasses: []
  1452. }),
  1453. smalltalk.ASTInterpreter);
  1454. smalltalk.addMethod(
  1455. smalltalk.method({
  1456. selector: "peek",
  1457. category: 'stack',
  1458. fn: function (){
  1459. var self=this;
  1460. return smalltalk.withContext(function($ctx1) {
  1461. var $1,$3,$2;
  1462. var $early={};
  1463. try {
  1464. $1=self._stack();
  1465. $ctx1.sendIdx["stack"]=1;
  1466. _st($1)._ifEmpty_((function(){
  1467. return smalltalk.withContext(function($ctx2) {
  1468. throw $early=[nil];
  1469. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1470. $3=self._stack();
  1471. $2=_st($3)._last();
  1472. return $2;
  1473. }
  1474. catch(e) {if(e===$early)return e[0]; throw e}
  1475. }, function($ctx1) {$ctx1.fill(self,"peek",{},smalltalk.ASTInterpreter)})},
  1476. args: [],
  1477. source: "peek\x0a\x09\x22Peek the top object of the context stack\x22\x0a\x09\x0a\x09self stack ifEmpty: [ ^ nil ].\x0a\x09\x0a\x09^ self stack last",
  1478. messageSends: ["ifEmpty:", "stack", "last"],
  1479. referencedClasses: []
  1480. }),
  1481. smalltalk.ASTInterpreter);
  1482. smalltalk.addMethod(
  1483. smalltalk.method({
  1484. selector: "pop",
  1485. category: 'stack',
  1486. fn: function (){
  1487. var self=this;
  1488. var peekedValue;
  1489. return smalltalk.withContext(function($ctx1) {
  1490. var $1;
  1491. peekedValue=self._peek();
  1492. _st(self._stack())._removeLast();
  1493. $1=peekedValue;
  1494. return $1;
  1495. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},smalltalk.ASTInterpreter)})},
  1496. args: [],
  1497. source: "pop\x0a\x09\x22Pop an object from the context stack\x22\x0a\x09\x0a\x09| peekedValue |\x0a\x09\x0a\x09peekedValue := self peek.\x0a\x09self stack removeLast.\x0a\x09^ peekedValue",
  1498. messageSends: ["peek", "removeLast", "stack"],
  1499. referencedClasses: []
  1500. }),
  1501. smalltalk.ASTInterpreter);
  1502. smalltalk.addMethod(
  1503. smalltalk.method({
  1504. selector: "proceed",
  1505. category: 'interpreting',
  1506. fn: function (){
  1507. var self=this;
  1508. return smalltalk.withContext(function($ctx1) {
  1509. var $1,$2,$3;
  1510. _st((function(){
  1511. return smalltalk.withContext(function($ctx2) {
  1512. return self._atEnd();
  1513. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  1514. return smalltalk.withContext(function($ctx2) {
  1515. return self._step();
  1516. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1517. $1=_st(self._context())._outerContext();
  1518. if(($receiver = $1) == nil || $receiver == null){
  1519. $1;
  1520. } else {
  1521. var outer;
  1522. outer=$receiver;
  1523. $2=_st(outer)._interpreter();
  1524. _st($2)._skip();
  1525. $3=_st($2)._proceed();
  1526. $3;
  1527. };
  1528. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.ASTInterpreter)})},
  1529. args: [],
  1530. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ].\x0a\x09\x09\x0a\x09self context outerContext ifNotNil: [ :outer |\x0a\x09\x09outer interpreter \x0a\x09\x09\x09skip; \x22current send node already evaluated by the receiver\x22 \x0a\x09\x09\x09proceed ]",
  1531. messageSends: ["whileFalse:", "atEnd", "step", "ifNotNil:", "outerContext", "context", "skip", "interpreter", "proceed"],
  1532. referencedClasses: []
  1533. }),
  1534. smalltalk.ASTInterpreter);
  1535. smalltalk.addMethod(
  1536. smalltalk.method({
  1537. selector: "push:",
  1538. category: 'stack',
  1539. fn: function (anObject){
  1540. var self=this;
  1541. return smalltalk.withContext(function($ctx1) {
  1542. var $1;
  1543. $1=_st(self._stack())._add_(anObject);
  1544. return $1;
  1545. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},smalltalk.ASTInterpreter)})},
  1546. args: ["anObject"],
  1547. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  1548. messageSends: ["add:", "stack"],
  1549. referencedClasses: []
  1550. }),
  1551. smalltalk.ASTInterpreter);
  1552. smalltalk.addMethod(
  1553. smalltalk.method({
  1554. selector: "restart",
  1555. category: 'interpreting',
  1556. fn: function (){
  1557. var self=this;
  1558. return smalltalk.withContext(function($ctx1) {
  1559. self._node_(_st(_st(self._context())._ast())._nextChild());
  1560. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},smalltalk.ASTInterpreter)})},
  1561. args: [],
  1562. source: "restart\x0a\x09self node: self context ast nextChild",
  1563. messageSends: ["node:", "nextChild", "ast", "context"],
  1564. referencedClasses: []
  1565. }),
  1566. smalltalk.ASTInterpreter);
  1567. smalltalk.addMethod(
  1568. smalltalk.method({
  1569. selector: "result",
  1570. category: 'accessing',
  1571. fn: function (){
  1572. var self=this;
  1573. return smalltalk.withContext(function($ctx1) {
  1574. var $2,$1;
  1575. $2=self._hasReturned();
  1576. if(smalltalk.assert($2)){
  1577. $1=self._returnValue();
  1578. } else {
  1579. $1=_st(self._context())._receiver();
  1580. };
  1581. return $1;
  1582. }, function($ctx1) {$ctx1.fill(self,"result",{},smalltalk.ASTInterpreter)})},
  1583. args: [],
  1584. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  1585. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"],
  1586. referencedClasses: []
  1587. }),
  1588. smalltalk.ASTInterpreter);
  1589. smalltalk.addMethod(
  1590. smalltalk.method({
  1591. selector: "returnValue",
  1592. category: 'accessing',
  1593. fn: function (){
  1594. var self=this;
  1595. return smalltalk.withContext(function($ctx1) {
  1596. var $1;
  1597. $1=self["@returnValue"];
  1598. return $1;
  1599. }, function($ctx1) {$ctx1.fill(self,"returnValue",{},smalltalk.ASTInterpreter)})},
  1600. args: [],
  1601. source: "returnValue\x0a\x09^ returnValue",
  1602. messageSends: [],
  1603. referencedClasses: []
  1604. }),
  1605. smalltalk.ASTInterpreter);
  1606. smalltalk.addMethod(
  1607. smalltalk.method({
  1608. selector: "returnValue:",
  1609. category: 'accessing',
  1610. fn: function (anObject){
  1611. var self=this;
  1612. return smalltalk.withContext(function($ctx1) {
  1613. self["@returnValue"]=anObject;
  1614. return self}, function($ctx1) {$ctx1.fill(self,"returnValue:",{anObject:anObject},smalltalk.ASTInterpreter)})},
  1615. args: ["anObject"],
  1616. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  1617. messageSends: [],
  1618. referencedClasses: []
  1619. }),
  1620. smalltalk.ASTInterpreter);
  1621. smalltalk.addMethod(
  1622. smalltalk.method({
  1623. selector: "sendMessage:to:superSend:",
  1624. category: 'private',
  1625. fn: function (aMessage,anObject,aBoolean){
  1626. var self=this;
  1627. var method;
  1628. return smalltalk.withContext(function($ctx1) {
  1629. var $1,$3,$2,$4,$7,$6,$5,$8,$9;
  1630. var $early={};
  1631. try {
  1632. if(! smalltalk.assert(aBoolean)){
  1633. $1=_st(aMessage)._sendTo_(anObject);
  1634. return $1;
  1635. };
  1636. $3=_st(anObject)._class();
  1637. $ctx1.sendIdx["class"]=1;
  1638. $2=_st($3)._superclass();
  1639. $ctx1.sendIdx["superclass"]=1;
  1640. if(($receiver = $2) == nil || $receiver == null){
  1641. $4=self._messageNotUnderstood_receiver_(aMessage,anObject);
  1642. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  1643. return $4;
  1644. } else {
  1645. $2;
  1646. };
  1647. $7=_st(anObject)._class();
  1648. $6=_st($7)._superclass();
  1649. $5=_st($6)._methodDictionary();
  1650. method=_st($5)._at_ifAbsent_(_st(aMessage)._selector(),(function(){
  1651. return smalltalk.withContext(function($ctx2) {
  1652. $8=self._messageNotUnderstood_receiver_(aMessage,anObject);
  1653. throw $early=[$8];
  1654. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1655. $9=_st(method)._sendTo_arguments_(anObject,_st(aMessage)._arguments());
  1656. return $9;
  1657. }
  1658. catch(e) {if(e===$early)return e[0]; throw e}
  1659. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},smalltalk.ASTInterpreter)})},
  1660. args: ["aMessage", "anObject", "aBoolean"],
  1661. 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 sendTo: anObject arguments: aMessage arguments",
  1662. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"],
  1663. referencedClasses: []
  1664. }),
  1665. smalltalk.ASTInterpreter);
  1666. smalltalk.addMethod(
  1667. smalltalk.method({
  1668. selector: "setNonLocalReturnFromContext:",
  1669. category: 'interpreting',
  1670. fn: function (aContext){
  1671. var self=this;
  1672. return smalltalk.withContext(function($ctx1) {
  1673. var $2,$1,$4,$3;
  1674. $2=_st(aContext)._interpreter();
  1675. $ctx1.sendIdx["interpreter"]=1;
  1676. $1=_st($2)._hasReturned();
  1677. if(smalltalk.assert($1)){
  1678. self["@returned"]=true;
  1679. self["@returned"];
  1680. $4=_st(aContext)._interpreter();
  1681. $3=_st($4)._returnValue();
  1682. self._returnValue_($3);
  1683. };
  1684. return self}, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},smalltalk.ASTInterpreter)})},
  1685. args: ["aContext"],
  1686. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  1687. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"],
  1688. referencedClasses: []
  1689. }),
  1690. smalltalk.ASTInterpreter);
  1691. smalltalk.addMethod(
  1692. smalltalk.method({
  1693. selector: "skip",
  1694. category: 'interpreting',
  1695. fn: function (){
  1696. var self=this;
  1697. return smalltalk.withContext(function($ctx1) {
  1698. self._next();
  1699. return self}, function($ctx1) {$ctx1.fill(self,"skip",{},smalltalk.ASTInterpreter)})},
  1700. args: [],
  1701. source: "skip\x0a\x09self next",
  1702. messageSends: ["next"],
  1703. referencedClasses: []
  1704. }),
  1705. smalltalk.ASTInterpreter);
  1706. smalltalk.addMethod(
  1707. smalltalk.method({
  1708. selector: "stack",
  1709. category: 'accessing',
  1710. fn: function (){
  1711. var self=this;
  1712. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1713. return smalltalk.withContext(function($ctx1) {
  1714. var $2,$1;
  1715. $2=self["@stack"];
  1716. if(($receiver = $2) == nil || $receiver == null){
  1717. self["@stack"]=_st($OrderedCollection())._new();
  1718. $1=self["@stack"];
  1719. } else {
  1720. $1=$2;
  1721. };
  1722. return $1;
  1723. }, function($ctx1) {$ctx1.fill(self,"stack",{},smalltalk.ASTInterpreter)})},
  1724. args: [],
  1725. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  1726. messageSends: ["ifNil:", "new"],
  1727. referencedClasses: ["OrderedCollection"]
  1728. }),
  1729. smalltalk.ASTInterpreter);
  1730. smalltalk.addMethod(
  1731. smalltalk.method({
  1732. selector: "step",
  1733. category: 'interpreting',
  1734. fn: function (){
  1735. var self=this;
  1736. return smalltalk.withContext(function($ctx1) {
  1737. var $1;
  1738. self._interpret();
  1739. $1=self._next();
  1740. return self}, function($ctx1) {$ctx1.fill(self,"step",{},smalltalk.ASTInterpreter)})},
  1741. args: [],
  1742. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  1743. messageSends: ["interpret", "next"],
  1744. referencedClasses: []
  1745. }),
  1746. smalltalk.ASTInterpreter);
  1747. smalltalk.addMethod(
  1748. smalltalk.method({
  1749. selector: "stepOver",
  1750. category: 'interpreting',
  1751. fn: function (){
  1752. var self=this;
  1753. return smalltalk.withContext(function($ctx1) {
  1754. self._step();
  1755. $ctx1.sendIdx["step"]=1;
  1756. _st((function(){
  1757. return smalltalk.withContext(function($ctx2) {
  1758. return _st(self._node())._isSteppingNode();
  1759. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  1760. return smalltalk.withContext(function($ctx2) {
  1761. return self._step();
  1762. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1763. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},smalltalk.ASTInterpreter)})},
  1764. args: [],
  1765. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isSteppingNode ] whileFalse: [ \x0a\x09\x09self step ]",
  1766. messageSends: ["step", "whileFalse:", "isSteppingNode", "node"],
  1767. referencedClasses: []
  1768. }),
  1769. smalltalk.ASTInterpreter);
  1770. smalltalk.addMethod(
  1771. smalltalk.method({
  1772. selector: "visit:",
  1773. category: 'visiting',
  1774. fn: function (aNode){
  1775. var self=this;
  1776. return smalltalk.withContext(function($ctx1) {
  1777. var $1;
  1778. $1=self._hasReturned();
  1779. if(! smalltalk.assert($1)){
  1780. smalltalk.ASTInterpreter.superclass.fn.prototype._visit_.apply(_st(self), [aNode]);
  1781. };
  1782. return self}, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1783. args: ["aNode"],
  1784. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  1785. messageSends: ["ifFalse:", "hasReturned", "visit:"],
  1786. referencedClasses: []
  1787. }),
  1788. smalltalk.ASTInterpreter);
  1789. smalltalk.addMethod(
  1790. smalltalk.method({
  1791. selector: "visitAssignmentNode:",
  1792. category: 'visiting',
  1793. fn: function (aNode){
  1794. var self=this;
  1795. var poppedValue;
  1796. return smalltalk.withContext(function($ctx1) {
  1797. poppedValue=self._pop();
  1798. $ctx1.sendIdx["pop"]=1;
  1799. self._pop();
  1800. self._push_(poppedValue);
  1801. self._assign_to_(_st(aNode)._left(),poppedValue);
  1802. return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},smalltalk.ASTInterpreter)})},
  1803. args: ["aNode"],
  1804. source: "visitAssignmentNode: aNode\x0a\x09| poppedValue |\x0a\x09\x0a\x09poppedValue := self pop.\x0a\x09\x0a\x09\x22Pop the left side of the assignment.\x0a\x09It already has been visited, and we don't need its value.\x22\x0a\x09self pop.\x0a\x09\x0a\x09self push: poppedValue.\x0a\x09self assign: aNode left to: poppedValue",
  1805. messageSends: ["pop", "push:", "assign:to:", "left"],
  1806. referencedClasses: []
  1807. }),
  1808. smalltalk.ASTInterpreter);
  1809. smalltalk.addMethod(
  1810. smalltalk.method({
  1811. selector: "visitBlockNode:",
  1812. category: 'visiting',
  1813. fn: function (aNode){
  1814. var self=this;
  1815. var block;
  1816. function $AIBlockClosure(){return smalltalk.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)}
  1817. return smalltalk.withContext(function($ctx1) {
  1818. block=_st($AIBlockClosure())._forContext_node_(self._context(),aNode);
  1819. self._push_(block);
  1820. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},smalltalk.ASTInterpreter)})},
  1821. args: ["aNode"],
  1822. source: "visitBlockNode: aNode\x0a\x09\x22Do not evaluate the block node.\x0a\x09Instead, put all instructions into a block that we push to the stack for later evaluation\x22\x0a\x09\x0a\x09| block |\x0a\x09\x0a\x09block := AIBlockClosure forContext: self context node: aNode.\x0a\x09\x0a\x09self push: block",
  1823. messageSends: ["forContext:node:", "context", "push:"],
  1824. referencedClasses: ["AIBlockClosure"]
  1825. }),
  1826. smalltalk.ASTInterpreter);
  1827. smalltalk.addMethod(
  1828. smalltalk.method({
  1829. selector: "visitDynamicArrayNode:",
  1830. category: 'visiting',
  1831. fn: function (aNode){
  1832. var self=this;
  1833. var array;
  1834. return smalltalk.withContext(function($ctx1) {
  1835. array=[];
  1836. _st(_st(aNode)._nodes())._do_((function(each){
  1837. return smalltalk.withContext(function($ctx2) {
  1838. return _st(array)._addFirst_(self._pop());
  1839. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1840. self._push_(array);
  1841. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},smalltalk.ASTInterpreter)})},
  1842. args: ["aNode"],
  1843. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09\x0a\x09array := #().\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09array addFirst: self pop ].\x0a\x09\x0a\x09self push: array",
  1844. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"],
  1845. referencedClasses: []
  1846. }),
  1847. smalltalk.ASTInterpreter);
  1848. smalltalk.addMethod(
  1849. smalltalk.method({
  1850. selector: "visitDynamicDictionaryNode:",
  1851. category: 'visiting',
  1852. fn: function (aNode){
  1853. var self=this;
  1854. var associations,hashedCollection;
  1855. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1856. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1857. return smalltalk.withContext(function($ctx1) {
  1858. associations=_st($OrderedCollection())._new();
  1859. $ctx1.sendIdx["new"]=1;
  1860. hashedCollection=_st($HashedCollection())._new();
  1861. _st(_st(aNode)._nodes())._do_((function(each){
  1862. return smalltalk.withContext(function($ctx2) {
  1863. return _st(associations)._add_(self._pop());
  1864. $ctx2.sendIdx["add:"]=1;
  1865. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1866. $ctx1.sendIdx["do:"]=1;
  1867. _st(_st(associations)._reversed())._do_((function(each){
  1868. return smalltalk.withContext(function($ctx2) {
  1869. return _st(hashedCollection)._add_(each);
  1870. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1871. self._push_(hashedCollection);
  1872. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,associations:associations,hashedCollection:hashedCollection},smalltalk.ASTInterpreter)})},
  1873. args: ["aNode"],
  1874. source: "visitDynamicDictionaryNode: aNode\x0a\x09| associations hashedCollection |\x0a\x09\x0a\x09associations := OrderedCollection new.\x0a\x09hashedCollection := HashedCollection new.\x0a\x09\x0a\x09aNode nodes do: [ :each | \x0a\x09\x09associations add: self pop ].\x0a\x09\x0a\x09associations reversed do: [ :each |\x0a\x09\x09hashedCollection add: each ].\x0a\x09\x0a\x09self push: hashedCollection",
  1875. messageSends: ["new", "do:", "nodes", "add:", "pop", "reversed", "push:"],
  1876. referencedClasses: ["OrderedCollection", "HashedCollection"]
  1877. }),
  1878. smalltalk.ASTInterpreter);
  1879. smalltalk.addMethod(
  1880. smalltalk.method({
  1881. selector: "visitJSStatementNode:",
  1882. category: 'visiting',
  1883. fn: function (aNode){
  1884. var self=this;
  1885. return smalltalk.withContext(function($ctx1) {
  1886. self["@returned"]=true;
  1887. self._returnValue_(self._eval_(_st(aNode)._source()));
  1888. return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1889. args: ["aNode"],
  1890. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  1891. messageSends: ["returnValue:", "eval:", "source"],
  1892. referencedClasses: []
  1893. }),
  1894. smalltalk.ASTInterpreter);
  1895. smalltalk.addMethod(
  1896. smalltalk.method({
  1897. selector: "visitNode:",
  1898. category: 'visiting',
  1899. fn: function (aNode){
  1900. var self=this;
  1901. return smalltalk.withContext(function($ctx1) {
  1902. return self}, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1903. args: ["aNode"],
  1904. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  1905. messageSends: [],
  1906. referencedClasses: []
  1907. }),
  1908. smalltalk.ASTInterpreter);
  1909. smalltalk.addMethod(
  1910. smalltalk.method({
  1911. selector: "visitReturnNode:",
  1912. category: 'visiting',
  1913. fn: function (aNode){
  1914. var self=this;
  1915. return smalltalk.withContext(function($ctx1) {
  1916. self["@returned"]=true;
  1917. self._returnValue_(self._pop());
  1918. return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1919. args: ["aNode"],
  1920. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  1921. messageSends: ["returnValue:", "pop"],
  1922. referencedClasses: []
  1923. }),
  1924. smalltalk.ASTInterpreter);
  1925. smalltalk.addMethod(
  1926. smalltalk.method({
  1927. selector: "visitSendNode:",
  1928. category: 'visiting',
  1929. fn: function (aNode){
  1930. var self=this;
  1931. var receiver,args,message,result;
  1932. return smalltalk.withContext(function($ctx1) {
  1933. var $1;
  1934. args=_st(_st(aNode)._arguments())._collect_((function(each){
  1935. return smalltalk.withContext(function($ctx2) {
  1936. return self._pop();
  1937. $ctx2.sendIdx["pop"]=1;
  1938. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1939. receiver=self._pop();
  1940. message=self._messageFromSendNode_arguments_(aNode,_st(args)._reversed());
  1941. result=self._sendMessage_to_superSend_(message,receiver,_st(aNode)._superSend());
  1942. $1=_st(_st(aNode)._isCascadeSendNode())._and_((function(){
  1943. return smalltalk.withContext(function($ctx2) {
  1944. return _st(_st(aNode)._isLastChild())._not();
  1945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1946. if(smalltalk.assert($1)){
  1947. self._push_(receiver);
  1948. $ctx1.sendIdx["push:"]=1;
  1949. } else {
  1950. self._push_(result);
  1951. };
  1952. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},smalltalk.ASTInterpreter)})},
  1953. args: ["aNode"],
  1954. source: "visitSendNode: aNode\x0a\x09| receiver args message result |\x0a\x09\x0a\x09args := aNode arguments collect: [ :each | self pop ].\x0a\x09receiver := self pop.\x0a\x09\x0a\x09message := self\x0a\x09\x09messageFromSendNode: aNode\x0a\x09\x09arguments: args reversed.\x0a\x09\x0a\x09result := self sendMessage: message to: receiver superSend: aNode superSend.\x0a\x09\x0a\x09\x22For cascade sends, push the reciever if the send is not the last one\x22\x0a\x09(aNode isCascadeSendNode and: [ aNode isLastChild not ])\x0a\x09\x09ifTrue: [ self push: receiver ]\x0a\x09\x09ifFalse: [ self push: result ]",
  1955. messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"],
  1956. referencedClasses: []
  1957. }),
  1958. smalltalk.ASTInterpreter);
  1959. smalltalk.addMethod(
  1960. smalltalk.method({
  1961. selector: "visitValueNode:",
  1962. category: 'visiting',
  1963. fn: function (aNode){
  1964. var self=this;
  1965. return smalltalk.withContext(function($ctx1) {
  1966. self._push_(_st(aNode)._value());
  1967. return self}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1968. args: ["aNode"],
  1969. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  1970. messageSends: ["push:", "value"],
  1971. referencedClasses: []
  1972. }),
  1973. smalltalk.ASTInterpreter);
  1974. smalltalk.addMethod(
  1975. smalltalk.method({
  1976. selector: "visitVariableNode:",
  1977. category: 'visiting',
  1978. fn: function (aNode){
  1979. var self=this;
  1980. function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  1981. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1982. return smalltalk.withContext(function($ctx1) {
  1983. var $2,$1,$5,$6,$4,$3,$9,$8,$11,$10,$12,$13,$14,$16,$15,$17,$18,$19,$20,$7;
  1984. $2=_st(aNode)._binding();
  1985. $ctx1.sendIdx["binding"]=1;
  1986. $1=_st($2)._isUnknownVar();
  1987. if(smalltalk.assert($1)){
  1988. $5=_st($PlatformInterface())._globals();
  1989. $ctx1.sendIdx["globals"]=1;
  1990. $6=_st(aNode)._value();
  1991. $ctx1.sendIdx["value"]=1;
  1992. $4=_st($5)._at_ifAbsent_($6,(function(){
  1993. return smalltalk.withContext(function($ctx2) {
  1994. return self._error_("Unknown variable");
  1995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1996. $ctx1.sendIdx["at:ifAbsent:"]=1;
  1997. $3=self._push_($4);
  1998. $ctx1.sendIdx["push:"]=1;
  1999. return $3;
  2000. };
  2001. $9=_st(aNode)._binding();
  2002. $8=_st($9)._isInstanceVar();
  2003. if(smalltalk.assert($8)){
  2004. $11=self._context();
  2005. $ctx1.sendIdx["context"]=1;
  2006. $10=_st($11)._receiver();
  2007. $12=_st(aNode)._value();
  2008. $ctx1.sendIdx["value"]=2;
  2009. $7=_st($10)._instVarAt_($12);
  2010. } else {
  2011. $13=self._context();
  2012. $14=_st(aNode)._value();
  2013. $ctx1.sendIdx["value"]=3;
  2014. $7=_st($13)._localAt_ifAbsent_($14,(function(){
  2015. return smalltalk.withContext(function($ctx2) {
  2016. $16=_st(aNode)._value();
  2017. $ctx2.sendIdx["value"]=4;
  2018. $15=_st($16)._isCapitalized();
  2019. if(smalltalk.assert($15)){
  2020. $17=_st($Smalltalk())._current();
  2021. $18=_st(aNode)._value();
  2022. $ctx2.sendIdx["value"]=5;
  2023. return _st($17)._at_ifAbsent_($18,(function(){
  2024. return smalltalk.withContext(function($ctx3) {
  2025. $19=_st($PlatformInterface())._globals();
  2026. $20=_st(aNode)._value();
  2027. return _st($19)._at_($20);
  2028. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)})}));
  2029. };
  2030. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  2031. };
  2032. self._push_($7);
  2033. return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  2034. args: ["aNode"],
  2035. source: "visitVariableNode: aNode\x0a\x09aNode binding isUnknownVar ifTrue: [\x0a\x09\x09^ self push: (PlatformInterface globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].\x0a\x09\x09\x0a\x09self push: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context \x0a\x09\x09\x09localAt: aNode value\x0a\x09\x09\x09ifAbsent: [\x0a\x09\x09\x09\x09aNode value isCapitalized\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09Smalltalk current \x0a\x09\x09\x09\x09\x09\x09\x09at: aNode value \x0a\x09\x09\x09\x09\x09\x09\x09ifAbsent: [ PlatformInterface globals at: aNode value ]]]])",
  2036. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "current", "at:"],
  2037. referencedClasses: ["PlatformInterface", "Smalltalk"]
  2038. }),
  2039. smalltalk.ASTInterpreter);
  2040. smalltalk.addClass('ASTInterpreterError', smalltalk.Error, [], 'Compiler-Interpreter');
  2041. smalltalk.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  2042. smalltalk.addClass('ASTPCNodeVisitor', smalltalk.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
  2043. smalltalk.ASTPCNodeVisitor.comment="I visit an AST until I get to the current node for the `context` 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 is answered by `#currentNode`";
  2044. smalltalk.addMethod(
  2045. smalltalk.method({
  2046. selector: "context",
  2047. category: 'accessing',
  2048. fn: function (){
  2049. var self=this;
  2050. return smalltalk.withContext(function($ctx1) {
  2051. var $1;
  2052. $1=self["@context"];
  2053. return $1;
  2054. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTPCNodeVisitor)})},
  2055. args: [],
  2056. source: "context\x0a\x09^ context",
  2057. messageSends: [],
  2058. referencedClasses: []
  2059. }),
  2060. smalltalk.ASTPCNodeVisitor);
  2061. smalltalk.addMethod(
  2062. smalltalk.method({
  2063. selector: "context:",
  2064. category: 'accessing',
  2065. fn: function (aContext){
  2066. var self=this;
  2067. return smalltalk.withContext(function($ctx1) {
  2068. self["@context"]=aContext;
  2069. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTPCNodeVisitor)})},
  2070. args: ["aContext"],
  2071. source: "context: aContext\x0a\x09context := aContext",
  2072. messageSends: [],
  2073. referencedClasses: []
  2074. }),
  2075. smalltalk.ASTPCNodeVisitor);
  2076. smalltalk.addMethod(
  2077. smalltalk.method({
  2078. selector: "currentNode",
  2079. category: 'accessing',
  2080. fn: function (){
  2081. var self=this;
  2082. return smalltalk.withContext(function($ctx1) {
  2083. var $1;
  2084. $1=self["@currentNode"];
  2085. return $1;
  2086. }, function($ctx1) {$ctx1.fill(self,"currentNode",{},smalltalk.ASTPCNodeVisitor)})},
  2087. args: [],
  2088. source: "currentNode\x0a\x09^ currentNode",
  2089. messageSends: [],
  2090. referencedClasses: []
  2091. }),
  2092. smalltalk.ASTPCNodeVisitor);
  2093. smalltalk.addMethod(
  2094. smalltalk.method({
  2095. selector: "increaseIndex",
  2096. category: 'accessing',
  2097. fn: function (){
  2098. var self=this;
  2099. return smalltalk.withContext(function($ctx1) {
  2100. self["@index"]=_st(self._index()).__plus((1));
  2101. return self}, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},smalltalk.ASTPCNodeVisitor)})},
  2102. args: [],
  2103. source: "increaseIndex\x0a\x09index := self index + 1",
  2104. messageSends: ["+", "index"],
  2105. referencedClasses: []
  2106. }),
  2107. smalltalk.ASTPCNodeVisitor);
  2108. smalltalk.addMethod(
  2109. smalltalk.method({
  2110. selector: "index",
  2111. category: 'accessing',
  2112. fn: function (){
  2113. var self=this;
  2114. return smalltalk.withContext(function($ctx1) {
  2115. var $2,$1;
  2116. $2=self["@index"];
  2117. if(($receiver = $2) == nil || $receiver == null){
  2118. self["@index"]=(0);
  2119. $1=self["@index"];
  2120. } else {
  2121. $1=$2;
  2122. };
  2123. return $1;
  2124. }, function($ctx1) {$ctx1.fill(self,"index",{},smalltalk.ASTPCNodeVisitor)})},
  2125. args: [],
  2126. source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
  2127. messageSends: ["ifNil:"],
  2128. referencedClasses: []
  2129. }),
  2130. smalltalk.ASTPCNodeVisitor);
  2131. smalltalk.addMethod(
  2132. smalltalk.method({
  2133. selector: "selector",
  2134. category: 'accessing',
  2135. fn: function (){
  2136. var self=this;
  2137. return smalltalk.withContext(function($ctx1) {
  2138. var $1;
  2139. $1=self["@selector"];
  2140. return $1;
  2141. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.ASTPCNodeVisitor)})},
  2142. args: [],
  2143. source: "selector\x0a\x09^ selector",
  2144. messageSends: [],
  2145. referencedClasses: []
  2146. }),
  2147. smalltalk.ASTPCNodeVisitor);
  2148. smalltalk.addMethod(
  2149. smalltalk.method({
  2150. selector: "selector:",
  2151. category: 'accessing',
  2152. fn: function (aString){
  2153. var self=this;
  2154. return smalltalk.withContext(function($ctx1) {
  2155. self["@selector"]=aString;
  2156. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.ASTPCNodeVisitor)})},
  2157. args: ["aString"],
  2158. source: "selector: aString\x0a\x09selector := aString",
  2159. messageSends: [],
  2160. referencedClasses: []
  2161. }),
  2162. smalltalk.ASTPCNodeVisitor);
  2163. smalltalk.addMethod(
  2164. smalltalk.method({
  2165. selector: "visitJSStatementNode:",
  2166. category: 'visiting',
  2167. fn: function (aNode){
  2168. var self=this;
  2169. return smalltalk.withContext(function($ctx1) {
  2170. self["@currentNode"]=aNode;
  2171. return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.ASTPCNodeVisitor)})},
  2172. args: ["aNode"],
  2173. source: "visitJSStatementNode: aNode\x0a\x09\x22If a JSStatementNode is encountered, it always is the current node.\x0a\x09Stop visiting the AST there\x22\x0a\x09\x0a\x09currentNode := aNode",
  2174. messageSends: [],
  2175. referencedClasses: []
  2176. }),
  2177. smalltalk.ASTPCNodeVisitor);
  2178. smalltalk.addMethod(
  2179. smalltalk.method({
  2180. selector: "visitSendNode:",
  2181. category: 'visiting',
  2182. fn: function (aNode){
  2183. var self=this;
  2184. var sendIndex;
  2185. return smalltalk.withContext(function($ctx1) {
  2186. var $1,$2,$4,$5,$3,$7,$6,$9,$8;
  2187. $1=self._context();
  2188. $2=self._selector();
  2189. $ctx1.sendIdx["selector"]=1;
  2190. sendIndex=_st($1)._sendIndexAt_($2);
  2191. smalltalk.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
  2192. $4=self._selector();
  2193. $ctx1.sendIdx["selector"]=2;
  2194. $5=_st(aNode)._selector();
  2195. $3=_st($4).__eq($5);
  2196. if(smalltalk.assert($3)){
  2197. $7=self._index();
  2198. $ctx1.sendIdx["index"]=1;
  2199. $6=_st($7).__lt(sendIndex);
  2200. if(! smalltalk.assert($6)){
  2201. $9=self._index();
  2202. $8=_st($9).__gt(sendIndex);
  2203. if(! smalltalk.assert($8)){
  2204. self["@currentNode"]=aNode;
  2205. self["@currentNode"];
  2206. };
  2207. };
  2208. self._increaseIndex();
  2209. };
  2210. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},smalltalk.ASTPCNodeVisitor)})},
  2211. args: ["aNode"],
  2212. source: "visitSendNode: aNode\x0a\x09| sendIndex |\x0a\x09sendIndex := self context sendIndexAt: self selector.\x0a\x09\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self selector = aNode selector ifTrue: [\x0a\x09\x09self index < sendIndex ifFalse: [ \x0a\x09\x09\x09self index > sendIndex ifFalse: [ currentNode := aNode ] ].\x0a\x09\x09self increaseIndex ]",
  2213. messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "ifFalse:", "<", "index", ">", "increaseIndex"],
  2214. referencedClasses: []
  2215. }),
  2216. smalltalk.ASTPCNodeVisitor);
  2217. smalltalk.addMethod(
  2218. smalltalk.method({
  2219. selector: "isSteppingNode",
  2220. category: '*Compiler-Interpreter',
  2221. fn: function (){
  2222. var self=this;
  2223. return smalltalk.withContext(function($ctx1) {
  2224. return false;
  2225. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.Node)})},
  2226. args: [],
  2227. source: "isSteppingNode\x0a\x09^ false",
  2228. messageSends: [],
  2229. referencedClasses: []
  2230. }),
  2231. smalltalk.Node);
  2232. smalltalk.addMethod(
  2233. smalltalk.method({
  2234. selector: "isSteppingNode",
  2235. category: '*Compiler-Interpreter',
  2236. fn: function (){
  2237. var self=this;
  2238. return smalltalk.withContext(function($ctx1) {
  2239. return true;
  2240. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.AssignmentNode)})},
  2241. args: [],
  2242. source: "isSteppingNode\x0a\x09^ true",
  2243. messageSends: [],
  2244. referencedClasses: []
  2245. }),
  2246. smalltalk.AssignmentNode);
  2247. smalltalk.addMethod(
  2248. smalltalk.method({
  2249. selector: "isSteppingNode",
  2250. category: '*Compiler-Interpreter',
  2251. fn: function (){
  2252. var self=this;
  2253. return smalltalk.withContext(function($ctx1) {
  2254. return true;
  2255. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.BlockNode)})},
  2256. args: [],
  2257. source: "isSteppingNode\x0a\x09^ true",
  2258. messageSends: [],
  2259. referencedClasses: []
  2260. }),
  2261. smalltalk.BlockNode);
  2262. smalltalk.addMethod(
  2263. smalltalk.method({
  2264. selector: "isSteppingNode",
  2265. category: '*Compiler-Interpreter',
  2266. fn: function (){
  2267. var self=this;
  2268. return smalltalk.withContext(function($ctx1) {
  2269. return true;
  2270. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicArrayNode)})},
  2271. args: [],
  2272. source: "isSteppingNode\x0a\x09^ true",
  2273. messageSends: [],
  2274. referencedClasses: []
  2275. }),
  2276. smalltalk.DynamicArrayNode);
  2277. smalltalk.addMethod(
  2278. smalltalk.method({
  2279. selector: "isSteppingNode",
  2280. category: '*Compiler-Interpreter',
  2281. fn: function (){
  2282. var self=this;
  2283. return smalltalk.withContext(function($ctx1) {
  2284. return true;
  2285. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicDictionaryNode)})},
  2286. args: [],
  2287. source: "isSteppingNode\x0a\x09^ true",
  2288. messageSends: [],
  2289. referencedClasses: []
  2290. }),
  2291. smalltalk.DynamicDictionaryNode);
  2292. smalltalk.addMethod(
  2293. smalltalk.method({
  2294. selector: "isSteppingNode",
  2295. category: '*Compiler-Interpreter',
  2296. fn: function (){
  2297. var self=this;
  2298. return smalltalk.withContext(function($ctx1) {
  2299. return true;
  2300. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.JSStatementNode)})},
  2301. args: [],
  2302. source: "isSteppingNode\x0a\x09^ true",
  2303. messageSends: [],
  2304. referencedClasses: []
  2305. }),
  2306. smalltalk.JSStatementNode);
  2307. smalltalk.addMethod(
  2308. smalltalk.method({
  2309. selector: "isSteppingNode",
  2310. category: '*Compiler-Interpreter',
  2311. fn: function (){
  2312. var self=this;
  2313. return smalltalk.withContext(function($ctx1) {
  2314. return true;
  2315. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.SendNode)})},
  2316. args: [],
  2317. source: "isSteppingNode\x0a\x09^ true",
  2318. messageSends: [],
  2319. referencedClasses: []
  2320. }),
  2321. smalltalk.SendNode);
  2322. });