Compiler-Interpreter.js 83 KB

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