Compiler-Interpreter.js 83 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420
  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 `ASTSteppingInterpreter` to actually step through node and interpret them.\x0a\x0aMy instances are created from a `MethodContext` with `ASTDebugger class >> context:`.\x0aThey hold an `AIContext` instance internally, recursive copy of the `MethodContext`.\x0a\x0a## API\x0a\x0aUse the methods of the `'stepping'` protocol to do stepping.";
  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: "stepInto",
  1118. category: 'stepping',
  1119. fn: function (){
  1120. var self=this;
  1121. return smalltalk.withContext(function($ctx1) {
  1122. self._shouldBeImplemented();
  1123. return self}, function($ctx1) {$ctx1.fill(self,"stepInto",{},smalltalk.ASTDebugger)})},
  1124. args: [],
  1125. source: "stepInto\x0a\x09self shouldBeImplemented",
  1126. messageSends: ["shouldBeImplemented"],
  1127. referencedClasses: []
  1128. }),
  1129. smalltalk.ASTDebugger);
  1130. smalltalk.addMethod(
  1131. smalltalk.method({
  1132. selector: "stepOver",
  1133. category: 'stepping',
  1134. fn: function (){
  1135. var self=this;
  1136. return smalltalk.withContext(function($ctx1) {
  1137. _st(self._interpreter())._stepOver();
  1138. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},smalltalk.ASTDebugger)})},
  1139. args: [],
  1140. source: "stepOver\x0a\x09self interpreter stepOver",
  1141. messageSends: ["stepOver", "interpreter"],
  1142. referencedClasses: []
  1143. }),
  1144. smalltalk.ASTDebugger);
  1145. smalltalk.addMethod(
  1146. smalltalk.method({
  1147. selector: "context:",
  1148. category: 'instance creation',
  1149. fn: function (aContext){
  1150. var self=this;
  1151. return smalltalk.withContext(function($ctx1) {
  1152. var $2,$3,$1;
  1153. $2=self._new();
  1154. _st($2)._initializeWithContext_(aContext);
  1155. $3=_st($2)._yourself();
  1156. $1=$3;
  1157. return $1;
  1158. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTDebugger.klass)})},
  1159. args: ["aContext"],
  1160. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext;\x0a\x09\x09yourself",
  1161. messageSends: ["initializeWithContext:", "new", "yourself"],
  1162. referencedClasses: []
  1163. }),
  1164. smalltalk.ASTDebugger.klass);
  1165. smalltalk.addClass('ASTInterpreter', smalltalk.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned'], 'Compiler-Interpreter');
  1166. 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";
  1167. smalltalk.addMethod(
  1168. smalltalk.method({
  1169. selector: "assign:to:",
  1170. category: 'private',
  1171. fn: function (aNode,anObject){
  1172. var self=this;
  1173. return smalltalk.withContext(function($ctx1) {
  1174. var $1,$3,$2,$4,$5,$6;
  1175. $1=_st(_st(aNode)._binding())._isInstanceVar();
  1176. if(smalltalk.assert($1)){
  1177. $3=self._context();
  1178. $ctx1.sendIdx["context"]=1;
  1179. $2=_st($3)._receiver();
  1180. $4=_st(aNode)._value();
  1181. $ctx1.sendIdx["value"]=1;
  1182. _st($2)._instVarAt_put_($4,anObject);
  1183. } else {
  1184. $5=self._context();
  1185. $6=_st(aNode)._value();
  1186. _st($5)._localAt_put_($6,anObject);
  1187. };
  1188. return self}, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},smalltalk.ASTInterpreter)})},
  1189. args: ["aNode", "anObject"],
  1190. 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 ]",
  1191. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"],
  1192. referencedClasses: []
  1193. }),
  1194. smalltalk.ASTInterpreter);
  1195. smalltalk.addMethod(
  1196. smalltalk.method({
  1197. selector: "atEnd",
  1198. category: 'testing',
  1199. fn: function (){
  1200. var self=this;
  1201. return smalltalk.withContext(function($ctx1) {
  1202. var $1;
  1203. $1=_st(self._hasReturned())._or_((function(){
  1204. return smalltalk.withContext(function($ctx2) {
  1205. return _st(self._node())._isNil();
  1206. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1207. return $1;
  1208. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTInterpreter)})},
  1209. args: [],
  1210. source: "atEnd\x0a\x09^ self hasReturned or: [ self node isNil ]",
  1211. messageSends: ["or:", "hasReturned", "isNil", "node"],
  1212. referencedClasses: []
  1213. }),
  1214. smalltalk.ASTInterpreter);
  1215. smalltalk.addMethod(
  1216. smalltalk.method({
  1217. selector: "context",
  1218. category: 'accessing',
  1219. fn: function (){
  1220. var self=this;
  1221. return smalltalk.withContext(function($ctx1) {
  1222. var $1;
  1223. $1=self["@context"];
  1224. return $1;
  1225. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTInterpreter)})},
  1226. args: [],
  1227. source: "context\x0a\x09^ context",
  1228. messageSends: [],
  1229. referencedClasses: []
  1230. }),
  1231. smalltalk.ASTInterpreter);
  1232. smalltalk.addMethod(
  1233. smalltalk.method({
  1234. selector: "context:",
  1235. category: 'accessing',
  1236. fn: function (aContext){
  1237. var self=this;
  1238. return smalltalk.withContext(function($ctx1) {
  1239. self["@context"]=aContext;
  1240. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTInterpreter)})},
  1241. args: ["aContext"],
  1242. source: "context: aContext\x0a\x09context := aContext",
  1243. messageSends: [],
  1244. referencedClasses: []
  1245. }),
  1246. smalltalk.ASTInterpreter);
  1247. smalltalk.addMethod(
  1248. smalltalk.method({
  1249. selector: "eval:",
  1250. category: 'private',
  1251. fn: function (aString){
  1252. var self=this;
  1253. var source,function_;
  1254. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1255. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  1256. return smalltalk.withContext(function($ctx1) {
  1257. var $3,$2,$1,$4,$6,$9,$8,$7,$5;
  1258. source=_st($String())._streamContents_((function(str){
  1259. return smalltalk.withContext(function($ctx2) {
  1260. _st(str)._nextPutAll_("(function(");
  1261. $ctx2.sendIdx["nextPutAll:"]=1;
  1262. $3=self._context();
  1263. $ctx2.sendIdx["context"]=1;
  1264. $2=_st($3)._locals();
  1265. $ctx2.sendIdx["locals"]=1;
  1266. $1=_st($2)._keys();
  1267. _st($1)._do_separatedBy_((function(each){
  1268. return smalltalk.withContext(function($ctx3) {
  1269. return _st(str)._nextPutAll_(each);
  1270. $ctx3.sendIdx["nextPutAll:"]=2;
  1271. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  1272. return smalltalk.withContext(function($ctx3) {
  1273. return _st(str)._nextPutAll_(",");
  1274. $ctx3.sendIdx["nextPutAll:"]=3;
  1275. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  1276. _st(str)._nextPutAll_("){ return (function() {");
  1277. $ctx2.sendIdx["nextPutAll:"]=4;
  1278. _st(str)._nextPutAll_(aString);
  1279. $ctx2.sendIdx["nextPutAll:"]=5;
  1280. $4=_st(str)._nextPutAll_("})() })");
  1281. return $4;
  1282. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  1283. function_=_st(_st($Compiler())._new())._eval_(source);
  1284. $6=function_;
  1285. $9=self._context();
  1286. $8=_st($9)._locals();
  1287. $7=_st($8)._values();
  1288. $5=_st($6)._valueWithPossibleArguments_($7);
  1289. return $5;
  1290. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},smalltalk.ASTInterpreter)})},
  1291. args: ["aString"],
  1292. 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",
  1293. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"],
  1294. referencedClasses: ["String", "Compiler"]
  1295. }),
  1296. smalltalk.ASTInterpreter);
  1297. smalltalk.addMethod(
  1298. smalltalk.method({
  1299. selector: "hasReturned",
  1300. category: 'testing',
  1301. fn: function (){
  1302. var self=this;
  1303. return smalltalk.withContext(function($ctx1) {
  1304. var $2,$1;
  1305. $2=self["@returned"];
  1306. if(($receiver = $2) == nil || $receiver == null){
  1307. $1=false;
  1308. } else {
  1309. $1=$2;
  1310. };
  1311. return $1;
  1312. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},smalltalk.ASTInterpreter)})},
  1313. args: [],
  1314. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  1315. messageSends: ["ifNil:"],
  1316. referencedClasses: []
  1317. }),
  1318. smalltalk.ASTInterpreter);
  1319. smalltalk.addMethod(
  1320. smalltalk.method({
  1321. selector: "interpret",
  1322. category: 'interpreting',
  1323. fn: function (){
  1324. var self=this;
  1325. return smalltalk.withContext(function($ctx1) {
  1326. self._visit_(self._node());
  1327. return self}, function($ctx1) {$ctx1.fill(self,"interpret",{},smalltalk.ASTInterpreter)})},
  1328. args: [],
  1329. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  1330. messageSends: ["visit:", "node"],
  1331. referencedClasses: []
  1332. }),
  1333. smalltalk.ASTInterpreter);
  1334. smalltalk.addMethod(
  1335. smalltalk.method({
  1336. selector: "interpret:",
  1337. category: 'interpreting',
  1338. fn: function (aNode){
  1339. var self=this;
  1340. return smalltalk.withContext(function($ctx1) {
  1341. self._node_(aNode);
  1342. self._interpret();
  1343. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1344. args: ["aNode"],
  1345. source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret",
  1346. messageSends: ["node:", "interpret"],
  1347. referencedClasses: []
  1348. }),
  1349. smalltalk.ASTInterpreter);
  1350. smalltalk.addMethod(
  1351. smalltalk.method({
  1352. selector: "messageFromSendNode:arguments:",
  1353. category: 'private',
  1354. fn: function (aSendNode,aCollection){
  1355. var self=this;
  1356. function $Message(){return smalltalk.Message||(typeof Message=="undefined"?nil:Message)}
  1357. return smalltalk.withContext(function($ctx1) {
  1358. var $2,$3,$1;
  1359. $2=_st($Message())._new();
  1360. _st($2)._selector_(_st(aSendNode)._selector());
  1361. _st($2)._arguments_(aCollection);
  1362. $3=_st($2)._yourself();
  1363. $1=$3;
  1364. return $1;
  1365. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},smalltalk.ASTInterpreter)})},
  1366. args: ["aSendNode", "aCollection"],
  1367. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  1368. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"],
  1369. referencedClasses: ["Message"]
  1370. }),
  1371. smalltalk.ASTInterpreter);
  1372. smalltalk.addMethod(
  1373. smalltalk.method({
  1374. selector: "messageNotUnderstood:receiver:",
  1375. category: 'private',
  1376. fn: function (aMessage,anObject){
  1377. var self=this;
  1378. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1379. return smalltalk.withContext(function($ctx1) {
  1380. var $1,$2;
  1381. $1=_st($MessageNotUnderstood())._new();
  1382. _st($1)._meesage_(aMessage);
  1383. _st($1)._receiver_(anObject);
  1384. $2=_st($1)._signal();
  1385. return self}, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},smalltalk.ASTInterpreter)})},
  1386. args: ["aMessage", "anObject"],
  1387. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  1388. messageSends: ["meesage:", "new", "receiver:", "signal"],
  1389. referencedClasses: ["MessageNotUnderstood"]
  1390. }),
  1391. smalltalk.ASTInterpreter);
  1392. smalltalk.addMethod(
  1393. smalltalk.method({
  1394. selector: "next",
  1395. category: 'interpreting',
  1396. fn: function (){
  1397. var self=this;
  1398. return smalltalk.withContext(function($ctx1) {
  1399. self._node_(_st(self._node())._nextNode());
  1400. return self}, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.ASTInterpreter)})},
  1401. args: [],
  1402. source: "next\x0a\x09self node: self node nextNode",
  1403. messageSends: ["node:", "nextNode", "node"],
  1404. referencedClasses: []
  1405. }),
  1406. smalltalk.ASTInterpreter);
  1407. smalltalk.addMethod(
  1408. smalltalk.method({
  1409. selector: "node",
  1410. category: 'accessing',
  1411. fn: function (){
  1412. var self=this;
  1413. return smalltalk.withContext(function($ctx1) {
  1414. var $1;
  1415. $1=self["@node"];
  1416. return $1;
  1417. }, function($ctx1) {$ctx1.fill(self,"node",{},smalltalk.ASTInterpreter)})},
  1418. args: [],
  1419. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  1420. messageSends: [],
  1421. referencedClasses: []
  1422. }),
  1423. smalltalk.ASTInterpreter);
  1424. smalltalk.addMethod(
  1425. smalltalk.method({
  1426. selector: "node:",
  1427. category: 'accessing',
  1428. fn: function (aNode){
  1429. var self=this;
  1430. return smalltalk.withContext(function($ctx1) {
  1431. self["@node"]=aNode;
  1432. return self}, function($ctx1) {$ctx1.fill(self,"node:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1433. args: ["aNode"],
  1434. source: "node: aNode\x0a\x09node := aNode",
  1435. messageSends: [],
  1436. referencedClasses: []
  1437. }),
  1438. smalltalk.ASTInterpreter);
  1439. smalltalk.addMethod(
  1440. smalltalk.method({
  1441. selector: "peek",
  1442. category: 'stack',
  1443. fn: function (){
  1444. var self=this;
  1445. return smalltalk.withContext(function($ctx1) {
  1446. var $1,$3,$2;
  1447. var $early={};
  1448. try {
  1449. $1=self._stack();
  1450. $ctx1.sendIdx["stack"]=1;
  1451. _st($1)._ifEmpty_((function(){
  1452. return smalltalk.withContext(function($ctx2) {
  1453. throw $early=[nil];
  1454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1455. $3=self._stack();
  1456. $2=_st($3)._last();
  1457. return $2;
  1458. }
  1459. catch(e) {if(e===$early)return e[0]; throw e}
  1460. }, function($ctx1) {$ctx1.fill(self,"peek",{},smalltalk.ASTInterpreter)})},
  1461. args: [],
  1462. 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",
  1463. messageSends: ["ifEmpty:", "stack", "last"],
  1464. referencedClasses: []
  1465. }),
  1466. smalltalk.ASTInterpreter);
  1467. smalltalk.addMethod(
  1468. smalltalk.method({
  1469. selector: "pop",
  1470. category: 'stack',
  1471. fn: function (){
  1472. var self=this;
  1473. var peekedValue;
  1474. return smalltalk.withContext(function($ctx1) {
  1475. var $1;
  1476. peekedValue=self._peek();
  1477. _st(self._stack())._removeLast();
  1478. $1=peekedValue;
  1479. return $1;
  1480. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},smalltalk.ASTInterpreter)})},
  1481. args: [],
  1482. 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",
  1483. messageSends: ["peek", "removeLast", "stack"],
  1484. referencedClasses: []
  1485. }),
  1486. smalltalk.ASTInterpreter);
  1487. smalltalk.addMethod(
  1488. smalltalk.method({
  1489. selector: "proceed",
  1490. category: 'interpreting',
  1491. fn: function (){
  1492. var self=this;
  1493. return smalltalk.withContext(function($ctx1) {
  1494. _st((function(){
  1495. return smalltalk.withContext(function($ctx2) {
  1496. return self._atEnd();
  1497. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  1498. return smalltalk.withContext(function($ctx2) {
  1499. return self._step();
  1500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1501. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.ASTInterpreter)})},
  1502. args: [],
  1503. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] whileFalse: [ \x0a\x09\x09self step ]",
  1504. messageSends: ["whileFalse:", "atEnd", "step"],
  1505. referencedClasses: []
  1506. }),
  1507. smalltalk.ASTInterpreter);
  1508. smalltalk.addMethod(
  1509. smalltalk.method({
  1510. selector: "push:",
  1511. category: 'stack',
  1512. fn: function (anObject){
  1513. var self=this;
  1514. return smalltalk.withContext(function($ctx1) {
  1515. var $1;
  1516. $1=_st(self._stack())._add_(anObject);
  1517. return $1;
  1518. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},smalltalk.ASTInterpreter)})},
  1519. args: ["anObject"],
  1520. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  1521. messageSends: ["add:", "stack"],
  1522. referencedClasses: []
  1523. }),
  1524. smalltalk.ASTInterpreter);
  1525. smalltalk.addMethod(
  1526. smalltalk.method({
  1527. selector: "restart",
  1528. category: 'interpreting',
  1529. fn: function (){
  1530. var self=this;
  1531. return smalltalk.withContext(function($ctx1) {
  1532. self._node_(_st(_st(self._context())._ast())._nextChild());
  1533. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},smalltalk.ASTInterpreter)})},
  1534. args: [],
  1535. source: "restart\x0a\x09self node: self context ast nextChild",
  1536. messageSends: ["node:", "nextChild", "ast", "context"],
  1537. referencedClasses: []
  1538. }),
  1539. smalltalk.ASTInterpreter);
  1540. smalltalk.addMethod(
  1541. smalltalk.method({
  1542. selector: "result",
  1543. category: 'accessing',
  1544. fn: function (){
  1545. var self=this;
  1546. return smalltalk.withContext(function($ctx1) {
  1547. var $2,$1;
  1548. $2=self._hasReturned();
  1549. if(smalltalk.assert($2)){
  1550. $1=self._returnValue();
  1551. } else {
  1552. $1=_st(self._context())._receiver();
  1553. };
  1554. return $1;
  1555. }, function($ctx1) {$ctx1.fill(self,"result",{},smalltalk.ASTInterpreter)})},
  1556. args: [],
  1557. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  1558. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"],
  1559. referencedClasses: []
  1560. }),
  1561. smalltalk.ASTInterpreter);
  1562. smalltalk.addMethod(
  1563. smalltalk.method({
  1564. selector: "returnValue",
  1565. category: 'accessing',
  1566. fn: function (){
  1567. var self=this;
  1568. return smalltalk.withContext(function($ctx1) {
  1569. var $1;
  1570. $1=self["@returnValue"];
  1571. return $1;
  1572. }, function($ctx1) {$ctx1.fill(self,"returnValue",{},smalltalk.ASTInterpreter)})},
  1573. args: [],
  1574. source: "returnValue\x0a\x09^ returnValue",
  1575. messageSends: [],
  1576. referencedClasses: []
  1577. }),
  1578. smalltalk.ASTInterpreter);
  1579. smalltalk.addMethod(
  1580. smalltalk.method({
  1581. selector: "returnValue:",
  1582. category: 'accessing',
  1583. fn: function (anObject){
  1584. var self=this;
  1585. return smalltalk.withContext(function($ctx1) {
  1586. self["@returnValue"]=anObject;
  1587. return self}, function($ctx1) {$ctx1.fill(self,"returnValue:",{anObject:anObject},smalltalk.ASTInterpreter)})},
  1588. args: ["anObject"],
  1589. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  1590. messageSends: [],
  1591. referencedClasses: []
  1592. }),
  1593. smalltalk.ASTInterpreter);
  1594. smalltalk.addMethod(
  1595. smalltalk.method({
  1596. selector: "sendMessage:to:superSend:",
  1597. category: 'private',
  1598. fn: function (aMessage,anObject,aBoolean){
  1599. var self=this;
  1600. var method;
  1601. return smalltalk.withContext(function($ctx1) {
  1602. var $1,$3,$2,$4,$7,$6,$5,$8,$9;
  1603. var $early={};
  1604. try {
  1605. if(! smalltalk.assert(aBoolean)){
  1606. $1=_st(aMessage)._sendTo_(anObject);
  1607. return $1;
  1608. };
  1609. $3=_st(anObject)._class();
  1610. $ctx1.sendIdx["class"]=1;
  1611. $2=_st($3)._superclass();
  1612. $ctx1.sendIdx["superclass"]=1;
  1613. if(($receiver = $2) == nil || $receiver == null){
  1614. $4=self._messageNotUnderstood_receiver_(aMessage,anObject);
  1615. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  1616. return $4;
  1617. } else {
  1618. $2;
  1619. };
  1620. $7=_st(anObject)._class();
  1621. $6=_st($7)._superclass();
  1622. $5=_st($6)._methodDictionary();
  1623. method=_st($5)._at_ifAbsent_(_st(aMessage)._selector(),(function(){
  1624. return smalltalk.withContext(function($ctx2) {
  1625. $8=self._messageNotUnderstood_receiver_(aMessage,anObject);
  1626. throw $early=[$8];
  1627. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1628. $9=_st(method)._sendTo_arguments_(anObject,_st(aMessage)._arguments());
  1629. return $9;
  1630. }
  1631. catch(e) {if(e===$early)return e[0]; throw e}
  1632. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},smalltalk.ASTInterpreter)})},
  1633. args: ["aMessage", "anObject", "aBoolean"],
  1634. 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",
  1635. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"],
  1636. referencedClasses: []
  1637. }),
  1638. smalltalk.ASTInterpreter);
  1639. smalltalk.addMethod(
  1640. smalltalk.method({
  1641. selector: "setNonLocalReturnFromContext:",
  1642. category: 'interpreting',
  1643. fn: function (aContext){
  1644. var self=this;
  1645. return smalltalk.withContext(function($ctx1) {
  1646. var $2,$1,$4,$3;
  1647. $2=_st(aContext)._interpreter();
  1648. $ctx1.sendIdx["interpreter"]=1;
  1649. $1=_st($2)._hasReturned();
  1650. if(smalltalk.assert($1)){
  1651. self["@returned"]=true;
  1652. self["@returned"];
  1653. $4=_st(aContext)._interpreter();
  1654. $3=_st($4)._returnValue();
  1655. self._returnValue_($3);
  1656. };
  1657. return self}, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},smalltalk.ASTInterpreter)})},
  1658. args: ["aContext"],
  1659. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  1660. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"],
  1661. referencedClasses: []
  1662. }),
  1663. smalltalk.ASTInterpreter);
  1664. smalltalk.addMethod(
  1665. smalltalk.method({
  1666. selector: "skip",
  1667. category: 'interpreting',
  1668. fn: function (){
  1669. var self=this;
  1670. return smalltalk.withContext(function($ctx1) {
  1671. self._next();
  1672. return self}, function($ctx1) {$ctx1.fill(self,"skip",{},smalltalk.ASTInterpreter)})},
  1673. args: [],
  1674. source: "skip\x0a\x09self next",
  1675. messageSends: ["next"],
  1676. referencedClasses: []
  1677. }),
  1678. smalltalk.ASTInterpreter);
  1679. smalltalk.addMethod(
  1680. smalltalk.method({
  1681. selector: "stack",
  1682. category: 'accessing',
  1683. fn: function (){
  1684. var self=this;
  1685. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1686. return smalltalk.withContext(function($ctx1) {
  1687. var $2,$1;
  1688. $2=self["@stack"];
  1689. if(($receiver = $2) == nil || $receiver == null){
  1690. self["@stack"]=_st($OrderedCollection())._new();
  1691. $1=self["@stack"];
  1692. } else {
  1693. $1=$2;
  1694. };
  1695. return $1;
  1696. }, function($ctx1) {$ctx1.fill(self,"stack",{},smalltalk.ASTInterpreter)})},
  1697. args: [],
  1698. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  1699. messageSends: ["ifNil:", "new"],
  1700. referencedClasses: ["OrderedCollection"]
  1701. }),
  1702. smalltalk.ASTInterpreter);
  1703. smalltalk.addMethod(
  1704. smalltalk.method({
  1705. selector: "step",
  1706. category: 'interpreting',
  1707. fn: function (){
  1708. var self=this;
  1709. return smalltalk.withContext(function($ctx1) {
  1710. var $1;
  1711. self._interpret();
  1712. $1=self._next();
  1713. return self}, function($ctx1) {$ctx1.fill(self,"step",{},smalltalk.ASTInterpreter)})},
  1714. args: [],
  1715. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  1716. messageSends: ["interpret", "next"],
  1717. referencedClasses: []
  1718. }),
  1719. smalltalk.ASTInterpreter);
  1720. smalltalk.addMethod(
  1721. smalltalk.method({
  1722. selector: "stepOver",
  1723. category: 'interpreting',
  1724. fn: function (){
  1725. var self=this;
  1726. return smalltalk.withContext(function($ctx1) {
  1727. self._step();
  1728. $ctx1.sendIdx["step"]=1;
  1729. _st((function(){
  1730. return smalltalk.withContext(function($ctx2) {
  1731. return _st(self._node())._isSteppingNode();
  1732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  1733. return smalltalk.withContext(function($ctx2) {
  1734. return self._step();
  1735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1736. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},smalltalk.ASTInterpreter)})},
  1737. args: [],
  1738. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isSteppingNode ] whileFalse: [ \x0a\x09\x09self step ]",
  1739. messageSends: ["step", "whileFalse:", "isSteppingNode", "node"],
  1740. referencedClasses: []
  1741. }),
  1742. smalltalk.ASTInterpreter);
  1743. smalltalk.addMethod(
  1744. smalltalk.method({
  1745. selector: "visit:",
  1746. category: 'visiting',
  1747. fn: function (aNode){
  1748. var self=this;
  1749. return smalltalk.withContext(function($ctx1) {
  1750. var $1;
  1751. $1=self._hasReturned();
  1752. if(! smalltalk.assert($1)){
  1753. smalltalk.ASTInterpreter.superclass.fn.prototype._visit_.apply(_st(self), [aNode]);
  1754. };
  1755. return self}, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1756. args: ["aNode"],
  1757. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  1758. messageSends: ["ifFalse:", "hasReturned", "visit:"],
  1759. referencedClasses: []
  1760. }),
  1761. smalltalk.ASTInterpreter);
  1762. smalltalk.addMethod(
  1763. smalltalk.method({
  1764. selector: "visitAssignmentNode:",
  1765. category: 'visiting',
  1766. fn: function (aNode){
  1767. var self=this;
  1768. var poppedValue;
  1769. return smalltalk.withContext(function($ctx1) {
  1770. poppedValue=self._pop();
  1771. $ctx1.sendIdx["pop"]=1;
  1772. self._pop();
  1773. self._push_(poppedValue);
  1774. self._assign_to_(_st(aNode)._left(),poppedValue);
  1775. return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},smalltalk.ASTInterpreter)})},
  1776. args: ["aNode"],
  1777. 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",
  1778. messageSends: ["pop", "push:", "assign:to:", "left"],
  1779. referencedClasses: []
  1780. }),
  1781. smalltalk.ASTInterpreter);
  1782. smalltalk.addMethod(
  1783. smalltalk.method({
  1784. selector: "visitBlockNode:",
  1785. category: 'visiting',
  1786. fn: function (aNode){
  1787. var self=this;
  1788. var block;
  1789. function $AIBlockClosure(){return smalltalk.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)}
  1790. return smalltalk.withContext(function($ctx1) {
  1791. block=_st($AIBlockClosure())._forContext_node_(self._context(),aNode);
  1792. self._push_(block);
  1793. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},smalltalk.ASTInterpreter)})},
  1794. args: ["aNode"],
  1795. 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",
  1796. messageSends: ["forContext:node:", "context", "push:"],
  1797. referencedClasses: ["AIBlockClosure"]
  1798. }),
  1799. smalltalk.ASTInterpreter);
  1800. smalltalk.addMethod(
  1801. smalltalk.method({
  1802. selector: "visitDynamicArrayNode:",
  1803. category: 'visiting',
  1804. fn: function (aNode){
  1805. var self=this;
  1806. var array;
  1807. return smalltalk.withContext(function($ctx1) {
  1808. array=[];
  1809. _st(_st(aNode)._nodes())._do_((function(each){
  1810. return smalltalk.withContext(function($ctx2) {
  1811. return _st(array)._addFirst_(self._pop());
  1812. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1813. self._push_(array);
  1814. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},smalltalk.ASTInterpreter)})},
  1815. args: ["aNode"],
  1816. 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",
  1817. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"],
  1818. referencedClasses: []
  1819. }),
  1820. smalltalk.ASTInterpreter);
  1821. smalltalk.addMethod(
  1822. smalltalk.method({
  1823. selector: "visitDynamicDictionaryNode:",
  1824. category: 'visiting',
  1825. fn: function (aNode){
  1826. var self=this;
  1827. var associations,hashedCollection;
  1828. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1829. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1830. return smalltalk.withContext(function($ctx1) {
  1831. associations=_st($OrderedCollection())._new();
  1832. $ctx1.sendIdx["new"]=1;
  1833. hashedCollection=_st($HashedCollection())._new();
  1834. _st(_st(aNode)._nodes())._do_((function(each){
  1835. return smalltalk.withContext(function($ctx2) {
  1836. return _st(associations)._add_(self._pop());
  1837. $ctx2.sendIdx["add:"]=1;
  1838. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1839. $ctx1.sendIdx["do:"]=1;
  1840. _st(_st(associations)._reversed())._do_((function(each){
  1841. return smalltalk.withContext(function($ctx2) {
  1842. return _st(hashedCollection)._add_(each);
  1843. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1844. self._push_(hashedCollection);
  1845. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,associations:associations,hashedCollection:hashedCollection},smalltalk.ASTInterpreter)})},
  1846. args: ["aNode"],
  1847. 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",
  1848. messageSends: ["new", "do:", "nodes", "add:", "pop", "reversed", "push:"],
  1849. referencedClasses: ["OrderedCollection", "HashedCollection"]
  1850. }),
  1851. smalltalk.ASTInterpreter);
  1852. smalltalk.addMethod(
  1853. smalltalk.method({
  1854. selector: "visitJSStatementNode:",
  1855. category: 'visiting',
  1856. fn: function (aNode){
  1857. var self=this;
  1858. return smalltalk.withContext(function($ctx1) {
  1859. self["@returned"]=true;
  1860. self._returnValue_(self._eval_(_st(aNode)._source()));
  1861. return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1862. args: ["aNode"],
  1863. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  1864. messageSends: ["returnValue:", "eval:", "source"],
  1865. referencedClasses: []
  1866. }),
  1867. smalltalk.ASTInterpreter);
  1868. smalltalk.addMethod(
  1869. smalltalk.method({
  1870. selector: "visitNode:",
  1871. category: 'visiting',
  1872. fn: function (aNode){
  1873. var self=this;
  1874. return smalltalk.withContext(function($ctx1) {
  1875. return self}, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1876. args: ["aNode"],
  1877. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  1878. messageSends: [],
  1879. referencedClasses: []
  1880. }),
  1881. smalltalk.ASTInterpreter);
  1882. smalltalk.addMethod(
  1883. smalltalk.method({
  1884. selector: "visitReturnNode:",
  1885. category: 'visiting',
  1886. fn: function (aNode){
  1887. var self=this;
  1888. return smalltalk.withContext(function($ctx1) {
  1889. self["@returned"]=true;
  1890. self._returnValue_(self._pop());
  1891. return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1892. args: ["aNode"],
  1893. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  1894. messageSends: ["returnValue:", "pop"],
  1895. referencedClasses: []
  1896. }),
  1897. smalltalk.ASTInterpreter);
  1898. smalltalk.addMethod(
  1899. smalltalk.method({
  1900. selector: "visitSendNode:",
  1901. category: 'visiting',
  1902. fn: function (aNode){
  1903. var self=this;
  1904. var receiver,args,message,result;
  1905. return smalltalk.withContext(function($ctx1) {
  1906. var $1;
  1907. args=_st(_st(aNode)._arguments())._collect_((function(each){
  1908. return smalltalk.withContext(function($ctx2) {
  1909. return self._pop();
  1910. $ctx2.sendIdx["pop"]=1;
  1911. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1912. receiver=self._pop();
  1913. message=self._messageFromSendNode_arguments_(aNode,_st(args)._reversed());
  1914. result=self._sendMessage_to_superSend_(message,receiver,_st(aNode)._superSend());
  1915. $1=_st(_st(aNode)._isCascadeSendNode())._and_((function(){
  1916. return smalltalk.withContext(function($ctx2) {
  1917. return _st(_st(aNode)._isLastChild())._not();
  1918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1919. if(smalltalk.assert($1)){
  1920. self._push_(receiver);
  1921. $ctx1.sendIdx["push:"]=1;
  1922. } else {
  1923. self._push_(result);
  1924. };
  1925. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},smalltalk.ASTInterpreter)})},
  1926. args: ["aNode"],
  1927. 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 ]",
  1928. messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"],
  1929. referencedClasses: []
  1930. }),
  1931. smalltalk.ASTInterpreter);
  1932. smalltalk.addMethod(
  1933. smalltalk.method({
  1934. selector: "visitValueNode:",
  1935. category: 'visiting',
  1936. fn: function (aNode){
  1937. var self=this;
  1938. return smalltalk.withContext(function($ctx1) {
  1939. self._push_(_st(aNode)._value());
  1940. return self}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1941. args: ["aNode"],
  1942. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  1943. messageSends: ["push:", "value"],
  1944. referencedClasses: []
  1945. }),
  1946. smalltalk.ASTInterpreter);
  1947. smalltalk.addMethod(
  1948. smalltalk.method({
  1949. selector: "visitVariableNode:",
  1950. category: 'visiting',
  1951. fn: function (aNode){
  1952. var self=this;
  1953. function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  1954. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1955. return smalltalk.withContext(function($ctx1) {
  1956. var $2,$1,$5,$6,$4,$3,$9,$8,$11,$10,$12,$13,$14,$16,$15,$17,$18,$19,$20,$7;
  1957. $2=_st(aNode)._binding();
  1958. $ctx1.sendIdx["binding"]=1;
  1959. $1=_st($2)._isUnknownVar();
  1960. if(smalltalk.assert($1)){
  1961. $5=_st($PlatformInterface())._globals();
  1962. $ctx1.sendIdx["globals"]=1;
  1963. $6=_st(aNode)._value();
  1964. $ctx1.sendIdx["value"]=1;
  1965. $4=_st($5)._at_ifAbsent_($6,(function(){
  1966. return smalltalk.withContext(function($ctx2) {
  1967. return self._error_("Unknown variable");
  1968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1969. $ctx1.sendIdx["at:ifAbsent:"]=1;
  1970. $3=self._push_($4);
  1971. $ctx1.sendIdx["push:"]=1;
  1972. return $3;
  1973. };
  1974. $9=_st(aNode)._binding();
  1975. $8=_st($9)._isInstanceVar();
  1976. if(smalltalk.assert($8)){
  1977. $11=self._context();
  1978. $ctx1.sendIdx["context"]=1;
  1979. $10=_st($11)._receiver();
  1980. $12=_st(aNode)._value();
  1981. $ctx1.sendIdx["value"]=2;
  1982. $7=_st($10)._instVarAt_($12);
  1983. } else {
  1984. $13=self._context();
  1985. $14=_st(aNode)._value();
  1986. $ctx1.sendIdx["value"]=3;
  1987. $7=_st($13)._localAt_ifAbsent_($14,(function(){
  1988. return smalltalk.withContext(function($ctx2) {
  1989. $16=_st(aNode)._value();
  1990. $ctx2.sendIdx["value"]=4;
  1991. $15=_st($16)._isCapitalized();
  1992. if(smalltalk.assert($15)){
  1993. $17=_st($Smalltalk())._current();
  1994. $18=_st(aNode)._value();
  1995. $ctx2.sendIdx["value"]=5;
  1996. return _st($17)._at_ifAbsent_($18,(function(){
  1997. return smalltalk.withContext(function($ctx3) {
  1998. $19=_st($PlatformInterface())._globals();
  1999. $20=_st(aNode)._value();
  2000. return _st($19)._at_($20);
  2001. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)})}));
  2002. };
  2003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  2004. };
  2005. self._push_($7);
  2006. return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  2007. args: ["aNode"],
  2008. 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 ]]]])",
  2009. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "current", "at:"],
  2010. referencedClasses: ["PlatformInterface", "Smalltalk"]
  2011. }),
  2012. smalltalk.ASTInterpreter);
  2013. smalltalk.addClass('ASTInterpreterError', smalltalk.Error, [], 'Compiler-Interpreter');
  2014. smalltalk.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  2015. smalltalk.addClass('ASTPCNodeVisitor', smalltalk.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
  2016. 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`";
  2017. smalltalk.addMethod(
  2018. smalltalk.method({
  2019. selector: "context",
  2020. category: 'accessing',
  2021. fn: function (){
  2022. var self=this;
  2023. return smalltalk.withContext(function($ctx1) {
  2024. var $1;
  2025. $1=self["@context"];
  2026. return $1;
  2027. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTPCNodeVisitor)})},
  2028. args: [],
  2029. source: "context\x0a\x09^ context",
  2030. messageSends: [],
  2031. referencedClasses: []
  2032. }),
  2033. smalltalk.ASTPCNodeVisitor);
  2034. smalltalk.addMethod(
  2035. smalltalk.method({
  2036. selector: "context:",
  2037. category: 'accessing',
  2038. fn: function (aContext){
  2039. var self=this;
  2040. return smalltalk.withContext(function($ctx1) {
  2041. self["@context"]=aContext;
  2042. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTPCNodeVisitor)})},
  2043. args: ["aContext"],
  2044. source: "context: aContext\x0a\x09context := aContext",
  2045. messageSends: [],
  2046. referencedClasses: []
  2047. }),
  2048. smalltalk.ASTPCNodeVisitor);
  2049. smalltalk.addMethod(
  2050. smalltalk.method({
  2051. selector: "currentNode",
  2052. category: 'accessing',
  2053. fn: function (){
  2054. var self=this;
  2055. return smalltalk.withContext(function($ctx1) {
  2056. var $1;
  2057. $1=self["@currentNode"];
  2058. return $1;
  2059. }, function($ctx1) {$ctx1.fill(self,"currentNode",{},smalltalk.ASTPCNodeVisitor)})},
  2060. args: [],
  2061. source: "currentNode\x0a\x09^ currentNode",
  2062. messageSends: [],
  2063. referencedClasses: []
  2064. }),
  2065. smalltalk.ASTPCNodeVisitor);
  2066. smalltalk.addMethod(
  2067. smalltalk.method({
  2068. selector: "increaseIndex",
  2069. category: 'accessing',
  2070. fn: function (){
  2071. var self=this;
  2072. return smalltalk.withContext(function($ctx1) {
  2073. self["@index"]=_st(self._index()).__plus((1));
  2074. return self}, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},smalltalk.ASTPCNodeVisitor)})},
  2075. args: [],
  2076. source: "increaseIndex\x0a\x09index := self index + 1",
  2077. messageSends: ["+", "index"],
  2078. referencedClasses: []
  2079. }),
  2080. smalltalk.ASTPCNodeVisitor);
  2081. smalltalk.addMethod(
  2082. smalltalk.method({
  2083. selector: "index",
  2084. category: 'accessing',
  2085. fn: function (){
  2086. var self=this;
  2087. return smalltalk.withContext(function($ctx1) {
  2088. var $2,$1;
  2089. $2=self["@index"];
  2090. if(($receiver = $2) == nil || $receiver == null){
  2091. self["@index"]=(0);
  2092. $1=self["@index"];
  2093. } else {
  2094. $1=$2;
  2095. };
  2096. return $1;
  2097. }, function($ctx1) {$ctx1.fill(self,"index",{},smalltalk.ASTPCNodeVisitor)})},
  2098. args: [],
  2099. source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
  2100. messageSends: ["ifNil:"],
  2101. referencedClasses: []
  2102. }),
  2103. smalltalk.ASTPCNodeVisitor);
  2104. smalltalk.addMethod(
  2105. smalltalk.method({
  2106. selector: "selector",
  2107. category: 'accessing',
  2108. fn: function (){
  2109. var self=this;
  2110. return smalltalk.withContext(function($ctx1) {
  2111. var $1;
  2112. $1=self["@selector"];
  2113. return $1;
  2114. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.ASTPCNodeVisitor)})},
  2115. args: [],
  2116. source: "selector\x0a\x09^ selector",
  2117. messageSends: [],
  2118. referencedClasses: []
  2119. }),
  2120. smalltalk.ASTPCNodeVisitor);
  2121. smalltalk.addMethod(
  2122. smalltalk.method({
  2123. selector: "selector:",
  2124. category: 'accessing',
  2125. fn: function (aString){
  2126. var self=this;
  2127. return smalltalk.withContext(function($ctx1) {
  2128. self["@selector"]=aString;
  2129. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.ASTPCNodeVisitor)})},
  2130. args: ["aString"],
  2131. source: "selector: aString\x0a\x09selector := aString",
  2132. messageSends: [],
  2133. referencedClasses: []
  2134. }),
  2135. smalltalk.ASTPCNodeVisitor);
  2136. smalltalk.addMethod(
  2137. smalltalk.method({
  2138. selector: "visitJSStatementNode:",
  2139. category: 'visiting',
  2140. fn: function (aNode){
  2141. var self=this;
  2142. return smalltalk.withContext(function($ctx1) {
  2143. self["@currentNode"]=aNode;
  2144. return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.ASTPCNodeVisitor)})},
  2145. args: ["aNode"],
  2146. 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",
  2147. messageSends: [],
  2148. referencedClasses: []
  2149. }),
  2150. smalltalk.ASTPCNodeVisitor);
  2151. smalltalk.addMethod(
  2152. smalltalk.method({
  2153. selector: "visitSendNode:",
  2154. category: 'visiting',
  2155. fn: function (aNode){
  2156. var self=this;
  2157. var sendIndex;
  2158. return smalltalk.withContext(function($ctx1) {
  2159. var $1,$2,$4,$5,$3,$7,$6,$9,$8;
  2160. $1=self._context();
  2161. $2=self._selector();
  2162. $ctx1.sendIdx["selector"]=1;
  2163. sendIndex=_st($1)._sendIndexAt_($2);
  2164. smalltalk.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
  2165. $4=self._selector();
  2166. $ctx1.sendIdx["selector"]=2;
  2167. $5=_st(aNode)._selector();
  2168. $3=_st($4).__eq($5);
  2169. if(smalltalk.assert($3)){
  2170. $7=self._index();
  2171. $ctx1.sendIdx["index"]=1;
  2172. $6=_st($7).__lt(sendIndex);
  2173. if(! smalltalk.assert($6)){
  2174. $9=self._index();
  2175. $8=_st($9).__gt(sendIndex);
  2176. if(! smalltalk.assert($8)){
  2177. self["@currentNode"]=aNode;
  2178. self["@currentNode"];
  2179. };
  2180. };
  2181. self._increaseIndex();
  2182. };
  2183. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},smalltalk.ASTPCNodeVisitor)})},
  2184. args: ["aNode"],
  2185. 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 ]",
  2186. messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "ifFalse:", "<", "index", ">", "increaseIndex"],
  2187. referencedClasses: []
  2188. }),
  2189. smalltalk.ASTPCNodeVisitor);
  2190. smalltalk.addMethod(
  2191. smalltalk.method({
  2192. selector: "isSteppingNode",
  2193. category: '*Compiler-Interpreter',
  2194. fn: function (){
  2195. var self=this;
  2196. return smalltalk.withContext(function($ctx1) {
  2197. return false;
  2198. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.Node)})},
  2199. args: [],
  2200. source: "isSteppingNode\x0a\x09^ false",
  2201. messageSends: [],
  2202. referencedClasses: []
  2203. }),
  2204. smalltalk.Node);
  2205. smalltalk.addMethod(
  2206. smalltalk.method({
  2207. selector: "isSteppingNode",
  2208. category: '*Compiler-Interpreter',
  2209. fn: function (){
  2210. var self=this;
  2211. return smalltalk.withContext(function($ctx1) {
  2212. return true;
  2213. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.AssignmentNode)})},
  2214. args: [],
  2215. source: "isSteppingNode\x0a\x09^ true",
  2216. messageSends: [],
  2217. referencedClasses: []
  2218. }),
  2219. smalltalk.AssignmentNode);
  2220. smalltalk.addMethod(
  2221. smalltalk.method({
  2222. selector: "isSteppingNode",
  2223. category: '*Compiler-Interpreter',
  2224. fn: function (){
  2225. var self=this;
  2226. return smalltalk.withContext(function($ctx1) {
  2227. return true;
  2228. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.BlockNode)})},
  2229. args: [],
  2230. source: "isSteppingNode\x0a\x09^ true",
  2231. messageSends: [],
  2232. referencedClasses: []
  2233. }),
  2234. smalltalk.BlockNode);
  2235. smalltalk.addMethod(
  2236. smalltalk.method({
  2237. selector: "isSteppingNode",
  2238. category: '*Compiler-Interpreter',
  2239. fn: function (){
  2240. var self=this;
  2241. return smalltalk.withContext(function($ctx1) {
  2242. return true;
  2243. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicArrayNode)})},
  2244. args: [],
  2245. source: "isSteppingNode\x0a\x09^ true",
  2246. messageSends: [],
  2247. referencedClasses: []
  2248. }),
  2249. smalltalk.DynamicArrayNode);
  2250. smalltalk.addMethod(
  2251. smalltalk.method({
  2252. selector: "isSteppingNode",
  2253. category: '*Compiler-Interpreter',
  2254. fn: function (){
  2255. var self=this;
  2256. return smalltalk.withContext(function($ctx1) {
  2257. return true;
  2258. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicDictionaryNode)})},
  2259. args: [],
  2260. source: "isSteppingNode\x0a\x09^ true",
  2261. messageSends: [],
  2262. referencedClasses: []
  2263. }),
  2264. smalltalk.DynamicDictionaryNode);
  2265. smalltalk.addMethod(
  2266. smalltalk.method({
  2267. selector: "isSteppingNode",
  2268. category: '*Compiler-Interpreter',
  2269. fn: function (){
  2270. var self=this;
  2271. return smalltalk.withContext(function($ctx1) {
  2272. return true;
  2273. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.JSStatementNode)})},
  2274. args: [],
  2275. source: "isSteppingNode\x0a\x09^ true",
  2276. messageSends: [],
  2277. referencedClasses: []
  2278. }),
  2279. smalltalk.JSStatementNode);
  2280. smalltalk.addMethod(
  2281. smalltalk.method({
  2282. selector: "isSteppingNode",
  2283. category: '*Compiler-Interpreter',
  2284. fn: function (){
  2285. var self=this;
  2286. return smalltalk.withContext(function($ctx1) {
  2287. return true;
  2288. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.SendNode)})},
  2289. args: [],
  2290. source: "isSteppingNode\x0a\x09^ true",
  2291. messageSends: [],
  2292. referencedClasses: []
  2293. }),
  2294. smalltalk.SendNode);
  2295. });