Compiler-Interpreter.js 83 KB

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