Compiler-Interpreter.js 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440
  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', '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._receiver_(_st(aMethodContext)._receiver());
  354. $1=self._selector_(_st(aMethodContext)._selector());
  355. $3=_st(aMethodContext)._outerContext();
  356. $ctx1.sendIdx["outerContext"]=1;
  357. if(($receiver = $3) == nil || $receiver == null){
  358. $2=$3;
  359. } else {
  360. var outer;
  361. outer=$receiver;
  362. $4=_st(outer)._methodContext();
  363. if(($receiver = $4) == nil || $receiver == null){
  364. $4;
  365. } else {
  366. $6=self._class();
  367. $7=_st(aMethodContext)._outerContext();
  368. $5=_st($6)._fromMethodContext_($7);
  369. self._outerContext_($5);
  370. };
  371. $8=_st(aMethodContext)._locals();
  372. $ctx1.sendIdx["locals"]=1;
  373. $2=_st($8)._keysAndValuesDo_((function(key,value){
  374. return smalltalk.withContext(function($ctx2) {
  375. $9=self._locals();
  376. return _st($9)._at_put_(key,value);
  377. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)})}));
  378. };
  379. return self}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext)})},
  380. args: ["aMethodContext"],
  381. source: "initializeFromMethodContext: aMethodContext\x0a\x0a\x09self\x0a\x09\x09index: aMethodContext index;\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 ] ]",
  382. messageSends: ["index:", "index", "receiver:", "receiver", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"],
  383. referencedClasses: []
  384. }),
  385. smalltalk.AIContext);
  386. smalltalk.addMethod(
  387. smalltalk.method({
  388. selector: "initializeInterpreter",
  389. category: 'initialization',
  390. fn: function (){
  391. var self=this;
  392. function $ASTInterpreter(){return smalltalk.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  393. return smalltalk.withContext(function($ctx1) {
  394. var $1,$2,$5,$4,$7,$6,$3;
  395. $1=_st($ASTInterpreter())._new();
  396. _st($1)._context_(self);
  397. _st($1)._node_(self._retrieveNode());
  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\x09node: self retrieveNode;\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", "node:", "retrieveNode", "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: "retrieveNode",
  715. category: 'interpreting',
  716. fn: function (){
  717. var self=this;
  718. function $ASTPCNodeVisitor(){return smalltalk.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  719. return smalltalk.withContext(function($ctx1) {
  720. var $2,$3,$4,$5,$6,$1;
  721. $2=self._ast();
  722. $ctx1.sendIdx["ast"]=1;
  723. if(($receiver = $2) == nil || $receiver == null){
  724. $1=$2;
  725. } else {
  726. $3=_st($ASTPCNodeVisitor())._new();
  727. _st($3)._context_(self);
  728. $4=$3;
  729. $5=self._ast();
  730. _st($4)._visit_($5);
  731. $6=_st($3)._currentNode();
  732. $1=$6;
  733. };
  734. return $1;
  735. }, function($ctx1) {$ctx1.fill(self,"retrieveNode",{},smalltalk.AIContext)})},
  736. args: [],
  737. source: "retrieveNode\x0a\x09^ self ast ifNotNil: [\x0a\x09\x09ASTPCNodeVisitor new\x0a\x09\x09\x09context: self;\x0a\x09\x09\x09visit: self ast;\x0a\x09\x09\x09currentNode ]",
  738. messageSends: ["ifNotNil:", "ast", "context:", "new", "visit:", "currentNode"],
  739. referencedClasses: ["ASTPCNodeVisitor"]
  740. }),
  741. smalltalk.AIContext);
  742. smalltalk.addMethod(
  743. smalltalk.method({
  744. selector: "selector",
  745. category: 'accessing',
  746. fn: function (){
  747. var self=this;
  748. return smalltalk.withContext(function($ctx1) {
  749. var $1;
  750. $1=self["@selector"];
  751. return $1;
  752. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.AIContext)})},
  753. args: [],
  754. source: "selector\x0a\x09^ selector",
  755. messageSends: [],
  756. referencedClasses: []
  757. }),
  758. smalltalk.AIContext);
  759. smalltalk.addMethod(
  760. smalltalk.method({
  761. selector: "selector:",
  762. category: 'accessing',
  763. fn: function (aString){
  764. var self=this;
  765. return smalltalk.withContext(function($ctx1) {
  766. self["@selector"]=aString;
  767. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.AIContext)})},
  768. args: ["aString"],
  769. source: "selector: aString\x0a\x09selector := aString",
  770. messageSends: [],
  771. referencedClasses: []
  772. }),
  773. smalltalk.AIContext);
  774. smalltalk.addMethod(
  775. smalltalk.method({
  776. selector: "setupInterpreter:",
  777. category: 'interpreting',
  778. fn: function (anInterpreter){
  779. var self=this;
  780. return smalltalk.withContext(function($ctx1) {
  781. var $3,$2,$1,$5,$7,$6,$4;
  782. $3=self._innerContext();
  783. $ctx1.sendIdx["innerContext"]=1;
  784. $2=_st($3)._arguments();
  785. $1=_st($2)._reversed();
  786. _st($1)._do_((function(each){
  787. return smalltalk.withContext(function($ctx2) {
  788. return _st(anInterpreter)._push_(each);
  789. $ctx2.sendIdx["push:"]=1;
  790. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  791. $5=anInterpreter;
  792. $7=self._innerContext();
  793. $6=_st($7)._receiver();
  794. $4=_st($5)._push_($6);
  795. return self}, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter},smalltalk.AIContext)})},
  796. args: ["anInterpreter"],
  797. source: "setupInterpreter: anInterpreter\x0a\x09\x22Push the send args and receiver to the interpreter stack\x22\x0a\x09\x0a\x09self innerContext arguments reversed do: [ :each | \x0a\x09\x09anInterpreter push: each ].\x0a\x09\x09\x0a\x09anInterpreter push: (self innerContext receiver)",
  798. messageSends: ["do:", "reversed", "arguments", "innerContext", "push:", "receiver"],
  799. referencedClasses: []
  800. }),
  801. smalltalk.AIContext);
  802. smalltalk.addMethod(
  803. smalltalk.method({
  804. selector: "fromMethodContext:",
  805. category: 'instance creation',
  806. fn: function (aMethodContext){
  807. var self=this;
  808. return smalltalk.withContext(function($ctx1) {
  809. var $2,$3,$1;
  810. $2=self._new();
  811. _st($2)._initializeFromMethodContext_(aMethodContext);
  812. $3=_st($2)._yourself();
  813. $1=$3;
  814. return $1;
  815. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext.klass)})},
  816. args: ["aMethodContext"],
  817. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  818. messageSends: ["initializeFromMethodContext:", "new", "yourself"],
  819. referencedClasses: []
  820. }),
  821. smalltalk.AIContext.klass);
  822. smalltalk.addClass('ASTDebugger', smalltalk.Object, ['interpreter', 'context'], 'Compiler-Interpreter');
  823. 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.";
  824. smalltalk.addMethod(
  825. smalltalk.method({
  826. selector: "atEnd",
  827. category: 'testing',
  828. fn: function (){
  829. var self=this;
  830. return smalltalk.withContext(function($ctx1) {
  831. var $1;
  832. $1=_st(self._interpreter())._atEnd();
  833. return $1;
  834. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTDebugger)})},
  835. args: [],
  836. source: "atEnd\x0a\x09^ self interpreter atEnd",
  837. messageSends: ["atEnd", "interpreter"],
  838. referencedClasses: []
  839. }),
  840. smalltalk.ASTDebugger);
  841. smalltalk.addMethod(
  842. smalltalk.method({
  843. selector: "buildAST",
  844. category: 'initialization',
  845. fn: function (){
  846. var self=this;
  847. var ast;
  848. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  849. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  850. return smalltalk.withContext(function($ctx1) {
  851. var $1;
  852. ast=_st(_st($Smalltalk())._current())._parse_(_st(self._method())._source());
  853. _st(_st($SemanticAnalyzer())._on_(_st(_st(self._context())._receiver())._class()))._visit_(ast);
  854. $1=ast;
  855. return $1;
  856. }, function($ctx1) {$ctx1.fill(self,"buildAST",{ast:ast},smalltalk.ASTDebugger)})},
  857. args: [],
  858. 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",
  859. messageSends: ["parse:", "current", "source", "method", "visit:", "on:", "class", "receiver", "context"],
  860. referencedClasses: ["Smalltalk", "SemanticAnalyzer"]
  861. }),
  862. smalltalk.ASTDebugger);
  863. smalltalk.addMethod(
  864. smalltalk.method({
  865. selector: "context",
  866. category: 'accessing',
  867. fn: function (){
  868. var self=this;
  869. return smalltalk.withContext(function($ctx1) {
  870. var $1;
  871. $1=self["@context"];
  872. return $1;
  873. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTDebugger)})},
  874. args: [],
  875. source: "context\x0a\x09^ context",
  876. messageSends: [],
  877. referencedClasses: []
  878. }),
  879. smalltalk.ASTDebugger);
  880. smalltalk.addMethod(
  881. smalltalk.method({
  882. selector: "context:",
  883. category: 'accessing',
  884. fn: function (aContext){
  885. var self=this;
  886. return smalltalk.withContext(function($ctx1) {
  887. self["@context"]=aContext;
  888. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTDebugger)})},
  889. args: ["aContext"],
  890. source: "context: aContext\x0a\x09context := aContext",
  891. messageSends: [],
  892. referencedClasses: []
  893. }),
  894. smalltalk.ASTDebugger);
  895. smalltalk.addMethod(
  896. smalltalk.method({
  897. selector: "defaultInterpreterClass",
  898. category: 'defaults',
  899. fn: function (){
  900. var self=this;
  901. function $ASTInterpreter(){return smalltalk.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  902. return smalltalk.withContext(function($ctx1) {
  903. var $1;
  904. $1=$ASTInterpreter();
  905. return $1;
  906. }, function($ctx1) {$ctx1.fill(self,"defaultInterpreterClass",{},smalltalk.ASTDebugger)})},
  907. args: [],
  908. source: "defaultInterpreterClass\x0a\x09^ ASTInterpreter",
  909. messageSends: [],
  910. referencedClasses: ["ASTInterpreter"]
  911. }),
  912. smalltalk.ASTDebugger);
  913. smalltalk.addMethod(
  914. smalltalk.method({
  915. selector: "initializeInterpreter",
  916. category: 'initialization',
  917. fn: function (){
  918. var self=this;
  919. var ast,next;
  920. function $ASTPCNodeVisitor(){return smalltalk.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  921. return smalltalk.withContext(function($ctx1) {
  922. var $1,$2;
  923. ast=self._buildAST();
  924. $1=_st($ASTPCNodeVisitor())._new();
  925. _st($1)._context_(self._context());
  926. _st($1)._visit_(ast);
  927. $2=_st($1)._currentNode();
  928. next=$2;
  929. _st(self._interpreter())._node_(next);
  930. return self}, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{ast:ast,next:next},smalltalk.ASTDebugger)})},
  931. args: [],
  932. 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",
  933. messageSends: ["buildAST", "context:", "new", "context", "visit:", "currentNode", "node:", "interpreter"],
  934. referencedClasses: ["ASTPCNodeVisitor"]
  935. }),
  936. smalltalk.ASTDebugger);
  937. smalltalk.addMethod(
  938. smalltalk.method({
  939. selector: "initializeWithContext:",
  940. category: 'initialization',
  941. fn: function (aContext){
  942. var self=this;
  943. return smalltalk.withContext(function($ctx1) {
  944. self._context_(aContext);
  945. self._initializeInterpreter();
  946. return self}, function($ctx1) {$ctx1.fill(self,"initializeWithContext:",{aContext:aContext},smalltalk.ASTDebugger)})},
  947. args: ["aContext"],
  948. source: "initializeWithContext: aContext\x0a\x09\x22TODO: do we need to handle block contexts?\x22\x0a\x09\x0a\x09self context: aContext.\x0a\x09self initializeInterpreter",
  949. messageSends: ["context:", "initializeInterpreter"],
  950. referencedClasses: []
  951. }),
  952. smalltalk.ASTDebugger);
  953. smalltalk.addMethod(
  954. smalltalk.method({
  955. selector: "interpreter",
  956. category: 'accessing',
  957. fn: function (){
  958. var self=this;
  959. return smalltalk.withContext(function($ctx1) {
  960. var $2,$1;
  961. $2=self["@interpreter"];
  962. if(($receiver = $2) == nil || $receiver == null){
  963. self["@interpreter"]=_st(self._defaultInterpreterClass())._new();
  964. $1=self["@interpreter"];
  965. } else {
  966. $1=$2;
  967. };
  968. return $1;
  969. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.ASTDebugger)})},
  970. args: [],
  971. source: "interpreter\x0a\x09^ interpreter ifNil: [ interpreter := self defaultInterpreterClass new ]",
  972. messageSends: ["ifNil:", "new", "defaultInterpreterClass"],
  973. referencedClasses: []
  974. }),
  975. smalltalk.ASTDebugger);
  976. smalltalk.addMethod(
  977. smalltalk.method({
  978. selector: "interpreter:",
  979. category: 'accessing',
  980. fn: function (anInterpreter){
  981. var self=this;
  982. return smalltalk.withContext(function($ctx1) {
  983. self["@interpreter"]=anInterpreter;
  984. return self}, function($ctx1) {$ctx1.fill(self,"interpreter:",{anInterpreter:anInterpreter},smalltalk.ASTDebugger)})},
  985. args: ["anInterpreter"],
  986. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  987. messageSends: [],
  988. referencedClasses: []
  989. }),
  990. smalltalk.ASTDebugger);
  991. smalltalk.addMethod(
  992. smalltalk.method({
  993. selector: "method",
  994. category: 'accessing',
  995. fn: function (){
  996. var self=this;
  997. return smalltalk.withContext(function($ctx1) {
  998. var $1;
  999. $1=_st(self._context())._method();
  1000. return $1;
  1001. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.ASTDebugger)})},
  1002. args: [],
  1003. source: "method\x0a\x09^ self context method",
  1004. messageSends: ["method", "context"],
  1005. referencedClasses: []
  1006. }),
  1007. smalltalk.ASTDebugger);
  1008. smalltalk.addMethod(
  1009. smalltalk.method({
  1010. selector: "nextNode",
  1011. category: 'accessing',
  1012. fn: function (){
  1013. var self=this;
  1014. return smalltalk.withContext(function($ctx1) {
  1015. var $1;
  1016. $1=_st(self._interpreter())._nextNode();
  1017. return $1;
  1018. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.ASTDebugger)})},
  1019. args: [],
  1020. source: "nextNode\x0a\x09^ self interpreter nextNode",
  1021. messageSends: ["nextNode", "interpreter"],
  1022. referencedClasses: []
  1023. }),
  1024. smalltalk.ASTDebugger);
  1025. smalltalk.addMethod(
  1026. smalltalk.method({
  1027. selector: "proceed",
  1028. category: 'stepping',
  1029. fn: function (){
  1030. var self=this;
  1031. return smalltalk.withContext(function($ctx1) {
  1032. self._shouldBeImplemented();
  1033. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.ASTDebugger)})},
  1034. args: [],
  1035. source: "proceed\x0a\x09self shouldBeImplemented",
  1036. messageSends: ["shouldBeImplemented"],
  1037. referencedClasses: []
  1038. }),
  1039. smalltalk.ASTDebugger);
  1040. smalltalk.addMethod(
  1041. smalltalk.method({
  1042. selector: "restart",
  1043. category: 'stepping',
  1044. fn: function (){
  1045. var self=this;
  1046. return smalltalk.withContext(function($ctx1) {
  1047. _st(self._interpreter())._restart();
  1048. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},smalltalk.ASTDebugger)})},
  1049. args: [],
  1050. source: "restart\x0a\x09self interpreter restart",
  1051. messageSends: ["restart", "interpreter"],
  1052. referencedClasses: []
  1053. }),
  1054. smalltalk.ASTDebugger);
  1055. smalltalk.addMethod(
  1056. smalltalk.method({
  1057. selector: "stepInto",
  1058. category: 'stepping',
  1059. fn: function (){
  1060. var self=this;
  1061. return smalltalk.withContext(function($ctx1) {
  1062. self._shouldBeImplemented();
  1063. return self}, function($ctx1) {$ctx1.fill(self,"stepInto",{},smalltalk.ASTDebugger)})},
  1064. args: [],
  1065. source: "stepInto\x0a\x09self shouldBeImplemented",
  1066. messageSends: ["shouldBeImplemented"],
  1067. referencedClasses: []
  1068. }),
  1069. smalltalk.ASTDebugger);
  1070. smalltalk.addMethod(
  1071. smalltalk.method({
  1072. selector: "stepOver",
  1073. category: 'stepping',
  1074. fn: function (){
  1075. var self=this;
  1076. return smalltalk.withContext(function($ctx1) {
  1077. _st(self._interpreter())._stepOver();
  1078. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},smalltalk.ASTDebugger)})},
  1079. args: [],
  1080. source: "stepOver\x0a\x09self interpreter stepOver",
  1081. messageSends: ["stepOver", "interpreter"],
  1082. referencedClasses: []
  1083. }),
  1084. smalltalk.ASTDebugger);
  1085. smalltalk.addMethod(
  1086. smalltalk.method({
  1087. selector: "context:",
  1088. category: 'instance creation',
  1089. fn: function (aContext){
  1090. var self=this;
  1091. return smalltalk.withContext(function($ctx1) {
  1092. var $2,$3,$1;
  1093. $2=self._new();
  1094. _st($2)._initializeWithContext_(aContext);
  1095. $3=_st($2)._yourself();
  1096. $1=$3;
  1097. return $1;
  1098. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTDebugger.klass)})},
  1099. args: ["aContext"],
  1100. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext;\x0a\x09\x09yourself",
  1101. messageSends: ["initializeWithContext:", "new", "yourself"],
  1102. referencedClasses: []
  1103. }),
  1104. smalltalk.ASTDebugger.klass);
  1105. smalltalk.addClass('ASTInterpreter', smalltalk.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned'], 'Compiler-Interpreter');
  1106. 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";
  1107. smalltalk.addMethod(
  1108. smalltalk.method({
  1109. selector: "assign:to:",
  1110. category: 'private',
  1111. fn: function (aNode,anObject){
  1112. var self=this;
  1113. return smalltalk.withContext(function($ctx1) {
  1114. var $1,$3,$2,$4,$5,$6;
  1115. $1=_st(_st(aNode)._binding())._isInstanceVar();
  1116. if(smalltalk.assert($1)){
  1117. $3=self._context();
  1118. $ctx1.sendIdx["context"]=1;
  1119. $2=_st($3)._receiver();
  1120. $4=_st(aNode)._value();
  1121. $ctx1.sendIdx["value"]=1;
  1122. _st($2)._instVarAt_put_($4,anObject);
  1123. } else {
  1124. $5=self._context();
  1125. $6=_st(aNode)._value();
  1126. _st($5)._localAt_put_($6,anObject);
  1127. };
  1128. return self}, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},smalltalk.ASTInterpreter)})},
  1129. args: ["aNode", "anObject"],
  1130. 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 ]",
  1131. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"],
  1132. referencedClasses: []
  1133. }),
  1134. smalltalk.ASTInterpreter);
  1135. smalltalk.addMethod(
  1136. smalltalk.method({
  1137. selector: "atEnd",
  1138. category: 'testing',
  1139. fn: function (){
  1140. var self=this;
  1141. return smalltalk.withContext(function($ctx1) {
  1142. var $1;
  1143. $1=_st(self._hasReturned())._or_((function(){
  1144. return smalltalk.withContext(function($ctx2) {
  1145. return _st(self._node())._isNil();
  1146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1147. return $1;
  1148. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTInterpreter)})},
  1149. args: [],
  1150. source: "atEnd\x0a\x09^ self hasReturned or: [ self node isNil ]",
  1151. messageSends: ["or:", "hasReturned", "isNil", "node"],
  1152. referencedClasses: []
  1153. }),
  1154. smalltalk.ASTInterpreter);
  1155. smalltalk.addMethod(
  1156. smalltalk.method({
  1157. selector: "context",
  1158. category: 'accessing',
  1159. fn: function (){
  1160. var self=this;
  1161. return smalltalk.withContext(function($ctx1) {
  1162. var $1;
  1163. $1=self["@context"];
  1164. return $1;
  1165. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTInterpreter)})},
  1166. args: [],
  1167. source: "context\x0a\x09^ context",
  1168. messageSends: [],
  1169. referencedClasses: []
  1170. }),
  1171. smalltalk.ASTInterpreter);
  1172. smalltalk.addMethod(
  1173. smalltalk.method({
  1174. selector: "context:",
  1175. category: 'accessing',
  1176. fn: function (aContext){
  1177. var self=this;
  1178. return smalltalk.withContext(function($ctx1) {
  1179. self["@context"]=aContext;
  1180. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTInterpreter)})},
  1181. args: ["aContext"],
  1182. source: "context: aContext\x0a\x09context := aContext",
  1183. messageSends: [],
  1184. referencedClasses: []
  1185. }),
  1186. smalltalk.ASTInterpreter);
  1187. smalltalk.addMethod(
  1188. smalltalk.method({
  1189. selector: "eval:",
  1190. category: 'private',
  1191. fn: function (aString){
  1192. var self=this;
  1193. var source,function_;
  1194. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1195. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  1196. return smalltalk.withContext(function($ctx1) {
  1197. var $3,$2,$1,$4,$5,$7,$10,$9,$8,$6;
  1198. source=_st($String())._streamContents_((function(str){
  1199. return smalltalk.withContext(function($ctx2) {
  1200. _st(str)._nextPutAll_("(function(");
  1201. $ctx2.sendIdx["nextPutAll:"]=1;
  1202. $3=self._context();
  1203. $ctx2.sendIdx["context"]=1;
  1204. $2=_st($3)._locals();
  1205. $ctx2.sendIdx["locals"]=1;
  1206. $1=_st($2)._keys();
  1207. _st($1)._do_separatedBy_((function(each){
  1208. return smalltalk.withContext(function($ctx3) {
  1209. return _st(str)._nextPutAll_(each);
  1210. $ctx3.sendIdx["nextPutAll:"]=2;
  1211. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  1212. return smalltalk.withContext(function($ctx3) {
  1213. return _st(str)._nextPutAll_(",");
  1214. $ctx3.sendIdx["nextPutAll:"]=3;
  1215. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  1216. $4=str;
  1217. _st($4)._nextPutAll_("){ return (function() {");
  1218. $ctx2.sendIdx["nextPutAll:"]=4;
  1219. _st($4)._nextPutAll_(aString);
  1220. $ctx2.sendIdx["nextPutAll:"]=5;
  1221. $5=_st($4)._nextPutAll_("})() })");
  1222. return $5;
  1223. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  1224. function_=_st(_st($Compiler())._new())._eval_(source);
  1225. $7=function_;
  1226. $10=self._context();
  1227. $9=_st($10)._locals();
  1228. $8=_st($9)._values();
  1229. $6=_st($7)._valueWithPossibleArguments_($8);
  1230. return $6;
  1231. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},smalltalk.ASTInterpreter)})},
  1232. args: ["aString"],
  1233. 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",
  1234. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"],
  1235. referencedClasses: ["String", "Compiler"]
  1236. }),
  1237. smalltalk.ASTInterpreter);
  1238. smalltalk.addMethod(
  1239. smalltalk.method({
  1240. selector: "hasReturned",
  1241. category: 'testing',
  1242. fn: function (){
  1243. var self=this;
  1244. return smalltalk.withContext(function($ctx1) {
  1245. var $2,$1;
  1246. $2=self["@returned"];
  1247. if(($receiver = $2) == nil || $receiver == null){
  1248. $1=false;
  1249. } else {
  1250. $1=$2;
  1251. };
  1252. return $1;
  1253. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},smalltalk.ASTInterpreter)})},
  1254. args: [],
  1255. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  1256. messageSends: ["ifNil:"],
  1257. referencedClasses: []
  1258. }),
  1259. smalltalk.ASTInterpreter);
  1260. smalltalk.addMethod(
  1261. smalltalk.method({
  1262. selector: "interpret",
  1263. category: 'interpreting',
  1264. fn: function (){
  1265. var self=this;
  1266. return smalltalk.withContext(function($ctx1) {
  1267. self._visit_(self._node());
  1268. return self}, function($ctx1) {$ctx1.fill(self,"interpret",{},smalltalk.ASTInterpreter)})},
  1269. args: [],
  1270. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  1271. messageSends: ["visit:", "node"],
  1272. referencedClasses: []
  1273. }),
  1274. smalltalk.ASTInterpreter);
  1275. smalltalk.addMethod(
  1276. smalltalk.method({
  1277. selector: "interpret:",
  1278. category: 'interpreting',
  1279. fn: function (aNode){
  1280. var self=this;
  1281. return smalltalk.withContext(function($ctx1) {
  1282. self._node_(aNode);
  1283. self._interpret();
  1284. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1285. args: ["aNode"],
  1286. source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret",
  1287. messageSends: ["node:", "interpret"],
  1288. referencedClasses: []
  1289. }),
  1290. smalltalk.ASTInterpreter);
  1291. smalltalk.addMethod(
  1292. smalltalk.method({
  1293. selector: "messageFromSendNode:arguments:",
  1294. category: 'private',
  1295. fn: function (aSendNode,aCollection){
  1296. var self=this;
  1297. function $Message(){return smalltalk.Message||(typeof Message=="undefined"?nil:Message)}
  1298. return smalltalk.withContext(function($ctx1) {
  1299. var $2,$3,$1;
  1300. $2=_st($Message())._new();
  1301. _st($2)._selector_(_st(aSendNode)._selector());
  1302. _st($2)._arguments_(aCollection);
  1303. $3=_st($2)._yourself();
  1304. $1=$3;
  1305. return $1;
  1306. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},smalltalk.ASTInterpreter)})},
  1307. args: ["aSendNode", "aCollection"],
  1308. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  1309. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"],
  1310. referencedClasses: ["Message"]
  1311. }),
  1312. smalltalk.ASTInterpreter);
  1313. smalltalk.addMethod(
  1314. smalltalk.method({
  1315. selector: "messageNotUnderstood:receiver:",
  1316. category: 'private',
  1317. fn: function (aMessage,anObject){
  1318. var self=this;
  1319. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1320. return smalltalk.withContext(function($ctx1) {
  1321. var $1,$2;
  1322. $1=_st($MessageNotUnderstood())._new();
  1323. _st($1)._meesage_(aMessage);
  1324. _st($1)._receiver_(anObject);
  1325. $2=_st($1)._signal();
  1326. return self}, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},smalltalk.ASTInterpreter)})},
  1327. args: ["aMessage", "anObject"],
  1328. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  1329. messageSends: ["meesage:", "new", "receiver:", "signal"],
  1330. referencedClasses: ["MessageNotUnderstood"]
  1331. }),
  1332. smalltalk.ASTInterpreter);
  1333. smalltalk.addMethod(
  1334. smalltalk.method({
  1335. selector: "next",
  1336. category: 'interpreting',
  1337. fn: function (){
  1338. var self=this;
  1339. return smalltalk.withContext(function($ctx1) {
  1340. self._node_(_st(self._node())._nextNode());
  1341. return self}, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.ASTInterpreter)})},
  1342. args: [],
  1343. source: "next\x0a\x09self node: self node nextNode",
  1344. messageSends: ["node:", "nextNode", "node"],
  1345. referencedClasses: []
  1346. }),
  1347. smalltalk.ASTInterpreter);
  1348. smalltalk.addMethod(
  1349. smalltalk.method({
  1350. selector: "node",
  1351. category: 'accessing',
  1352. fn: function (){
  1353. var self=this;
  1354. return smalltalk.withContext(function($ctx1) {
  1355. var $1;
  1356. $1=self["@node"];
  1357. return $1;
  1358. }, function($ctx1) {$ctx1.fill(self,"node",{},smalltalk.ASTInterpreter)})},
  1359. args: [],
  1360. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  1361. messageSends: [],
  1362. referencedClasses: []
  1363. }),
  1364. smalltalk.ASTInterpreter);
  1365. smalltalk.addMethod(
  1366. smalltalk.method({
  1367. selector: "node:",
  1368. category: 'accessing',
  1369. fn: function (aNode){
  1370. var self=this;
  1371. return smalltalk.withContext(function($ctx1) {
  1372. self["@node"]=aNode;
  1373. return self}, function($ctx1) {$ctx1.fill(self,"node:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1374. args: ["aNode"],
  1375. source: "node: aNode\x0a\x09node := aNode",
  1376. messageSends: [],
  1377. referencedClasses: []
  1378. }),
  1379. smalltalk.ASTInterpreter);
  1380. smalltalk.addMethod(
  1381. smalltalk.method({
  1382. selector: "peek",
  1383. category: 'stack',
  1384. fn: function (){
  1385. var self=this;
  1386. return smalltalk.withContext(function($ctx1) {
  1387. var $1,$3,$2;
  1388. var $early={};
  1389. try {
  1390. $1=self._stack();
  1391. $ctx1.sendIdx["stack"]=1;
  1392. _st($1)._ifEmpty_((function(){
  1393. return smalltalk.withContext(function($ctx2) {
  1394. throw $early=[nil];
  1395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1396. $3=self._stack();
  1397. $2=_st($3)._last();
  1398. return $2;
  1399. }
  1400. catch(e) {if(e===$early)return e[0]; throw e}
  1401. }, function($ctx1) {$ctx1.fill(self,"peek",{},smalltalk.ASTInterpreter)})},
  1402. args: [],
  1403. 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",
  1404. messageSends: ["ifEmpty:", "stack", "last"],
  1405. referencedClasses: []
  1406. }),
  1407. smalltalk.ASTInterpreter);
  1408. smalltalk.addMethod(
  1409. smalltalk.method({
  1410. selector: "pop",
  1411. category: 'stack',
  1412. fn: function (){
  1413. var self=this;
  1414. var peekedValue;
  1415. return smalltalk.withContext(function($ctx1) {
  1416. var $1;
  1417. peekedValue=self._peek();
  1418. _st(self._stack())._removeLast();
  1419. $1=peekedValue;
  1420. return $1;
  1421. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},smalltalk.ASTInterpreter)})},
  1422. args: [],
  1423. 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",
  1424. messageSends: ["peek", "removeLast", "stack"],
  1425. referencedClasses: []
  1426. }),
  1427. smalltalk.ASTInterpreter);
  1428. smalltalk.addMethod(
  1429. smalltalk.method({
  1430. selector: "proceed",
  1431. category: 'interpreting',
  1432. fn: function (){
  1433. var self=this;
  1434. return smalltalk.withContext(function($ctx1) {
  1435. _st((function(){
  1436. return smalltalk.withContext(function($ctx2) {
  1437. return self._atEnd();
  1438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  1439. return smalltalk.withContext(function($ctx2) {
  1440. return self._step();
  1441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1442. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.ASTInterpreter)})},
  1443. args: [],
  1444. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] whileFalse: [ \x0a\x09\x09self step ]",
  1445. messageSends: ["whileFalse:", "atEnd", "step"],
  1446. referencedClasses: []
  1447. }),
  1448. smalltalk.ASTInterpreter);
  1449. smalltalk.addMethod(
  1450. smalltalk.method({
  1451. selector: "push:",
  1452. category: 'stack',
  1453. fn: function (anObject){
  1454. var self=this;
  1455. return smalltalk.withContext(function($ctx1) {
  1456. var $1;
  1457. $1=_st(self._stack())._add_(anObject);
  1458. return $1;
  1459. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},smalltalk.ASTInterpreter)})},
  1460. args: ["anObject"],
  1461. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  1462. messageSends: ["add:", "stack"],
  1463. referencedClasses: []
  1464. }),
  1465. smalltalk.ASTInterpreter);
  1466. smalltalk.addMethod(
  1467. smalltalk.method({
  1468. selector: "restart",
  1469. category: 'interpreting',
  1470. fn: function (){
  1471. var self=this;
  1472. return smalltalk.withContext(function($ctx1) {
  1473. self._node_(_st(_st(self._context())._ast())._nextChild());
  1474. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},smalltalk.ASTInterpreter)})},
  1475. args: [],
  1476. source: "restart\x0a\x09self node: self context ast nextChild",
  1477. messageSends: ["node:", "nextChild", "ast", "context"],
  1478. referencedClasses: []
  1479. }),
  1480. smalltalk.ASTInterpreter);
  1481. smalltalk.addMethod(
  1482. smalltalk.method({
  1483. selector: "result",
  1484. category: 'accessing',
  1485. fn: function (){
  1486. var self=this;
  1487. return smalltalk.withContext(function($ctx1) {
  1488. var $2,$1;
  1489. $2=self._hasReturned();
  1490. if(smalltalk.assert($2)){
  1491. $1=self._returnValue();
  1492. } else {
  1493. $1=_st(self._context())._receiver();
  1494. };
  1495. return $1;
  1496. }, function($ctx1) {$ctx1.fill(self,"result",{},smalltalk.ASTInterpreter)})},
  1497. args: [],
  1498. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  1499. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"],
  1500. referencedClasses: []
  1501. }),
  1502. smalltalk.ASTInterpreter);
  1503. smalltalk.addMethod(
  1504. smalltalk.method({
  1505. selector: "returnValue",
  1506. category: 'accessing',
  1507. fn: function (){
  1508. var self=this;
  1509. return smalltalk.withContext(function($ctx1) {
  1510. var $1;
  1511. $1=self["@returnValue"];
  1512. return $1;
  1513. }, function($ctx1) {$ctx1.fill(self,"returnValue",{},smalltalk.ASTInterpreter)})},
  1514. args: [],
  1515. source: "returnValue\x0a\x09^ returnValue",
  1516. messageSends: [],
  1517. referencedClasses: []
  1518. }),
  1519. smalltalk.ASTInterpreter);
  1520. smalltalk.addMethod(
  1521. smalltalk.method({
  1522. selector: "returnValue:",
  1523. category: 'accessing',
  1524. fn: function (anObject){
  1525. var self=this;
  1526. return smalltalk.withContext(function($ctx1) {
  1527. self["@returnValue"]=anObject;
  1528. return self}, function($ctx1) {$ctx1.fill(self,"returnValue:",{anObject:anObject},smalltalk.ASTInterpreter)})},
  1529. args: ["anObject"],
  1530. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  1531. messageSends: [],
  1532. referencedClasses: []
  1533. }),
  1534. smalltalk.ASTInterpreter);
  1535. smalltalk.addMethod(
  1536. smalltalk.method({
  1537. selector: "sendMessage:to:superSend:",
  1538. category: 'private',
  1539. fn: function (aMessage,anObject,aBoolean){
  1540. var self=this;
  1541. var method;
  1542. return smalltalk.withContext(function($ctx1) {
  1543. var $1,$2,$4,$3,$5,$8,$7,$6,$9,$10;
  1544. var $early={};
  1545. try {
  1546. $1=aBoolean;
  1547. if(! smalltalk.assert($1)){
  1548. $2=_st(aMessage)._sendTo_(anObject);
  1549. return $2;
  1550. };
  1551. $4=_st(anObject)._class();
  1552. $ctx1.sendIdx["class"]=1;
  1553. $3=_st($4)._superclass();
  1554. $ctx1.sendIdx["superclass"]=1;
  1555. if(($receiver = $3) == nil || $receiver == null){
  1556. $5=self._messageNotUnderstood_receiver_(aMessage,anObject);
  1557. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  1558. return $5;
  1559. } else {
  1560. $3;
  1561. };
  1562. $8=_st(anObject)._class();
  1563. $7=_st($8)._superclass();
  1564. $6=_st($7)._methodDictionary();
  1565. method=_st($6)._at_ifAbsent_(_st(aMessage)._selector(),(function(){
  1566. return smalltalk.withContext(function($ctx2) {
  1567. $9=self._messageNotUnderstood_receiver_(aMessage,anObject);
  1568. throw $early=[$9];
  1569. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1570. $10=_st(method)._sendTo_arguments_(anObject,_st(aMessage)._arguments());
  1571. return $10;
  1572. }
  1573. catch(e) {if(e===$early)return e[0]; throw e}
  1574. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},smalltalk.ASTInterpreter)})},
  1575. args: ["aMessage", "anObject", "aBoolean"],
  1576. 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",
  1577. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"],
  1578. referencedClasses: []
  1579. }),
  1580. smalltalk.ASTInterpreter);
  1581. smalltalk.addMethod(
  1582. smalltalk.method({
  1583. selector: "setNonLocalReturnFromContext:",
  1584. category: 'interpreting',
  1585. fn: function (aContext){
  1586. var self=this;
  1587. return smalltalk.withContext(function($ctx1) {
  1588. var $2,$1,$4,$3;
  1589. $2=_st(aContext)._interpreter();
  1590. $ctx1.sendIdx["interpreter"]=1;
  1591. $1=_st($2)._hasReturned();
  1592. if(smalltalk.assert($1)){
  1593. self["@returned"]=true;
  1594. self["@returned"];
  1595. $4=_st(aContext)._interpreter();
  1596. $3=_st($4)._returnValue();
  1597. self._returnValue_($3);
  1598. };
  1599. return self}, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},smalltalk.ASTInterpreter)})},
  1600. args: ["aContext"],
  1601. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  1602. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"],
  1603. referencedClasses: []
  1604. }),
  1605. smalltalk.ASTInterpreter);
  1606. smalltalk.addMethod(
  1607. smalltalk.method({
  1608. selector: "skip",
  1609. category: 'interpreting',
  1610. fn: function (){
  1611. var self=this;
  1612. return smalltalk.withContext(function($ctx1) {
  1613. self._next();
  1614. return self}, function($ctx1) {$ctx1.fill(self,"skip",{},smalltalk.ASTInterpreter)})},
  1615. args: [],
  1616. source: "skip\x0a\x09self next",
  1617. messageSends: ["next"],
  1618. referencedClasses: []
  1619. }),
  1620. smalltalk.ASTInterpreter);
  1621. smalltalk.addMethod(
  1622. smalltalk.method({
  1623. selector: "stack",
  1624. category: 'accessing',
  1625. fn: function (){
  1626. var self=this;
  1627. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1628. return smalltalk.withContext(function($ctx1) {
  1629. var $2,$1;
  1630. $2=self["@stack"];
  1631. if(($receiver = $2) == nil || $receiver == null){
  1632. self["@stack"]=_st($OrderedCollection())._new();
  1633. $1=self["@stack"];
  1634. } else {
  1635. $1=$2;
  1636. };
  1637. return $1;
  1638. }, function($ctx1) {$ctx1.fill(self,"stack",{},smalltalk.ASTInterpreter)})},
  1639. args: [],
  1640. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  1641. messageSends: ["ifNil:", "new"],
  1642. referencedClasses: ["OrderedCollection"]
  1643. }),
  1644. smalltalk.ASTInterpreter);
  1645. smalltalk.addMethod(
  1646. smalltalk.method({
  1647. selector: "step",
  1648. category: 'interpreting',
  1649. fn: function (){
  1650. var self=this;
  1651. return smalltalk.withContext(function($ctx1) {
  1652. var $1;
  1653. self._interpret();
  1654. $1=self._next();
  1655. return self}, function($ctx1) {$ctx1.fill(self,"step",{},smalltalk.ASTInterpreter)})},
  1656. args: [],
  1657. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  1658. messageSends: ["interpret", "next"],
  1659. referencedClasses: []
  1660. }),
  1661. smalltalk.ASTInterpreter);
  1662. smalltalk.addMethod(
  1663. smalltalk.method({
  1664. selector: "stepOver",
  1665. category: 'interpreting',
  1666. fn: function (){
  1667. var self=this;
  1668. return smalltalk.withContext(function($ctx1) {
  1669. var $1;
  1670. $1=self._step();
  1671. $ctx1.sendIdx["step"]=1;
  1672. _st((function(){
  1673. return smalltalk.withContext(function($ctx2) {
  1674. return _st(self._node())._isSteppingNode();
  1675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  1676. return smalltalk.withContext(function($ctx2) {
  1677. return self._step();
  1678. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1679. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},smalltalk.ASTInterpreter)})},
  1680. args: [],
  1681. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isSteppingNode ] whileFalse: [ \x0a\x09\x09self step ]",
  1682. messageSends: ["step", "whileFalse:", "isSteppingNode", "node"],
  1683. referencedClasses: []
  1684. }),
  1685. smalltalk.ASTInterpreter);
  1686. smalltalk.addMethod(
  1687. smalltalk.method({
  1688. selector: "visit:",
  1689. category: 'visiting',
  1690. fn: function (aNode){
  1691. var self=this;
  1692. return smalltalk.withContext(function($ctx1) {
  1693. var $1;
  1694. $1=self._hasReturned();
  1695. if(! smalltalk.assert($1)){
  1696. smalltalk.ASTInterpreter.superclass.fn.prototype._visit_.apply(_st(self), [aNode]);
  1697. };
  1698. return self}, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1699. args: ["aNode"],
  1700. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  1701. messageSends: ["ifFalse:", "hasReturned", "visit:"],
  1702. referencedClasses: []
  1703. }),
  1704. smalltalk.ASTInterpreter);
  1705. smalltalk.addMethod(
  1706. smalltalk.method({
  1707. selector: "visitAssignmentNode:",
  1708. category: 'visiting',
  1709. fn: function (aNode){
  1710. var self=this;
  1711. var poppedValue;
  1712. return smalltalk.withContext(function($ctx1) {
  1713. var $1;
  1714. poppedValue=self._pop();
  1715. $ctx1.sendIdx["pop"]=1;
  1716. $1=self._pop();
  1717. self._push_(poppedValue);
  1718. self._assign_to_(_st(aNode)._left(),poppedValue);
  1719. return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},smalltalk.ASTInterpreter)})},
  1720. args: ["aNode"],
  1721. 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",
  1722. messageSends: ["pop", "push:", "assign:to:", "left"],
  1723. referencedClasses: []
  1724. }),
  1725. smalltalk.ASTInterpreter);
  1726. smalltalk.addMethod(
  1727. smalltalk.method({
  1728. selector: "visitBlockNode:",
  1729. category: 'visiting',
  1730. fn: function (aNode){
  1731. var self=this;
  1732. var block;
  1733. function $AIBlockClosure(){return smalltalk.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)}
  1734. return smalltalk.withContext(function($ctx1) {
  1735. block=_st($AIBlockClosure())._forContext_node_(self._context(),aNode);
  1736. self._push_(block);
  1737. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},smalltalk.ASTInterpreter)})},
  1738. args: ["aNode"],
  1739. 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",
  1740. messageSends: ["forContext:node:", "context", "push:"],
  1741. referencedClasses: ["AIBlockClosure"]
  1742. }),
  1743. smalltalk.ASTInterpreter);
  1744. smalltalk.addMethod(
  1745. smalltalk.method({
  1746. selector: "visitDynamicArrayNode:",
  1747. category: 'visiting',
  1748. fn: function (aNode){
  1749. var self=this;
  1750. var array;
  1751. return smalltalk.withContext(function($ctx1) {
  1752. array=[];
  1753. _st(_st(aNode)._nodes())._do_((function(each){
  1754. return smalltalk.withContext(function($ctx2) {
  1755. return _st(array)._addFirst_(self._pop());
  1756. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1757. self._push_(array);
  1758. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},smalltalk.ASTInterpreter)})},
  1759. args: ["aNode"],
  1760. 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",
  1761. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"],
  1762. referencedClasses: []
  1763. }),
  1764. smalltalk.ASTInterpreter);
  1765. smalltalk.addMethod(
  1766. smalltalk.method({
  1767. selector: "visitDynamicDictionaryNode:",
  1768. category: 'visiting',
  1769. fn: function (aNode){
  1770. var self=this;
  1771. var associations,hashedCollection;
  1772. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1773. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1774. return smalltalk.withContext(function($ctx1) {
  1775. var $1,$2;
  1776. associations=_st($OrderedCollection())._new();
  1777. $ctx1.sendIdx["new"]=1;
  1778. hashedCollection=_st($HashedCollection())._new();
  1779. $1=_st(_st(aNode)._nodes())._do_((function(each){
  1780. return smalltalk.withContext(function($ctx2) {
  1781. return _st(associations)._add_(self._pop());
  1782. $ctx2.sendIdx["add:"]=1;
  1783. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1784. $ctx1.sendIdx["do:"]=1;
  1785. $2=_st(_st(associations)._reversed())._do_((function(each){
  1786. return smalltalk.withContext(function($ctx2) {
  1787. return _st(hashedCollection)._add_(each);
  1788. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1789. self._push_(hashedCollection);
  1790. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,associations:associations,hashedCollection:hashedCollection},smalltalk.ASTInterpreter)})},
  1791. args: ["aNode"],
  1792. 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",
  1793. messageSends: ["new", "do:", "nodes", "add:", "pop", "reversed", "push:"],
  1794. referencedClasses: ["OrderedCollection", "HashedCollection"]
  1795. }),
  1796. smalltalk.ASTInterpreter);
  1797. smalltalk.addMethod(
  1798. smalltalk.method({
  1799. selector: "visitJSStatementNode:",
  1800. category: 'visiting',
  1801. fn: function (aNode){
  1802. var self=this;
  1803. return smalltalk.withContext(function($ctx1) {
  1804. self["@returned"]=true;
  1805. self._returnValue_(self._eval_(_st(aNode)._source()));
  1806. return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1807. args: ["aNode"],
  1808. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  1809. messageSends: ["returnValue:", "eval:", "source"],
  1810. referencedClasses: []
  1811. }),
  1812. smalltalk.ASTInterpreter);
  1813. smalltalk.addMethod(
  1814. smalltalk.method({
  1815. selector: "visitNode:",
  1816. category: 'visiting',
  1817. fn: function (aNode){
  1818. var self=this;
  1819. return smalltalk.withContext(function($ctx1) {
  1820. return self}, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1821. args: ["aNode"],
  1822. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  1823. messageSends: [],
  1824. referencedClasses: []
  1825. }),
  1826. smalltalk.ASTInterpreter);
  1827. smalltalk.addMethod(
  1828. smalltalk.method({
  1829. selector: "visitReturnNode:",
  1830. category: 'visiting',
  1831. fn: function (aNode){
  1832. var self=this;
  1833. return smalltalk.withContext(function($ctx1) {
  1834. self["@returned"]=true;
  1835. self._returnValue_(self._pop());
  1836. return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1837. args: ["aNode"],
  1838. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  1839. messageSends: ["returnValue:", "pop"],
  1840. referencedClasses: []
  1841. }),
  1842. smalltalk.ASTInterpreter);
  1843. smalltalk.addMethod(
  1844. smalltalk.method({
  1845. selector: "visitSendNode:",
  1846. category: 'visiting',
  1847. fn: function (aNode){
  1848. var self=this;
  1849. var receiver,args,message,result;
  1850. return smalltalk.withContext(function($ctx1) {
  1851. var $1;
  1852. args=_st(_st(aNode)._arguments())._collect_((function(each){
  1853. return smalltalk.withContext(function($ctx2) {
  1854. return self._pop();
  1855. $ctx2.sendIdx["pop"]=1;
  1856. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1857. receiver=self._pop();
  1858. message=self._messageFromSendNode_arguments_(aNode,_st(args)._reversed());
  1859. result=self._sendMessage_to_superSend_(message,receiver,_st(aNode)._superSend());
  1860. $1=_st(_st(aNode)._isCascadeSendNode())._and_((function(){
  1861. return smalltalk.withContext(function($ctx2) {
  1862. return _st(_st(aNode)._isLastChild())._not();
  1863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1864. if(smalltalk.assert($1)){
  1865. self._push_(receiver);
  1866. $ctx1.sendIdx["push:"]=1;
  1867. } else {
  1868. self._push_(result);
  1869. };
  1870. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},smalltalk.ASTInterpreter)})},
  1871. args: ["aNode"],
  1872. 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 ]",
  1873. messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"],
  1874. referencedClasses: []
  1875. }),
  1876. smalltalk.ASTInterpreter);
  1877. smalltalk.addMethod(
  1878. smalltalk.method({
  1879. selector: "visitValueNode:",
  1880. category: 'visiting',
  1881. fn: function (aNode){
  1882. var self=this;
  1883. return smalltalk.withContext(function($ctx1) {
  1884. self._push_(_st(aNode)._value());
  1885. return self}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1886. args: ["aNode"],
  1887. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  1888. messageSends: ["push:", "value"],
  1889. referencedClasses: []
  1890. }),
  1891. smalltalk.ASTInterpreter);
  1892. smalltalk.addMethod(
  1893. smalltalk.method({
  1894. selector: "visitVariableNode:",
  1895. category: 'visiting',
  1896. fn: function (aNode){
  1897. var self=this;
  1898. function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  1899. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1900. return smalltalk.withContext(function($ctx1) {
  1901. var $3,$2,$6,$7,$5,$4,$1,$11,$10,$13,$12,$14,$15,$16,$18,$17,$19,$20,$21,$22,$9,$8;
  1902. $3=_st(aNode)._binding();
  1903. $ctx1.sendIdx["binding"]=1;
  1904. $2=_st($3)._isUnknownVar();
  1905. if(smalltalk.assert($2)){
  1906. $6=_st($PlatformInterface())._globals();
  1907. $ctx1.sendIdx["globals"]=1;
  1908. $7=_st(aNode)._value();
  1909. $ctx1.sendIdx["value"]=1;
  1910. $5=_st($6)._at_ifAbsent_($7,(function(){
  1911. return smalltalk.withContext(function($ctx2) {
  1912. return self._error_("Unknown variable");
  1913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1914. $ctx1.sendIdx["at:ifAbsent:"]=1;
  1915. $4=self._push_($5);
  1916. $ctx1.sendIdx["push:"]=1;
  1917. return $4;
  1918. };
  1919. $11=_st(aNode)._binding();
  1920. $10=_st($11)._isInstanceVar();
  1921. if(smalltalk.assert($10)){
  1922. $13=self._context();
  1923. $ctx1.sendIdx["context"]=1;
  1924. $12=_st($13)._receiver();
  1925. $14=_st(aNode)._value();
  1926. $ctx1.sendIdx["value"]=2;
  1927. $9=_st($12)._instVarAt_($14);
  1928. } else {
  1929. $15=self._context();
  1930. $16=_st(aNode)._value();
  1931. $ctx1.sendIdx["value"]=3;
  1932. $9=_st($15)._localAt_ifAbsent_($16,(function(){
  1933. return smalltalk.withContext(function($ctx2) {
  1934. $18=_st(aNode)._value();
  1935. $ctx2.sendIdx["value"]=4;
  1936. $17=_st($18)._isCapitalized();
  1937. if(smalltalk.assert($17)){
  1938. $19=_st($Smalltalk())._current();
  1939. $20=_st(aNode)._value();
  1940. $ctx2.sendIdx["value"]=5;
  1941. return _st($19)._at_ifAbsent_($20,(function(){
  1942. return smalltalk.withContext(function($ctx3) {
  1943. $21=_st($PlatformInterface())._globals();
  1944. $22=_st(aNode)._value();
  1945. return _st($21)._at_($22);
  1946. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)})}));
  1947. };
  1948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1949. };
  1950. $8=self._push_($9);
  1951. return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1952. args: ["aNode"],
  1953. 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 ]]]])",
  1954. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "current", "at:"],
  1955. referencedClasses: ["PlatformInterface", "Smalltalk"]
  1956. }),
  1957. smalltalk.ASTInterpreter);
  1958. smalltalk.addClass('ASTInterpreterError', smalltalk.Error, [], 'Compiler-Interpreter');
  1959. smalltalk.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  1960. smalltalk.addClass('ASTPCNodeVisitor', smalltalk.NodeVisitor, ['useInlinings', 'pc', 'context', 'blockIndex', 'currentNode'], 'Compiler-Interpreter');
  1961. smalltalk.ASTPCNodeVisitor.comment="I visit an AST until I get to the current pc node and answer it.\x0a\x0a## API\x0a\x0aMy instances must be filled with a context object using `#context:`.\x0a\x0aAfter visiting the AST the current node corresponding to the `pc` is answered by `#currentNode`";
  1962. smalltalk.addMethod(
  1963. smalltalk.method({
  1964. selector: "blockIndex",
  1965. category: 'accessing',
  1966. fn: function (){
  1967. var self=this;
  1968. return smalltalk.withContext(function($ctx1) {
  1969. var $2,$1;
  1970. $2=self["@blockIndex"];
  1971. if(($receiver = $2) == nil || $receiver == null){
  1972. self["@blockIndex"]=(0);
  1973. $1=self["@blockIndex"];
  1974. } else {
  1975. $1=$2;
  1976. };
  1977. return $1;
  1978. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},smalltalk.ASTPCNodeVisitor)})},
  1979. args: [],
  1980. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ blockIndex := 0 ]",
  1981. messageSends: ["ifNil:"],
  1982. referencedClasses: []
  1983. }),
  1984. smalltalk.ASTPCNodeVisitor);
  1985. smalltalk.addMethod(
  1986. smalltalk.method({
  1987. selector: "context",
  1988. category: 'accessing',
  1989. fn: function (){
  1990. var self=this;
  1991. return smalltalk.withContext(function($ctx1) {
  1992. var $1;
  1993. $1=self["@context"];
  1994. return $1;
  1995. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTPCNodeVisitor)})},
  1996. args: [],
  1997. source: "context\x0a\x09^ context",
  1998. messageSends: [],
  1999. referencedClasses: []
  2000. }),
  2001. smalltalk.ASTPCNodeVisitor);
  2002. smalltalk.addMethod(
  2003. smalltalk.method({
  2004. selector: "context:",
  2005. category: 'accessing',
  2006. fn: function (aContext){
  2007. var self=this;
  2008. return smalltalk.withContext(function($ctx1) {
  2009. self["@context"]=aContext;
  2010. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTPCNodeVisitor)})},
  2011. args: ["aContext"],
  2012. source: "context: aContext\x0a\x09context := aContext",
  2013. messageSends: [],
  2014. referencedClasses: []
  2015. }),
  2016. smalltalk.ASTPCNodeVisitor);
  2017. smalltalk.addMethod(
  2018. smalltalk.method({
  2019. selector: "currentNode",
  2020. category: 'accessing',
  2021. fn: function (){
  2022. var self=this;
  2023. return smalltalk.withContext(function($ctx1) {
  2024. var $1;
  2025. $1=self["@currentNode"];
  2026. return $1;
  2027. }, function($ctx1) {$ctx1.fill(self,"currentNode",{},smalltalk.ASTPCNodeVisitor)})},
  2028. args: [],
  2029. source: "currentNode\x0a\x09^ currentNode",
  2030. messageSends: [],
  2031. referencedClasses: []
  2032. }),
  2033. smalltalk.ASTPCNodeVisitor);
  2034. smalltalk.addMethod(
  2035. smalltalk.method({
  2036. selector: "increaseBlockIndex",
  2037. category: 'accessing',
  2038. fn: function (){
  2039. var self=this;
  2040. return smalltalk.withContext(function($ctx1) {
  2041. self["@blockIndex"]=_st(self._blockIndex()).__plus((1));
  2042. return self}, function($ctx1) {$ctx1.fill(self,"increaseBlockIndex",{},smalltalk.ASTPCNodeVisitor)})},
  2043. args: [],
  2044. source: "increaseBlockIndex\x0a\x09blockIndex := self blockIndex + 1",
  2045. messageSends: ["+", "blockIndex"],
  2046. referencedClasses: []
  2047. }),
  2048. smalltalk.ASTPCNodeVisitor);
  2049. smalltalk.addMethod(
  2050. smalltalk.method({
  2051. selector: "pc",
  2052. category: 'accessing',
  2053. fn: function (){
  2054. var self=this;
  2055. return smalltalk.withContext(function($ctx1) {
  2056. var $2,$1;
  2057. $2=self["@pc"];
  2058. if(($receiver = $2) == nil || $receiver == null){
  2059. $1=(0);
  2060. } else {
  2061. $1=$2;
  2062. };
  2063. return $1;
  2064. }, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.ASTPCNodeVisitor)})},
  2065. args: [],
  2066. source: "pc\x0a\x09^ pc ifNil: [ 0 ]",
  2067. messageSends: ["ifNil:"],
  2068. referencedClasses: []
  2069. }),
  2070. smalltalk.ASTPCNodeVisitor);
  2071. smalltalk.addMethod(
  2072. smalltalk.method({
  2073. selector: "pc:",
  2074. category: 'accessing',
  2075. fn: function (anInteger){
  2076. var self=this;
  2077. return smalltalk.withContext(function($ctx1) {
  2078. self["@pc"]=anInteger;
  2079. return self}, function($ctx1) {$ctx1.fill(self,"pc:",{anInteger:anInteger},smalltalk.ASTPCNodeVisitor)})},
  2080. args: ["anInteger"],
  2081. source: "pc: anInteger\x0a\x09pc := anInteger",
  2082. messageSends: [],
  2083. referencedClasses: []
  2084. }),
  2085. smalltalk.ASTPCNodeVisitor);
  2086. smalltalk.addMethod(
  2087. smalltalk.method({
  2088. selector: "useInlinings",
  2089. category: 'accessing',
  2090. fn: function (){
  2091. var self=this;
  2092. return smalltalk.withContext(function($ctx1) {
  2093. var $2,$1;
  2094. $2=self["@useInlinings"];
  2095. if(($receiver = $2) == nil || $receiver == null){
  2096. $1=true;
  2097. } else {
  2098. $1=$2;
  2099. };
  2100. return $1;
  2101. }, function($ctx1) {$ctx1.fill(self,"useInlinings",{},smalltalk.ASTPCNodeVisitor)})},
  2102. args: [],
  2103. source: "useInlinings\x0a\x09^ useInlinings ifNil: [ true ]",
  2104. messageSends: ["ifNil:"],
  2105. referencedClasses: []
  2106. }),
  2107. smalltalk.ASTPCNodeVisitor);
  2108. smalltalk.addMethod(
  2109. smalltalk.method({
  2110. selector: "useInlinings:",
  2111. category: 'accessing',
  2112. fn: function (aBoolean){
  2113. var self=this;
  2114. return smalltalk.withContext(function($ctx1) {
  2115. self["@useInlinings"]=aBoolean;
  2116. return self}, function($ctx1) {$ctx1.fill(self,"useInlinings:",{aBoolean:aBoolean},smalltalk.ASTPCNodeVisitor)})},
  2117. args: ["aBoolean"],
  2118. source: "useInlinings: aBoolean\x0a\x09useInlinings := aBoolean",
  2119. messageSends: [],
  2120. referencedClasses: []
  2121. }),
  2122. smalltalk.ASTPCNodeVisitor);
  2123. smalltalk.addMethod(
  2124. smalltalk.method({
  2125. selector: "visitBlockNode:",
  2126. category: 'visiting',
  2127. fn: function (aNode){
  2128. var self=this;
  2129. return smalltalk.withContext(function($ctx1) {
  2130. var $3,$2,$4,$1,$5;
  2131. $3=_st(aNode)._parent();
  2132. $ctx1.sendIdx["parent"]=1;
  2133. $2=_st($3)._isSendNode();
  2134. $1=_st($2)._and_((function(){
  2135. return smalltalk.withContext(function($ctx2) {
  2136. $4=_st(aNode)._parent();
  2137. return _st($4)._shouldBeInlined();
  2138. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2139. if(smalltalk.assert($1)){
  2140. smalltalk.ASTPCNodeVisitor.superclass.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]);
  2141. } else {
  2142. $5=_st(self._blockIndex()).__gt_eq(_st(self._context())._index());
  2143. if(! smalltalk.assert($5)){
  2144. self._increaseBlockIndex();
  2145. smalltalk.ASTPCNodeVisitor.superclass.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]);
  2146. $ctx1.sendIdx["visitBlockNode:"]=1;
  2147. };
  2148. };
  2149. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},smalltalk.ASTPCNodeVisitor)})},
  2150. args: ["aNode"],
  2151. source: "visitBlockNode: aNode\x0a\x09\x22Inlined send node. Assume that the block is inlined\x22\x0a\x09(aNode parent isSendNode and: [ aNode parent shouldBeInlined ])\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self blockIndex >= self context index ifFalse: [\x0a\x09\x09\x09\x09self increaseBlockIndex.\x0a\x09\x09\x09\x09super visitBlockNode: aNode ] ]\x0a\x09\x09ifTrue: [ super visitBlockNode: aNode ]",
  2152. messageSends: ["ifFalse:ifTrue:", "and:", "isSendNode", "parent", "shouldBeInlined", "ifFalse:", ">=", "blockIndex", "index", "context", "increaseBlockIndex", "visitBlockNode:"],
  2153. referencedClasses: []
  2154. }),
  2155. smalltalk.ASTPCNodeVisitor);
  2156. smalltalk.addMethod(
  2157. smalltalk.method({
  2158. selector: "visitJSStatementNode:",
  2159. category: 'visiting',
  2160. fn: function (aNode){
  2161. var self=this;
  2162. return smalltalk.withContext(function($ctx1) {
  2163. self["@currentNode"]=aNode;
  2164. return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.ASTPCNodeVisitor)})},
  2165. args: ["aNode"],
  2166. source: "visitJSStatementNode: aNode\x0a\x09currentNode := aNode",
  2167. messageSends: [],
  2168. referencedClasses: []
  2169. }),
  2170. smalltalk.ASTPCNodeVisitor);
  2171. smalltalk.addMethod(
  2172. smalltalk.method({
  2173. selector: "visitSendNode:",
  2174. category: 'visiting',
  2175. fn: function (aNode){
  2176. var self=this;
  2177. return smalltalk.withContext(function($ctx1) {
  2178. var $3,$5,$4,$2,$6,$8,$10,$9,$7,$12,$11,$1;
  2179. smalltalk.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
  2180. $3=self._pc();
  2181. $ctx1.sendIdx["pc"]=1;
  2182. $5=self._context();
  2183. $ctx1.sendIdx["context"]=1;
  2184. $4=_st($5)._pc();
  2185. $ctx1.sendIdx["pc"]=2;
  2186. $2=_st($3).__eq($4);
  2187. $ctx1.sendIdx["="]=1;
  2188. if(! smalltalk.assert($2)){
  2189. $6=_st(aNode)._shouldBeInlined();
  2190. if(! smalltalk.assert($6)){
  2191. $8=self._blockIndex();
  2192. $10=self._context();
  2193. $9=_st($10)._index();
  2194. $7=_st($8).__eq($9);
  2195. if(smalltalk.assert($7)){
  2196. $12=self._pc();
  2197. $11=_st($12).__plus((1));
  2198. self._pc_($11);
  2199. self["@currentNode"]=aNode;
  2200. $1=self["@currentNode"];
  2201. };
  2202. };
  2203. };
  2204. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},smalltalk.ASTPCNodeVisitor)})},
  2205. args: ["aNode"],
  2206. source: "visitSendNode: aNode\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self pc = self context pc ifFalse: [\x0a\x09\x09aNode shouldBeInlined ifFalse: [\x0a\x09\x09\x09self blockIndex = self context index ifTrue: [\x0a\x09\x09\x09\x09self pc: self pc + 1.\x0a\x09\x09\x09\x09currentNode := aNode ] ] ]",
  2207. messageSends: ["visitSendNode:", "ifFalse:", "=", "pc", "context", "shouldBeInlined", "ifTrue:", "blockIndex", "index", "pc:", "+"],
  2208. referencedClasses: []
  2209. }),
  2210. smalltalk.ASTPCNodeVisitor);
  2211. smalltalk.addMethod(
  2212. smalltalk.method({
  2213. selector: "isSteppingNode",
  2214. category: '*Compiler-Interpreter',
  2215. fn: function (){
  2216. var self=this;
  2217. return smalltalk.withContext(function($ctx1) {
  2218. return false;
  2219. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.Node)})},
  2220. args: [],
  2221. source: "isSteppingNode\x0a\x09^ false",
  2222. messageSends: [],
  2223. referencedClasses: []
  2224. }),
  2225. smalltalk.Node);
  2226. smalltalk.addMethod(
  2227. smalltalk.method({
  2228. selector: "isSteppingNode",
  2229. category: '*Compiler-Interpreter',
  2230. fn: function (){
  2231. var self=this;
  2232. return smalltalk.withContext(function($ctx1) {
  2233. return true;
  2234. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.AssignmentNode)})},
  2235. args: [],
  2236. source: "isSteppingNode\x0a\x09^ true",
  2237. messageSends: [],
  2238. referencedClasses: []
  2239. }),
  2240. smalltalk.AssignmentNode);
  2241. smalltalk.addMethod(
  2242. smalltalk.method({
  2243. selector: "isSteppingNode",
  2244. category: '*Compiler-Interpreter',
  2245. fn: function (){
  2246. var self=this;
  2247. return smalltalk.withContext(function($ctx1) {
  2248. return true;
  2249. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.BlockNode)})},
  2250. args: [],
  2251. source: "isSteppingNode\x0a\x09^ true",
  2252. messageSends: [],
  2253. referencedClasses: []
  2254. }),
  2255. smalltalk.BlockNode);
  2256. smalltalk.addMethod(
  2257. smalltalk.method({
  2258. selector: "isSteppingNode",
  2259. category: '*Compiler-Interpreter',
  2260. fn: function (){
  2261. var self=this;
  2262. return smalltalk.withContext(function($ctx1) {
  2263. return true;
  2264. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicArrayNode)})},
  2265. args: [],
  2266. source: "isSteppingNode\x0a\x09^ true",
  2267. messageSends: [],
  2268. referencedClasses: []
  2269. }),
  2270. smalltalk.DynamicArrayNode);
  2271. smalltalk.addMethod(
  2272. smalltalk.method({
  2273. selector: "isSteppingNode",
  2274. category: '*Compiler-Interpreter',
  2275. fn: function (){
  2276. var self=this;
  2277. return smalltalk.withContext(function($ctx1) {
  2278. return true;
  2279. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicDictionaryNode)})},
  2280. args: [],
  2281. source: "isSteppingNode\x0a\x09^ true",
  2282. messageSends: [],
  2283. referencedClasses: []
  2284. }),
  2285. smalltalk.DynamicDictionaryNode);
  2286. smalltalk.addMethod(
  2287. smalltalk.method({
  2288. selector: "isSteppingNode",
  2289. category: '*Compiler-Interpreter',
  2290. fn: function (){
  2291. var self=this;
  2292. return smalltalk.withContext(function($ctx1) {
  2293. return true;
  2294. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.JSStatementNode)})},
  2295. args: [],
  2296. source: "isSteppingNode\x0a\x09^ true",
  2297. messageSends: [],
  2298. referencedClasses: []
  2299. }),
  2300. smalltalk.JSStatementNode);
  2301. smalltalk.addMethod(
  2302. smalltalk.method({
  2303. selector: "isSteppingNode",
  2304. category: '*Compiler-Interpreter',
  2305. fn: function (){
  2306. var self=this;
  2307. return smalltalk.withContext(function($ctx1) {
  2308. return true;
  2309. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.SendNode)})},
  2310. args: [],
  2311. source: "isSteppingNode\x0a\x09^ true",
  2312. messageSends: [],
  2313. referencedClasses: []
  2314. }),
  2315. smalltalk.SendNode);
  2316. });