Compiler-Interpreter.js 84 KB

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