1
0

Compiler-Interpreter.js 135 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588
  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/Kernel-Exceptions", "amber_core/Compiler-Core", "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 $AIInterpreterError(){return smalltalk.AIInterpreterError||(typeof AIInterpreterError=="undefined"?nil:AIInterpreterError)}
  74. return smalltalk.withContext(function($ctx1) {
  75. _st($AIInterpreterError())._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\x09AIInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  79. messageSends: ["signal:"],
  80. referencedClasses: ["AIInterpreterError"]
  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,$3,$4,$1;
  252. $2=self._isBlockContext();
  253. $3=(function(){
  254. return smalltalk.withContext(function($ctx2) {
  255. return _st("a block (in ".__comma(_st(self._methodContext())._asString())).__comma(")");
  256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  257. $4=(function(){
  258. return smalltalk.withContext(function($ctx2) {
  259. return _st(_st(_st(_st(self._receiver())._class())._name()).__comma(" >> ")).__comma(self._selector());
  260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})});
  261. $1=_st($2)._ifTrue_ifFalse_($3,$4);
  262. return $1;
  263. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.AIContext)})},
  264. args: [],
  265. source: "asString\x0a\x09^self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ self receiver class name, ' >> ', self selector ]",
  266. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "name", "class", "receiver", "selector"],
  267. referencedClasses: []
  268. }),
  269. smalltalk.AIContext);
  270. smalltalk.addMethod(
  271. smalltalk.method({
  272. selector: "ast",
  273. category: 'interpreting',
  274. fn: function (){
  275. var self=this;
  276. return smalltalk.withContext(function($ctx1) {
  277. var $1,$3,$2,$4,$5,$6;
  278. var $early={};
  279. try {
  280. $1=self._isBlockContext();
  281. $2=(function(){
  282. return smalltalk.withContext(function($ctx2) {
  283. $3=_st(self._outerContext())._ast();
  284. throw $early=[$3];
  285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  286. _st($1)._ifTrue_($2);
  287. $4=self["@ast"];
  288. $5=(function(){
  289. return smalltalk.withContext(function($ctx2) {
  290. return self._initializeAST();
  291. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})});
  292. _st($4)._ifNil_($5);
  293. $6=self["@ast"];
  294. return $6;
  295. }
  296. catch(e) {if(e===$early)return e[0]; throw e}
  297. }, function($ctx1) {$ctx1.fill(self,"ast",{},smalltalk.AIContext)})},
  298. args: [],
  299. source: "ast\x0a\x09self isBlockContext ifTrue: [ ^ self outerContext ast ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  300. messageSends: ["ifTrue:", "isBlockContext", "ast", "outerContext", "ifNil:", "initializeAST"],
  301. referencedClasses: []
  302. }),
  303. smalltalk.AIContext);
  304. smalltalk.addMethod(
  305. smalltalk.method({
  306. selector: "index",
  307. category: 'accessing',
  308. fn: function (){
  309. var self=this;
  310. return smalltalk.withContext(function($ctx1) {
  311. var $2,$3,$1;
  312. $2=self["@index"];
  313. $3=(function(){
  314. return smalltalk.withContext(function($ctx2) {
  315. return (0);
  316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  317. $1=_st($2)._ifNil_($3);
  318. return $1;
  319. }, function($ctx1) {$ctx1.fill(self,"index",{},smalltalk.AIContext)})},
  320. args: [],
  321. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  322. messageSends: ["ifNil:"],
  323. referencedClasses: []
  324. }),
  325. smalltalk.AIContext);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "index:",
  329. category: 'accessing',
  330. fn: function (anInteger){
  331. var self=this;
  332. return smalltalk.withContext(function($ctx1) {
  333. self["@index"]=anInteger;
  334. return self}, function($ctx1) {$ctx1.fill(self,"index:",{anInteger:anInteger},smalltalk.AIContext)})},
  335. args: ["anInteger"],
  336. source: "index: anInteger\x0a\x09index := anInteger",
  337. messageSends: [],
  338. referencedClasses: []
  339. }),
  340. smalltalk.AIContext);
  341. smalltalk.addMethod(
  342. smalltalk.method({
  343. selector: "initializeAST",
  344. category: 'initialization',
  345. fn: function (){
  346. var self=this;
  347. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  348. return smalltalk.withContext(function($ctx1) {
  349. self["@ast"]=_st(self._method())._ast();
  350. _st(_st($SemanticAnalyzer())._on_(_st(self._method())._methodClass()))._visit_(self["@ast"]);
  351. return self}, function($ctx1) {$ctx1.fill(self,"initializeAST",{},smalltalk.AIContext)})},
  352. args: [],
  353. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  354. messageSends: ["ast", "method", "visit:", "on:", "methodClass"],
  355. referencedClasses: ["SemanticAnalyzer"]
  356. }),
  357. smalltalk.AIContext);
  358. smalltalk.addMethod(
  359. smalltalk.method({
  360. selector: "initializeFromMethodContext:",
  361. category: 'initialization',
  362. fn: function (aMethodContext){
  363. var self=this;
  364. return smalltalk.withContext(function($ctx1) {
  365. var $1,$2,$3,$5,$6,$4;
  366. $1=self;
  367. _st($1)._pc_(_st(aMethodContext)._pc());
  368. _st($1)._index_(_st(aMethodContext)._index());
  369. _st($1)._receiver_(_st(aMethodContext)._receiver());
  370. $2=_st($1)._method_(_st(aMethodContext)._method());
  371. $3=_st(aMethodContext)._outerContext();
  372. $4=(function(outer){
  373. return smalltalk.withContext(function($ctx2) {
  374. $5=_st(outer)._methodContext();
  375. $6=(function(){
  376. return smalltalk.withContext(function($ctx3) {
  377. return self._outerContext_(_st(self._class())._fromMethodContext_(_st(aMethodContext)._outerContext()));
  378. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})});
  379. _st($5)._ifNotNil_($6);
  380. return _st(_st(aMethodContext)._locals())._keysAndValuesDo_((function(key,value){
  381. return smalltalk.withContext(function($ctx3) {
  382. return _st(self._locals())._at_put_(key,value);
  383. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,3)})}));
  384. }, function($ctx2) {$ctx2.fillBlock({outer:outer},$ctx1,1)})});
  385. _st($3)._ifNotNil_($4);
  386. return self}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext)})},
  387. args: ["aMethodContext"],
  388. 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 ] ]",
  389. messageSends: ["pc:", "pc", "index:", "index", "receiver:", "receiver", "method:", "method", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"],
  390. referencedClasses: []
  391. }),
  392. smalltalk.AIContext);
  393. smalltalk.addMethod(
  394. smalltalk.method({
  395. selector: "initializeInterpreter",
  396. category: 'initialization',
  397. fn: function (){
  398. var self=this;
  399. function $Interpreter(){return smalltalk.Interpreter||(typeof Interpreter=="undefined"?nil:Interpreter)}
  400. return smalltalk.withContext(function($ctx1) {
  401. var $1,$2,$3,$4,$5,$6;
  402. $1=_st($Interpreter())._new();
  403. _st($1)._context_(self);
  404. $2=_st($1)._yourself();
  405. self["@interpreter"]=$2;
  406. $3=self["@ast"];
  407. $4=(function(){
  408. return smalltalk.withContext(function($ctx2) {
  409. return _st(self["@interpreter"])._node_(self._retrieveNode());
  410. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  411. _st($3)._ifNotNil_($4);
  412. $5=_st(_st(self._innerContext())._notNil())._and_((function(){
  413. return smalltalk.withContext(function($ctx2) {
  414. return _st(_st(self._innerContext())._isBlockContext())._not();
  415. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  416. $6=(function(){
  417. return smalltalk.withContext(function($ctx2) {
  418. return self._setupInterpreter_(self["@interpreter"]);
  419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})});
  420. _st($5)._ifTrue_($6);
  421. return self}, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},smalltalk.AIContext)})},
  422. args: [],
  423. source: "initializeInterpreter\x0a\x09interpreter := Interpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09ast ifNotNil: [ interpreter node: self retrieveNode ].\x0a\x09\x0a\x09(self innerContext notNil and: [ \x0a\x09\x09self innerContext isBlockContext not ]) ifTrue: [\x0a\x09\x09\x09self setupInterpreter: interpreter ]",
  424. messageSends: ["context:", "new", "yourself", "ifNotNil:", "node:", "retrieveNode", "ifTrue:", "and:", "notNil", "innerContext", "not", "isBlockContext", "setupInterpreter:"],
  425. referencedClasses: ["Interpreter"]
  426. }),
  427. smalltalk.AIContext);
  428. smalltalk.addMethod(
  429. smalltalk.method({
  430. selector: "initializeLocals",
  431. category: 'initialization',
  432. fn: function (){
  433. var self=this;
  434. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  435. return smalltalk.withContext(function($ctx1) {
  436. self["@locals"]=_st($Dictionary())._new();
  437. _st(self["@locals"])._at_put_("thisContext",self);
  438. return self}, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},smalltalk.AIContext)})},
  439. args: [],
  440. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  441. messageSends: ["new", "at:put:"],
  442. referencedClasses: ["Dictionary"]
  443. }),
  444. smalltalk.AIContext);
  445. smalltalk.addMethod(
  446. smalltalk.method({
  447. selector: "innerContext",
  448. category: 'accessing',
  449. fn: function (){
  450. var self=this;
  451. return smalltalk.withContext(function($ctx1) {
  452. var $1;
  453. $1=self["@innerContext"];
  454. return $1;
  455. }, function($ctx1) {$ctx1.fill(self,"innerContext",{},smalltalk.AIContext)})},
  456. args: [],
  457. source: "innerContext\x0a\x09^ innerContext",
  458. messageSends: [],
  459. referencedClasses: []
  460. }),
  461. smalltalk.AIContext);
  462. smalltalk.addMethod(
  463. smalltalk.method({
  464. selector: "innerContext:",
  465. category: 'accessing',
  466. fn: function (anAIContext){
  467. var self=this;
  468. return smalltalk.withContext(function($ctx1) {
  469. self["@innerContext"]=anAIContext;
  470. return self}, function($ctx1) {$ctx1.fill(self,"innerContext:",{anAIContext:anAIContext},smalltalk.AIContext)})},
  471. args: ["anAIContext"],
  472. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  473. messageSends: [],
  474. referencedClasses: []
  475. }),
  476. smalltalk.AIContext);
  477. smalltalk.addMethod(
  478. smalltalk.method({
  479. selector: "interpreter",
  480. category: 'interpreting',
  481. fn: function (){
  482. var self=this;
  483. return smalltalk.withContext(function($ctx1) {
  484. var $1,$2,$3;
  485. $1=self["@interpreter"];
  486. $2=(function(){
  487. return smalltalk.withContext(function($ctx2) {
  488. return self._initializeInterpreter();
  489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  490. _st($1)._ifNil_($2);
  491. $3=self["@interpreter"];
  492. return $3;
  493. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.AIContext)})},
  494. args: [],
  495. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  496. messageSends: ["ifNil:", "initializeInterpreter"],
  497. referencedClasses: []
  498. }),
  499. smalltalk.AIContext);
  500. smalltalk.addMethod(
  501. smalltalk.method({
  502. selector: "interpreter:",
  503. category: 'interpreting',
  504. fn: function (anInterpreter){
  505. var self=this;
  506. return smalltalk.withContext(function($ctx1) {
  507. self["@interpreter"]=anInterpreter;
  508. return self}, function($ctx1) {$ctx1.fill(self,"interpreter:",{anInterpreter:anInterpreter},smalltalk.AIContext)})},
  509. args: ["anInterpreter"],
  510. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  511. messageSends: [],
  512. referencedClasses: []
  513. }),
  514. smalltalk.AIContext);
  515. smalltalk.addMethod(
  516. smalltalk.method({
  517. selector: "isBlockContext",
  518. category: 'testing',
  519. fn: function (){
  520. var self=this;
  521. return smalltalk.withContext(function($ctx1) {
  522. var $1;
  523. $1=_st(self._selector())._isNil();
  524. return $1;
  525. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},smalltalk.AIContext)})},
  526. args: [],
  527. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  528. messageSends: ["isNil", "selector"],
  529. referencedClasses: []
  530. }),
  531. smalltalk.AIContext);
  532. smalltalk.addMethod(
  533. smalltalk.method({
  534. selector: "localAt:",
  535. category: 'accessing',
  536. fn: function (aString){
  537. var self=this;
  538. return smalltalk.withContext(function($ctx1) {
  539. var $2,$3,$4,$1;
  540. $1=_st(self._locals())._at_ifAbsent_(aString,(function(){
  541. return smalltalk.withContext(function($ctx2) {
  542. $2=self._isBlockContext();
  543. $3=(function(){
  544. return smalltalk.withContext(function($ctx3) {
  545. return nil;
  546. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})});
  547. $4=(function(){
  548. return smalltalk.withContext(function($ctx3) {
  549. return _st(self._outerContext())._localAt_(aString);
  550. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})});
  551. return _st($2)._ifTrue_ifFalse_($3,$4);
  552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  553. return $1;
  554. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString},smalltalk.AIContext)})},
  555. args: ["aString"],
  556. 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 isBlockContext \x0a\x09\x09\x09ifTrue: [ nil ]\x0a\x09\x09\x09ifFalse: [ self outerContext localAt: aString ] ]",
  557. messageSends: ["at:ifAbsent:", "locals", "ifTrue:ifFalse:", "isBlockContext", "localAt:", "outerContext"],
  558. referencedClasses: []
  559. }),
  560. smalltalk.AIContext);
  561. smalltalk.addMethod(
  562. smalltalk.method({
  563. selector: "localAt:put:",
  564. category: 'accessing',
  565. fn: function (aString,anObject){
  566. var self=this;
  567. return smalltalk.withContext(function($ctx1) {
  568. _st(self._locals())._at_put_(aString,anObject);
  569. return self}, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject},smalltalk.AIContext)})},
  570. args: ["aString", "anObject"],
  571. source: "localAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  572. messageSends: ["at:put:", "locals"],
  573. referencedClasses: []
  574. }),
  575. smalltalk.AIContext);
  576. smalltalk.addMethod(
  577. smalltalk.method({
  578. selector: "locals",
  579. category: 'accessing',
  580. fn: function (){
  581. var self=this;
  582. return smalltalk.withContext(function($ctx1) {
  583. var $1,$2,$3;
  584. $1=self["@locals"];
  585. $2=(function(){
  586. return smalltalk.withContext(function($ctx2) {
  587. return self._initializeLocals();
  588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  589. _st($1)._ifNil_($2);
  590. $3=self["@locals"];
  591. return $3;
  592. }, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.AIContext)})},
  593. args: [],
  594. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  595. messageSends: ["ifNil:", "initializeLocals"],
  596. referencedClasses: []
  597. }),
  598. smalltalk.AIContext);
  599. smalltalk.addMethod(
  600. smalltalk.method({
  601. selector: "method",
  602. category: 'accessing',
  603. fn: function (){
  604. var self=this;
  605. return smalltalk.withContext(function($ctx1) {
  606. var $1;
  607. $1=self["@method"];
  608. return $1;
  609. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.AIContext)})},
  610. args: [],
  611. source: "method\x0a\x09^ method",
  612. messageSends: [],
  613. referencedClasses: []
  614. }),
  615. smalltalk.AIContext);
  616. smalltalk.addMethod(
  617. smalltalk.method({
  618. selector: "method:",
  619. category: 'accessing',
  620. fn: function (aCompiledMethod){
  621. var self=this;
  622. return smalltalk.withContext(function($ctx1) {
  623. self["@method"]=aCompiledMethod;
  624. return self}, function($ctx1) {$ctx1.fill(self,"method:",{aCompiledMethod:aCompiledMethod},smalltalk.AIContext)})},
  625. args: ["aCompiledMethod"],
  626. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  627. messageSends: [],
  628. referencedClasses: []
  629. }),
  630. smalltalk.AIContext);
  631. smalltalk.addMethod(
  632. smalltalk.method({
  633. selector: "methodContext",
  634. category: 'accessing',
  635. fn: function (){
  636. var self=this;
  637. return smalltalk.withContext(function($ctx1) {
  638. var $1,$3,$2,$5,$6,$4;
  639. var $early={};
  640. try {
  641. $1=self._isBlockContext();
  642. $2=(function(){
  643. return smalltalk.withContext(function($ctx2) {
  644. $3=self;
  645. throw $early=[$3];
  646. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  647. _st($1)._ifFalse_($2);
  648. $5=self._outerContext();
  649. $6=(function(outer){
  650. return smalltalk.withContext(function($ctx2) {
  651. return _st(outer)._methodContext();
  652. }, function($ctx2) {$ctx2.fillBlock({outer:outer},$ctx1,2)})});
  653. $4=_st($5)._ifNotNil_($6);
  654. return $4;
  655. }
  656. catch(e) {if(e===$early)return e[0]; throw e}
  657. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},smalltalk.AIContext)})},
  658. args: [],
  659. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  660. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"],
  661. referencedClasses: []
  662. }),
  663. smalltalk.AIContext);
  664. smalltalk.addMethod(
  665. smalltalk.method({
  666. selector: "newBlockContext",
  667. category: 'factory',
  668. fn: function (){
  669. var self=this;
  670. return smalltalk.withContext(function($ctx1) {
  671. var $2,$3,$1;
  672. $2=_st(self._class())._new();
  673. _st($2)._outerContext_(self);
  674. $3=_st($2)._yourself();
  675. $1=$3;
  676. return $1;
  677. }, function($ctx1) {$ctx1.fill(self,"newBlockContext",{},smalltalk.AIContext)})},
  678. args: [],
  679. source: "newBlockContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  680. messageSends: ["outerContext:", "new", "class", "yourself"],
  681. referencedClasses: []
  682. }),
  683. smalltalk.AIContext);
  684. smalltalk.addMethod(
  685. smalltalk.method({
  686. selector: "outerContext",
  687. category: 'accessing',
  688. fn: function (){
  689. var self=this;
  690. return smalltalk.withContext(function($ctx1) {
  691. var $1;
  692. $1=self["@outerContext"];
  693. return $1;
  694. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.AIContext)})},
  695. args: [],
  696. source: "outerContext\x0a\x09^ outerContext",
  697. messageSends: [],
  698. referencedClasses: []
  699. }),
  700. smalltalk.AIContext);
  701. smalltalk.addMethod(
  702. smalltalk.method({
  703. selector: "outerContext:",
  704. category: 'accessing',
  705. fn: function (anAIContext){
  706. var self=this;
  707. return smalltalk.withContext(function($ctx1) {
  708. self["@outerContext"]=anAIContext;
  709. _st(self["@outerContext"])._innerContext_(self);
  710. return self}, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},smalltalk.AIContext)})},
  711. args: ["anAIContext"],
  712. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext innerContext: self",
  713. messageSends: ["innerContext:"],
  714. referencedClasses: []
  715. }),
  716. smalltalk.AIContext);
  717. smalltalk.addMethod(
  718. smalltalk.method({
  719. selector: "pc",
  720. category: 'interpreting',
  721. fn: function (){
  722. var self=this;
  723. return smalltalk.withContext(function($ctx1) {
  724. var $2,$3,$1;
  725. $2=self["@pc"];
  726. $3=(function(){
  727. return smalltalk.withContext(function($ctx2) {
  728. self["@pc"]=(0);
  729. return self["@pc"];
  730. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  731. $1=_st($2)._ifNil_($3);
  732. return $1;
  733. }, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.AIContext)})},
  734. args: [],
  735. source: "pc\x0a\x09^ pc ifNil: [ pc := 0 ]",
  736. messageSends: ["ifNil:"],
  737. referencedClasses: []
  738. }),
  739. smalltalk.AIContext);
  740. smalltalk.addMethod(
  741. smalltalk.method({
  742. selector: "pc:",
  743. category: 'interpreting',
  744. fn: function (anInteger){
  745. var self=this;
  746. return smalltalk.withContext(function($ctx1) {
  747. self["@pc"]=anInteger;
  748. return self}, function($ctx1) {$ctx1.fill(self,"pc:",{anInteger:anInteger},smalltalk.AIContext)})},
  749. args: ["anInteger"],
  750. source: "pc: anInteger\x0a\x09pc := anInteger",
  751. messageSends: [],
  752. referencedClasses: []
  753. }),
  754. smalltalk.AIContext);
  755. smalltalk.addMethod(
  756. smalltalk.method({
  757. selector: "receiver",
  758. category: 'interpreting',
  759. fn: function (){
  760. var self=this;
  761. return smalltalk.withContext(function($ctx1) {
  762. var $1;
  763. $1=self._localAt_("self");
  764. return $1;
  765. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.AIContext)})},
  766. args: [],
  767. source: "receiver\x0a\x09^ self localAt: 'self'",
  768. messageSends: ["localAt:"],
  769. referencedClasses: []
  770. }),
  771. smalltalk.AIContext);
  772. smalltalk.addMethod(
  773. smalltalk.method({
  774. selector: "receiver:",
  775. category: 'interpreting',
  776. fn: function (anObject){
  777. var self=this;
  778. return smalltalk.withContext(function($ctx1) {
  779. self._localAt_put_("self",anObject);
  780. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.AIContext)})},
  781. args: ["anObject"],
  782. source: "receiver: anObject\x0a\x09self localAt: 'self' put: anObject",
  783. messageSends: ["localAt:put:"],
  784. referencedClasses: []
  785. }),
  786. smalltalk.AIContext);
  787. smalltalk.addMethod(
  788. smalltalk.method({
  789. selector: "retrieveNode",
  790. category: 'interpreting',
  791. fn: function (){
  792. var self=this;
  793. function $ASTPCNodeVisitor(){return smalltalk.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  794. return smalltalk.withContext(function($ctx1) {
  795. var $2,$3,$1;
  796. $2=_st($ASTPCNodeVisitor())._new();
  797. _st($2)._context_(self);
  798. _st($2)._visit_(self._ast());
  799. $3=_st($2)._currentNode();
  800. $1=$3;
  801. return $1;
  802. }, function($ctx1) {$ctx1.fill(self,"retrieveNode",{},smalltalk.AIContext)})},
  803. args: [],
  804. source: "retrieveNode\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: self;\x0a\x09\x09visit: self ast;\x0a\x09\x09currentNode",
  805. messageSends: ["context:", "new", "visit:", "ast", "currentNode"],
  806. referencedClasses: ["ASTPCNodeVisitor"]
  807. }),
  808. smalltalk.AIContext);
  809. smalltalk.addMethod(
  810. smalltalk.method({
  811. selector: "selector",
  812. category: 'accessing',
  813. fn: function (){
  814. var self=this;
  815. return smalltalk.withContext(function($ctx1) {
  816. var $2,$3,$1;
  817. $2=self._method();
  818. $3=(function(){
  819. return smalltalk.withContext(function($ctx2) {
  820. return _st(self._method())._selector();
  821. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  822. $1=_st($2)._ifNotNil_($3);
  823. return $1;
  824. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.AIContext)})},
  825. args: [],
  826. source: "selector\x0a\x09^ self method ifNotNil: [ \x0a\x09\x09self method selector ]",
  827. messageSends: ["ifNotNil:", "method", "selector"],
  828. referencedClasses: []
  829. }),
  830. smalltalk.AIContext);
  831. smalltalk.addMethod(
  832. smalltalk.method({
  833. selector: "setupInterpreter:",
  834. category: 'interpreting',
  835. fn: function (anInterpreter){
  836. var self=this;
  837. return smalltalk.withContext(function($ctx1) {
  838. _st(_st(_st(self._innerContext())._arguments())._reversed())._do_((function(each){
  839. return smalltalk.withContext(function($ctx2) {
  840. return _st(anInterpreter)._push_(each);
  841. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  842. _st(anInterpreter)._push_(_st(self._innerContext())._receiver());
  843. return self}, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter},smalltalk.AIContext)})},
  844. args: ["anInterpreter"],
  845. 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)",
  846. messageSends: ["do:", "reversed", "arguments", "innerContext", "push:", "receiver"],
  847. referencedClasses: []
  848. }),
  849. smalltalk.AIContext);
  850. smalltalk.addMethod(
  851. smalltalk.method({
  852. selector: "fromMethodContext:",
  853. category: 'instance creation',
  854. fn: function (aMethodContext){
  855. var self=this;
  856. return smalltalk.withContext(function($ctx1) {
  857. var $2,$3,$1;
  858. $2=self._new();
  859. _st($2)._initializeFromMethodContext_(aMethodContext);
  860. $3=_st($2)._yourself();
  861. $1=$3;
  862. return $1;
  863. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},smalltalk.AIContext.klass)})},
  864. args: ["aMethodContext"],
  865. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  866. messageSends: ["initializeFromMethodContext:", "new", "yourself"],
  867. referencedClasses: []
  868. }),
  869. smalltalk.AIContext.klass);
  870. smalltalk.addClass('AIInterpreterError', smalltalk.Error, [], 'Compiler-Interpreter');
  871. smalltalk.AIInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  872. smalltalk.addClass('ASTDebugger', smalltalk.Object, ['interpreter', 'context'], 'Compiler-Interpreter');
  873. smalltalk.ASTDebugger.comment="I am a stepping debugger interface for Amber code.\x0aI internally use an instance of `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.";
  874. smalltalk.addMethod(
  875. smalltalk.method({
  876. selector: "atEnd",
  877. category: 'testing',
  878. fn: function (){
  879. var self=this;
  880. return smalltalk.withContext(function($ctx1) {
  881. var $1;
  882. $1=_st(self._interpreter())._atEnd();
  883. return $1;
  884. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTDebugger)})},
  885. args: [],
  886. source: "atEnd\x0a\x09^ self interpreter atEnd",
  887. messageSends: ["atEnd", "interpreter"],
  888. referencedClasses: []
  889. }),
  890. smalltalk.ASTDebugger);
  891. smalltalk.addMethod(
  892. smalltalk.method({
  893. selector: "buildAST",
  894. category: 'initialization',
  895. fn: function (){
  896. var self=this;
  897. var ast;
  898. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  899. function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  900. return smalltalk.withContext(function($ctx1) {
  901. var $1;
  902. ast=_st(_st($Smalltalk())._current())._parse_(_st(self._method())._source());
  903. _st(_st($SemanticAnalyzer())._on_(_st(_st(self._context())._receiver())._class()))._visit_(ast);
  904. $1=ast;
  905. return $1;
  906. }, function($ctx1) {$ctx1.fill(self,"buildAST",{ast:ast},smalltalk.ASTDebugger)})},
  907. args: [],
  908. source: "buildAST\x0a\x09\x22Build the AST tree from the method source code.\x0a\x09The AST is annotated with a SemanticAnalyzer,\x0a\x09to know the semantics and bindings of each node needed for later debugging\x22\x0a\x09\x0a\x09| ast |\x0a\x09\x0a\x09ast := Smalltalk current parse: self method source.\x0a\x09(SemanticAnalyzer on: self context receiver class)\x0a\x09\x09visit: ast.\x0a\x09\x0a\x09^ ast",
  909. messageSends: ["parse:", "current", "source", "method", "visit:", "on:", "class", "receiver", "context"],
  910. referencedClasses: ["Smalltalk", "SemanticAnalyzer"]
  911. }),
  912. smalltalk.ASTDebugger);
  913. smalltalk.addMethod(
  914. smalltalk.method({
  915. selector: "context",
  916. category: 'accessing',
  917. fn: function (){
  918. var self=this;
  919. return smalltalk.withContext(function($ctx1) {
  920. var $1;
  921. $1=self["@context"];
  922. return $1;
  923. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTDebugger)})},
  924. args: [],
  925. source: "context\x0a\x09^ context",
  926. messageSends: [],
  927. referencedClasses: []
  928. }),
  929. smalltalk.ASTDebugger);
  930. smalltalk.addMethod(
  931. smalltalk.method({
  932. selector: "context:",
  933. category: 'accessing',
  934. fn: function (aContext){
  935. var self=this;
  936. return smalltalk.withContext(function($ctx1) {
  937. self["@context"]=aContext;
  938. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTDebugger)})},
  939. args: ["aContext"],
  940. source: "context: aContext\x0a\x09context := aContext",
  941. messageSends: [],
  942. referencedClasses: []
  943. }),
  944. smalltalk.ASTDebugger);
  945. smalltalk.addMethod(
  946. smalltalk.method({
  947. selector: "defaultInterpreterClass",
  948. category: 'defaults',
  949. fn: function (){
  950. var self=this;
  951. function $ASTSteppingInterpreter(){return smalltalk.ASTSteppingInterpreter||(typeof ASTSteppingInterpreter=="undefined"?nil:ASTSteppingInterpreter)}
  952. return smalltalk.withContext(function($ctx1) {
  953. var $1;
  954. $1=$ASTSteppingInterpreter();
  955. return $1;
  956. }, function($ctx1) {$ctx1.fill(self,"defaultInterpreterClass",{},smalltalk.ASTDebugger)})},
  957. args: [],
  958. source: "defaultInterpreterClass\x0a\x09^ ASTSteppingInterpreter",
  959. messageSends: [],
  960. referencedClasses: ["ASTSteppingInterpreter"]
  961. }),
  962. smalltalk.ASTDebugger);
  963. smalltalk.addMethod(
  964. smalltalk.method({
  965. selector: "initializeInterpreter",
  966. category: 'initialization',
  967. fn: function (){
  968. var self=this;
  969. var ast,next;
  970. function $ASTPCNodeVisitor(){return smalltalk.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  971. return smalltalk.withContext(function($ctx1) {
  972. var $1,$2;
  973. ast=self._buildAST();
  974. $1=_st($ASTPCNodeVisitor())._new();
  975. _st($1)._context_(self._context());
  976. _st($1)._visit_(ast);
  977. $2=_st($1)._currentNode();
  978. next=$2;
  979. _st(self._interpreter())._interpret_(next);
  980. return self}, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{ast:ast,next:next},smalltalk.ASTDebugger)})},
  981. args: [],
  982. 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 interpret: next",
  983. messageSends: ["buildAST", "context:", "new", "context", "visit:", "currentNode", "interpret:", "interpreter"],
  984. referencedClasses: ["ASTPCNodeVisitor"]
  985. }),
  986. smalltalk.ASTDebugger);
  987. smalltalk.addMethod(
  988. smalltalk.method({
  989. selector: "initializeWithContext:",
  990. category: 'initialization',
  991. fn: function (aContext){
  992. var self=this;
  993. return smalltalk.withContext(function($ctx1) {
  994. self._context_(aContext);
  995. self._initializeInterpreter();
  996. return self}, function($ctx1) {$ctx1.fill(self,"initializeWithContext:",{aContext:aContext},smalltalk.ASTDebugger)})},
  997. args: ["aContext"],
  998. source: "initializeWithContext: aContext\x0a\x09\x22TODO: do we need to handle block contexts?\x22\x0a\x09\x0a\x09self context: aContext.\x0a\x09self initializeInterpreter",
  999. messageSends: ["context:", "initializeInterpreter"],
  1000. referencedClasses: []
  1001. }),
  1002. smalltalk.ASTDebugger);
  1003. smalltalk.addMethod(
  1004. smalltalk.method({
  1005. selector: "interpreter",
  1006. category: 'accessing',
  1007. fn: function (){
  1008. var self=this;
  1009. return smalltalk.withContext(function($ctx1) {
  1010. var $2,$3,$1;
  1011. $2=self["@interpreter"];
  1012. $3=(function(){
  1013. return smalltalk.withContext(function($ctx2) {
  1014. self["@interpreter"]=_st(self._defaultInterpreterClass())._new();
  1015. return self["@interpreter"];
  1016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  1017. $1=_st($2)._ifNil_($3);
  1018. return $1;
  1019. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},smalltalk.ASTDebugger)})},
  1020. args: [],
  1021. source: "interpreter\x0a\x09^ interpreter ifNil: [ interpreter := self defaultInterpreterClass new ]",
  1022. messageSends: ["ifNil:", "new", "defaultInterpreterClass"],
  1023. referencedClasses: []
  1024. }),
  1025. smalltalk.ASTDebugger);
  1026. smalltalk.addMethod(
  1027. smalltalk.method({
  1028. selector: "interpreter:",
  1029. category: 'accessing',
  1030. fn: function (anInterpreter){
  1031. var self=this;
  1032. return smalltalk.withContext(function($ctx1) {
  1033. self["@interpreter"]=anInterpreter;
  1034. return self}, function($ctx1) {$ctx1.fill(self,"interpreter:",{anInterpreter:anInterpreter},smalltalk.ASTDebugger)})},
  1035. args: ["anInterpreter"],
  1036. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  1037. messageSends: [],
  1038. referencedClasses: []
  1039. }),
  1040. smalltalk.ASTDebugger);
  1041. smalltalk.addMethod(
  1042. smalltalk.method({
  1043. selector: "method",
  1044. category: 'accessing',
  1045. fn: function (){
  1046. var self=this;
  1047. return smalltalk.withContext(function($ctx1) {
  1048. var $1;
  1049. $1=_st(self._context())._method();
  1050. return $1;
  1051. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.ASTDebugger)})},
  1052. args: [],
  1053. source: "method\x0a\x09^ self context method",
  1054. messageSends: ["method", "context"],
  1055. referencedClasses: []
  1056. }),
  1057. smalltalk.ASTDebugger);
  1058. smalltalk.addMethod(
  1059. smalltalk.method({
  1060. selector: "nextNode",
  1061. category: 'accessing',
  1062. fn: function (){
  1063. var self=this;
  1064. return smalltalk.withContext(function($ctx1) {
  1065. var $1;
  1066. $1=_st(self._interpreter())._nextNode();
  1067. return $1;
  1068. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.ASTDebugger)})},
  1069. args: [],
  1070. source: "nextNode\x0a\x09^ self interpreter nextNode",
  1071. messageSends: ["nextNode", "interpreter"],
  1072. referencedClasses: []
  1073. }),
  1074. smalltalk.ASTDebugger);
  1075. smalltalk.addMethod(
  1076. smalltalk.method({
  1077. selector: "proceed",
  1078. category: 'stepping',
  1079. fn: function (){
  1080. var self=this;
  1081. return smalltalk.withContext(function($ctx1) {
  1082. self._shouldBeImplemented();
  1083. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.ASTDebugger)})},
  1084. args: [],
  1085. source: "proceed\x0a\x09self shouldBeImplemented",
  1086. messageSends: ["shouldBeImplemented"],
  1087. referencedClasses: []
  1088. }),
  1089. smalltalk.ASTDebugger);
  1090. smalltalk.addMethod(
  1091. smalltalk.method({
  1092. selector: "restart",
  1093. category: 'stepping',
  1094. fn: function (){
  1095. var self=this;
  1096. return smalltalk.withContext(function($ctx1) {
  1097. self._shouldBeImplemented();
  1098. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},smalltalk.ASTDebugger)})},
  1099. args: [],
  1100. source: "restart\x0a\x09self shouldBeImplemented",
  1101. messageSends: ["shouldBeImplemented"],
  1102. referencedClasses: []
  1103. }),
  1104. smalltalk.ASTDebugger);
  1105. smalltalk.addMethod(
  1106. smalltalk.method({
  1107. selector: "step",
  1108. category: 'stepping',
  1109. fn: function (){
  1110. var self=this;
  1111. return smalltalk.withContext(function($ctx1) {
  1112. _st((function(){
  1113. return smalltalk.withContext(function($ctx2) {
  1114. return _st(_st(_st(_st(self._interpreter())._nextNode())._notNil())._and_((function(){
  1115. return smalltalk.withContext(function($ctx3) {
  1116. return _st(_st(self._interpreter())._nextNode())._stopOnStepping();
  1117. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})})))._or_((function(){
  1118. return smalltalk.withContext(function($ctx3) {
  1119. return _st(_st(self._interpreter())._atEnd())._not();
  1120. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  1121. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  1122. return smalltalk.withContext(function($ctx2) {
  1123. _st(self._interpreter())._step();
  1124. return self._step();
  1125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1126. return self}, function($ctx1) {$ctx1.fill(self,"step",{},smalltalk.ASTDebugger)})},
  1127. args: [],
  1128. source: "step\x0a\x09\x22The ASTSteppingInterpreter stops at each node interpretation.\x0a\x09One step will interpret nodes until:\x0a\x09- we get at the end\x0a\x09- the next node is a stepping node (send, assignment, etc.)\x22\x0a\x09\x0a\x09[ (self interpreter nextNode notNil and: [ self interpreter nextNode stopOnStepping ])\x0a\x09\x09or: [ self interpreter atEnd not ] ]\x0a\x09\x09\x09whileFalse: [\x0a\x09\x09\x09\x09self interpreter step.\x0a\x09\x09\x09\x09self step ]",
  1129. messageSends: ["whileFalse:", "or:", "and:", "notNil", "nextNode", "interpreter", "stopOnStepping", "not", "atEnd", "step"],
  1130. referencedClasses: []
  1131. }),
  1132. smalltalk.ASTDebugger);
  1133. smalltalk.addMethod(
  1134. smalltalk.method({
  1135. selector: "stepInto",
  1136. category: 'stepping',
  1137. fn: function (){
  1138. var self=this;
  1139. return smalltalk.withContext(function($ctx1) {
  1140. self._shouldBeImplemented();
  1141. return self}, function($ctx1) {$ctx1.fill(self,"stepInto",{},smalltalk.ASTDebugger)})},
  1142. args: [],
  1143. source: "stepInto\x0a\x09self shouldBeImplemented",
  1144. messageSends: ["shouldBeImplemented"],
  1145. referencedClasses: []
  1146. }),
  1147. smalltalk.ASTDebugger);
  1148. smalltalk.addMethod(
  1149. smalltalk.method({
  1150. selector: "stepOver",
  1151. category: 'stepping',
  1152. fn: function (){
  1153. var self=this;
  1154. return smalltalk.withContext(function($ctx1) {
  1155. self._step();
  1156. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},smalltalk.ASTDebugger)})},
  1157. args: [],
  1158. source: "stepOver\x0a\x09self step",
  1159. messageSends: ["step"],
  1160. referencedClasses: []
  1161. }),
  1162. smalltalk.ASTDebugger);
  1163. smalltalk.addMethod(
  1164. smalltalk.method({
  1165. selector: "context:",
  1166. category: 'instance creation',
  1167. fn: function (aContext){
  1168. var self=this;
  1169. return smalltalk.withContext(function($ctx1) {
  1170. var $2,$3,$1;
  1171. $2=self._new();
  1172. _st($2)._initializeWithContext_(aContext);
  1173. $3=_st($2)._yourself();
  1174. $1=$3;
  1175. return $1;
  1176. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTDebugger.klass)})},
  1177. args: ["aContext"],
  1178. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext;\x0a\x09\x09yourself",
  1179. messageSends: ["initializeWithContext:", "new", "yourself"],
  1180. referencedClasses: []
  1181. }),
  1182. smalltalk.ASTDebugger.klass);
  1183. smalltalk.addClass('ASTInterpreter', smalltalk.Object, ['currentNode', 'nextNode', 'context', 'shouldReturn', 'result'], 'Compiler-Interpreter');
  1184. smalltalk.ASTInterpreter.comment="I am like a `NodeVisitor`, interpreting nodes one after each other.\x0aI am built using Continuation Passing Style for stepping purposes.\x0a\x0a## Usage example:\x0a\x0a\x09| ast interpreter |\x0a\x09ast := Smalltalk current parse: 'foo 1+2+4'.\x0a\x09(SemanticAnalyzer on: Object) visit: ast.\x0a\x0a\x09ASTInterpreter new\x0a\x09\x09interpret: ast nodes first;\x0a\x09\x09result \x22Answers 7\x22";
  1185. smalltalk.addMethod(
  1186. smalltalk.method({
  1187. selector: "assign:to:",
  1188. category: 'private',
  1189. fn: function (aNode,anObject){
  1190. var self=this;
  1191. return smalltalk.withContext(function($ctx1) {
  1192. var $2,$3,$4,$1;
  1193. $2=_st(_st(aNode)._binding())._isInstanceVar();
  1194. $3=(function(){
  1195. return smalltalk.withContext(function($ctx2) {
  1196. return _st(_st(self._context())._receiver())._instVarAt_put_(_st(aNode)._value(),anObject);
  1197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  1198. $4=(function(){
  1199. return smalltalk.withContext(function($ctx2) {
  1200. return _st(self._context())._localAt_put_(_st(aNode)._value(),anObject);
  1201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})});
  1202. $1=_st($2)._ifTrue_ifFalse_($3,$4);
  1203. return $1;
  1204. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},smalltalk.ASTInterpreter)})},
  1205. args: ["aNode", "anObject"],
  1206. source: "assign: aNode to: anObject\x0a\x09^ aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]\x0a\x09\x09ifFalse: [ self context localAt: aNode value put: anObject ]",
  1207. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"],
  1208. referencedClasses: []
  1209. }),
  1210. smalltalk.ASTInterpreter);
  1211. smalltalk.addMethod(
  1212. smalltalk.method({
  1213. selector: "context",
  1214. category: 'accessing',
  1215. fn: function (){
  1216. var self=this;
  1217. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  1218. return smalltalk.withContext(function($ctx1) {
  1219. var $2,$3,$1;
  1220. $2=self["@context"];
  1221. $3=(function(){
  1222. return smalltalk.withContext(function($ctx2) {
  1223. self["@context"]=_st($AIContext())._new();
  1224. return self["@context"];
  1225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  1226. $1=_st($2)._ifNil_($3);
  1227. return $1;
  1228. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTInterpreter)})},
  1229. args: [],
  1230. source: "context\x0a\x09^ context ifNil: [ context := AIContext new ]",
  1231. messageSends: ["ifNil:", "new"],
  1232. referencedClasses: ["AIContext"]
  1233. }),
  1234. smalltalk.ASTInterpreter);
  1235. smalltalk.addMethod(
  1236. smalltalk.method({
  1237. selector: "context:",
  1238. category: 'accessing',
  1239. fn: function (anAIContext){
  1240. var self=this;
  1241. return smalltalk.withContext(function($ctx1) {
  1242. self["@context"]=anAIContext;
  1243. return self}, function($ctx1) {$ctx1.fill(self,"context:",{anAIContext:anAIContext},smalltalk.ASTInterpreter)})},
  1244. args: ["anAIContext"],
  1245. source: "context: anAIContext\x0a\x09context := anAIContext",
  1246. messageSends: [],
  1247. referencedClasses: []
  1248. }),
  1249. smalltalk.ASTInterpreter);
  1250. smalltalk.addMethod(
  1251. smalltalk.method({
  1252. selector: "continue:value:",
  1253. category: 'private',
  1254. fn: function (aBlock,anObject){
  1255. var self=this;
  1256. return smalltalk.withContext(function($ctx1) {
  1257. self["@result"]=anObject;
  1258. _st(aBlock)._value_(anObject);
  1259. return self}, function($ctx1) {$ctx1.fill(self,"continue:value:",{aBlock:aBlock,anObject:anObject},smalltalk.ASTInterpreter)})},
  1260. args: ["aBlock", "anObject"],
  1261. source: "continue: aBlock value: anObject\x0a\x09result := anObject.\x0a\x09aBlock value: anObject",
  1262. messageSends: ["value:"],
  1263. referencedClasses: []
  1264. }),
  1265. smalltalk.ASTInterpreter);
  1266. smalltalk.addMethod(
  1267. smalltalk.method({
  1268. selector: "currentNode",
  1269. category: 'accessing',
  1270. fn: function (){
  1271. var self=this;
  1272. return smalltalk.withContext(function($ctx1) {
  1273. var $1;
  1274. $1=self["@currentNode"];
  1275. return $1;
  1276. }, function($ctx1) {$ctx1.fill(self,"currentNode",{},smalltalk.ASTInterpreter)})},
  1277. args: [],
  1278. source: "currentNode\x0a\x09^ currentNode",
  1279. messageSends: [],
  1280. referencedClasses: []
  1281. }),
  1282. smalltalk.ASTInterpreter);
  1283. smalltalk.addMethod(
  1284. smalltalk.method({
  1285. selector: "eval:",
  1286. category: 'private',
  1287. fn: function (aString){
  1288. var self=this;
  1289. var source,function_;
  1290. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1291. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  1292. return smalltalk.withContext(function($ctx1) {
  1293. var $1,$2,$3;
  1294. source=_st($String())._streamContents_((function(str){
  1295. return smalltalk.withContext(function($ctx2) {
  1296. _st(str)._nextPutAll_("(function(");
  1297. _st(_st(_st(self._context())._locals())._keys())._do_separatedBy_((function(each){
  1298. return smalltalk.withContext(function($ctx3) {
  1299. return _st(str)._nextPutAll_(each);
  1300. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  1301. return smalltalk.withContext(function($ctx3) {
  1302. return _st(str)._nextPutAll_(",");
  1303. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  1304. $1=str;
  1305. _st($1)._nextPutAll_("){ return (function() {");
  1306. _st($1)._nextPutAll_(aString);
  1307. $2=_st($1)._nextPutAll_("})() })");
  1308. return $2;
  1309. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  1310. function_=_st(_st($Compiler())._new())._eval_(source);
  1311. $3=_st(function_)._valueWithPossibleArguments_(_st(_st(self._context())._locals())._values());
  1312. return $3;
  1313. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},smalltalk.ASTInterpreter)})},
  1314. args: ["aString"],
  1315. 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",
  1316. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"],
  1317. referencedClasses: ["String", "Compiler"]
  1318. }),
  1319. smalltalk.ASTInterpreter);
  1320. smalltalk.addMethod(
  1321. smalltalk.method({
  1322. selector: "initialize",
  1323. category: 'initialization',
  1324. fn: function (){
  1325. var self=this;
  1326. return smalltalk.withContext(function($ctx1) {
  1327. smalltalk.ASTInterpreter.superclass.fn.prototype._initialize.apply(_st(self), []);
  1328. self["@shouldReturn"]=false;
  1329. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ASTInterpreter)})},
  1330. args: [],
  1331. source: "initialize\x0a\x09super initialize.\x0a\x09shouldReturn := false",
  1332. messageSends: ["initialize"],
  1333. referencedClasses: []
  1334. }),
  1335. smalltalk.ASTInterpreter);
  1336. smalltalk.addMethod(
  1337. smalltalk.method({
  1338. selector: "interpret:",
  1339. category: 'interpreting',
  1340. fn: function (aNode){
  1341. var self=this;
  1342. return smalltalk.withContext(function($ctx1) {
  1343. self["@shouldReturn"]=false;
  1344. self._interpret_continue_(aNode,(function(value){
  1345. return smalltalk.withContext(function($ctx2) {
  1346. self["@result"]=value;
  1347. return self["@result"];
  1348. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}));
  1349. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1350. args: ["aNode"],
  1351. source: "interpret: aNode\x0a\x09shouldReturn := false.\x0a\x09self interpret: aNode continue: [ :value |\x0a\x09\x09result := value ]",
  1352. messageSends: ["interpret:continue:"],
  1353. referencedClasses: []
  1354. }),
  1355. smalltalk.ASTInterpreter);
  1356. smalltalk.addMethod(
  1357. smalltalk.method({
  1358. selector: "interpret:continue:",
  1359. category: 'interpreting',
  1360. fn: function (aNode,aBlock){
  1361. var self=this;
  1362. return smalltalk.withContext(function($ctx1) {
  1363. var $1,$3,$2,$4,$5,$6;
  1364. var $early={};
  1365. try {
  1366. $1=self["@shouldReturn"];
  1367. $2=(function(){
  1368. return smalltalk.withContext(function($ctx2) {
  1369. $3=self;
  1370. throw $early=[$3];
  1371. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  1372. _st($1)._ifTrue_($2);
  1373. $4=_st(aNode)._isNode();
  1374. $5=(function(){
  1375. return smalltalk.withContext(function($ctx2) {
  1376. self["@currentNode"]=aNode;
  1377. self["@currentNode"];
  1378. return self._interpretNode_continue_(aNode,(function(value){
  1379. return smalltalk.withContext(function($ctx3) {
  1380. return self._continue_value_(aBlock,value);
  1381. }, function($ctx3) {$ctx3.fillBlock({value:value},$ctx2,3)})}));
  1382. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})});
  1383. $6=(function(){
  1384. return smalltalk.withContext(function($ctx2) {
  1385. return self._continue_value_(aBlock,aNode);
  1386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})});
  1387. _st($4)._ifTrue_ifFalse_($5,$6);
  1388. return self}
  1389. catch(e) {if(e===$early)return e[0]; throw e}
  1390. }, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1391. args: ["aNode", "aBlock"],
  1392. source: "interpret: aNode continue: aBlock\x0a\x09shouldReturn ifTrue: [ ^ self ].\x0a\x0a\x09aNode isNode\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09currentNode := aNode.\x0a\x09\x09\x09self interpretNode: aNode continue: [ :value |\x0a\x09\x09\x09\x09self continue: aBlock value: value ] ]\x0a\x09\x09ifFalse: [ self continue: aBlock value: aNode ]",
  1393. messageSends: ["ifTrue:", "ifTrue:ifFalse:", "isNode", "interpretNode:continue:", "continue:value:"],
  1394. referencedClasses: []
  1395. }),
  1396. smalltalk.ASTInterpreter);
  1397. smalltalk.addMethod(
  1398. smalltalk.method({
  1399. selector: "interpretAll:continue:",
  1400. category: 'private',
  1401. fn: function (aCollection,aBlock){
  1402. var self=this;
  1403. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1404. return smalltalk.withContext(function($ctx1) {
  1405. self._interpretAll_continue_result_(aCollection,aBlock,_st($OrderedCollection())._new());
  1406. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:",{aCollection:aCollection,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1407. args: ["aCollection", "aBlock"],
  1408. source: "interpretAll: aCollection continue: aBlock\x0a\x09self\x0a\x09\x09interpretAll: aCollection\x0a\x09\x09continue: aBlock\x0a\x09\x09result: OrderedCollection new",
  1409. messageSends: ["interpretAll:continue:result:", "new"],
  1410. referencedClasses: ["OrderedCollection"]
  1411. }),
  1412. smalltalk.ASTInterpreter);
  1413. smalltalk.addMethod(
  1414. smalltalk.method({
  1415. selector: "interpretAll:continue:result:",
  1416. category: 'private',
  1417. fn: function (nodes,aBlock,aCollection){
  1418. var self=this;
  1419. return smalltalk.withContext(function($ctx1) {
  1420. var $1,$2,$3;
  1421. $1=_st(nodes)._isEmpty();
  1422. $2=(function(){
  1423. return smalltalk.withContext(function($ctx2) {
  1424. return self._continue_value_(aBlock,aCollection);
  1425. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  1426. $3=(function(){
  1427. return smalltalk.withContext(function($ctx2) {
  1428. return self._interpret_continue_(_st(nodes)._first(),(function(value){
  1429. return smalltalk.withContext(function($ctx3) {
  1430. return self._interpretAll_continue_result_(_st(nodes)._allButFirst(),aBlock,_st(aCollection).__comma([value]));
  1431. }, function($ctx3) {$ctx3.fillBlock({value:value},$ctx2,3)})}));
  1432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})});
  1433. _st($1)._ifTrue_ifFalse_($2,$3);
  1434. return self}, function($ctx1) {$ctx1.fill(self,"interpretAll:continue:result:",{nodes:nodes,aBlock:aBlock,aCollection:aCollection},smalltalk.ASTInterpreter)})},
  1435. args: ["nodes", "aBlock", "aCollection"],
  1436. source: "interpretAll: nodes continue: aBlock result: aCollection\x0a\x09nodes isEmpty\x0a\x09\x09ifTrue: [ self continue: aBlock value: aCollection ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self interpret: nodes first continue: [:value |\x0a\x09\x09\x09\x09self\x0a\x09\x09\x09\x09\x09interpretAll: nodes allButFirst\x0a\x09\x09\x09\x09\x09continue: aBlock\x0a\x09\x09\x09\x09\x09result: aCollection, { value } ] ]",
  1437. messageSends: ["ifTrue:ifFalse:", "isEmpty", "continue:value:", "interpret:continue:", "first", "interpretAll:continue:result:", "allButFirst", ","],
  1438. referencedClasses: []
  1439. }),
  1440. smalltalk.ASTInterpreter);
  1441. smalltalk.addMethod(
  1442. smalltalk.method({
  1443. selector: "interpretAssignmentNode:continue:",
  1444. category: 'interpreting',
  1445. fn: function (aNode,aBlock){
  1446. var self=this;
  1447. return smalltalk.withContext(function($ctx1) {
  1448. self._interpret_continue_(_st(aNode)._right(),(function(value){
  1449. return smalltalk.withContext(function($ctx2) {
  1450. return self._continue_value_(aBlock,self._assign_to_(_st(aNode)._left(),value));
  1451. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}));
  1452. return self}, function($ctx1) {$ctx1.fill(self,"interpretAssignmentNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1453. args: ["aNode", "aBlock"],
  1454. source: "interpretAssignmentNode: aNode continue: aBlock\x0a\x09self interpret: aNode right continue: [ :value |\x0a\x09\x09self\x0a\x09\x09\x09continue: aBlock\x0a\x09\x09\x09value: (self assign: aNode left to: value) ]",
  1455. messageSends: ["interpret:continue:", "right", "continue:value:", "assign:to:", "left"],
  1456. referencedClasses: []
  1457. }),
  1458. smalltalk.ASTInterpreter);
  1459. smalltalk.addMethod(
  1460. smalltalk.method({
  1461. selector: "interpretBlockNode:continue:",
  1462. category: 'interpreting',
  1463. fn: function (aNode,aBlock){
  1464. var self=this;
  1465. return smalltalk.withContext(function($ctx1) {
  1466. var $1,$2;
  1467. self._continue_value_(aBlock,(function(){
  1468. return smalltalk.withContext(function($ctx2) {
  1469. return self._withBlockContext_((function(){
  1470. return smalltalk.withContext(function($ctx3) {
  1471. $1=self;
  1472. _st($1)._interpret_(_st(_st(aNode)._nodes())._first());
  1473. $2=_st($1)._result();
  1474. return $2;
  1475. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1477. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1478. args: ["aNode", "aBlock"],
  1479. source: "interpretBlockNode: aNode continue: aBlock\x0a\x09self\x0a\x09\x09continue: aBlock\x0a\x09\x09value: [ \x0a\x09\x09\x09self withBlockContext: [ \x0a\x09\x09\x09\x09self interpret: aNode nodes first; result ] ]",
  1480. messageSends: ["continue:value:", "withBlockContext:", "interpret:", "first", "nodes", "result"],
  1481. referencedClasses: []
  1482. }),
  1483. smalltalk.ASTInterpreter);
  1484. smalltalk.addMethod(
  1485. smalltalk.method({
  1486. selector: "interpretBlockSequenceNode:continue:",
  1487. category: 'interpreting',
  1488. fn: function (aNode,aBlock){
  1489. var self=this;
  1490. return smalltalk.withContext(function($ctx1) {
  1491. self._interpretSequenceNode_continue_(aNode,aBlock);
  1492. return self}, function($ctx1) {$ctx1.fill(self,"interpretBlockSequenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1493. args: ["aNode", "aBlock"],
  1494. source: "interpretBlockSequenceNode: aNode continue: aBlock\x0a\x09self interpretSequenceNode: aNode continue: aBlock",
  1495. messageSends: ["interpretSequenceNode:continue:"],
  1496. referencedClasses: []
  1497. }),
  1498. smalltalk.ASTInterpreter);
  1499. smalltalk.addMethod(
  1500. smalltalk.method({
  1501. selector: "interpretCascadeNode:continue:",
  1502. category: 'interpreting',
  1503. fn: function (aNode,aBlock){
  1504. var self=this;
  1505. return smalltalk.withContext(function($ctx1) {
  1506. self._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  1507. return smalltalk.withContext(function($ctx2) {
  1508. _st(_st(aNode)._nodes())._do_((function(each){
  1509. return smalltalk.withContext(function($ctx3) {
  1510. return _st(each)._receiver_(receiver);
  1511. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}));
  1512. return self._interpretAll_continue_(_st(_st(aNode)._nodes())._allButLast(),(function(){
  1513. return smalltalk.withContext(function($ctx3) {
  1514. return self._interpret_continue_(_st(_st(aNode)._nodes())._last(),(function(val){
  1515. return smalltalk.withContext(function($ctx4) {
  1516. return self._continue_value_(aBlock,val);
  1517. }, function($ctx4) {$ctx4.fillBlock({val:val},$ctx3,4)})}));
  1518. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  1519. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1,1)})}));
  1520. return self}, function($ctx1) {$ctx1.fill(self,"interpretCascadeNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1521. args: ["aNode", "aBlock"],
  1522. source: "interpretCascadeNode: aNode continue: aBlock\x0a\x09\x22TODO: Handle super sends\x22\x0a\x09\x0a\x09self interpret: aNode receiver continue: [ :receiver |\x0a\x09\x09\x22Only interpret the receiver once\x22\x0a\x09\x09aNode nodes do: [ :each | each receiver: receiver ].\x0a\x0a\x09\x09self\x0a\x09\x09\x09interpretAll: aNode nodes allButLast\x0a\x09\x09\x09continue: [\x0a\x09\x09\x09\x09self\x0a\x09\x09\x09\x09\x09interpret: aNode nodes last\x0a\x09\x09\x09\x09\x09continue: [ :val | self continue: aBlock value: val ] ] ]",
  1523. messageSends: ["interpret:continue:", "receiver", "do:", "nodes", "receiver:", "interpretAll:continue:", "allButLast", "last", "continue:value:"],
  1524. referencedClasses: []
  1525. }),
  1526. smalltalk.ASTInterpreter);
  1527. smalltalk.addMethod(
  1528. smalltalk.method({
  1529. selector: "interpretClassReferenceNode:continue:",
  1530. category: 'interpreting',
  1531. fn: function (aNode,aBlock){
  1532. var self=this;
  1533. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1534. return smalltalk.withContext(function($ctx1) {
  1535. self._continue_value_(aBlock,_st(_st($Smalltalk())._current())._at_(_st(aNode)._value()));
  1536. return self}, function($ctx1) {$ctx1.fill(self,"interpretClassReferenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1537. args: ["aNode", "aBlock"],
  1538. source: "interpretClassReferenceNode: aNode continue: aBlock\x0a\x09self continue: aBlock value: (Smalltalk current at: aNode value)",
  1539. messageSends: ["continue:value:", "at:", "current", "value"],
  1540. referencedClasses: ["Smalltalk"]
  1541. }),
  1542. smalltalk.ASTInterpreter);
  1543. smalltalk.addMethod(
  1544. smalltalk.method({
  1545. selector: "interpretDynamicArrayNode:continue:",
  1546. category: 'interpreting',
  1547. fn: function (aNode,aBlock){
  1548. var self=this;
  1549. return smalltalk.withContext(function($ctx1) {
  1550. self._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  1551. return smalltalk.withContext(function($ctx2) {
  1552. return self._continue_value_(aBlock,array);
  1553. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1,1)})}));
  1554. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicArrayNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1555. args: ["aNode", "aBlock"],
  1556. source: "interpretDynamicArrayNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array |\x0a\x09\x09self\x0a\x09\x09\x09continue: aBlock\x0a\x09\x09\x09value: array ]",
  1557. messageSends: ["interpretAll:continue:", "nodes", "continue:value:"],
  1558. referencedClasses: []
  1559. }),
  1560. smalltalk.ASTInterpreter);
  1561. smalltalk.addMethod(
  1562. smalltalk.method({
  1563. selector: "interpretDynamicDictionaryNode:continue:",
  1564. category: 'interpreting',
  1565. fn: function (aNode,aBlock){
  1566. var self=this;
  1567. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1568. return smalltalk.withContext(function($ctx1) {
  1569. self._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  1570. var hashedCollection;
  1571. return smalltalk.withContext(function($ctx2) {
  1572. hashedCollection=_st($HashedCollection())._new();
  1573. hashedCollection;
  1574. _st(array)._do_((function(each){
  1575. return smalltalk.withContext(function($ctx3) {
  1576. return _st(hashedCollection)._add_(each);
  1577. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}));
  1578. return self._continue_value_(aBlock,hashedCollection);
  1579. }, function($ctx2) {$ctx2.fillBlock({array:array,hashedCollection:hashedCollection},$ctx1,1)})}));
  1580. return self}, function($ctx1) {$ctx1.fill(self,"interpretDynamicDictionaryNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1581. args: ["aNode", "aBlock"],
  1582. source: "interpretDynamicDictionaryNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array | | hashedCollection |\x0a\x09\x09hashedCollection := HashedCollection new.\x0a\x09\x09array do: [ :each | hashedCollection add: each ].\x0a\x09\x09self\x0a\x09\x09\x09continue: aBlock\x0a\x09\x09\x09value: hashedCollection ]",
  1583. messageSends: ["interpretAll:continue:", "nodes", "new", "do:", "add:", "continue:value:"],
  1584. referencedClasses: ["HashedCollection"]
  1585. }),
  1586. smalltalk.ASTInterpreter);
  1587. smalltalk.addMethod(
  1588. smalltalk.method({
  1589. selector: "interpretJSStatementNode:continue:",
  1590. category: 'interpreting',
  1591. fn: function (aNode,aBlock){
  1592. var self=this;
  1593. return smalltalk.withContext(function($ctx1) {
  1594. self["@shouldReturn"]=true;
  1595. self._continue_value_(aBlock,self._eval_(_st(aNode)._source()));
  1596. return self}, function($ctx1) {$ctx1.fill(self,"interpretJSStatementNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1597. args: ["aNode", "aBlock"],
  1598. source: "interpretJSStatementNode: aNode continue: aBlock\x0a\x09shouldReturn := true.\x0a\x09self continue: aBlock value: (self eval: aNode source)",
  1599. messageSends: ["continue:value:", "eval:", "source"],
  1600. referencedClasses: []
  1601. }),
  1602. smalltalk.ASTInterpreter);
  1603. smalltalk.addMethod(
  1604. smalltalk.method({
  1605. selector: "interpretMethodNode:continue:",
  1606. category: 'interpreting',
  1607. fn: function (aNode,aBlock){
  1608. var self=this;
  1609. return smalltalk.withContext(function($ctx1) {
  1610. self._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  1611. return smalltalk.withContext(function($ctx2) {
  1612. return self._continue_value_(aBlock,_st(array)._first());
  1613. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1,1)})}));
  1614. return self}, function($ctx1) {$ctx1.fill(self,"interpretMethodNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1615. args: ["aNode", "aBlock"],
  1616. source: "interpretMethodNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array |\x0a\x09\x09self continue: aBlock value: array first ]",
  1617. messageSends: ["interpretAll:continue:", "nodes", "continue:value:", "first"],
  1618. referencedClasses: []
  1619. }),
  1620. smalltalk.ASTInterpreter);
  1621. smalltalk.addMethod(
  1622. smalltalk.method({
  1623. selector: "interpretNode:continue:",
  1624. category: 'interpreting',
  1625. fn: function (aNode,aBlock){
  1626. var self=this;
  1627. return smalltalk.withContext(function($ctx1) {
  1628. _st(aNode)._interpreter_continue_(self,aBlock);
  1629. return self}, function($ctx1) {$ctx1.fill(self,"interpretNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1630. args: ["aNode", "aBlock"],
  1631. source: "interpretNode: aNode continue: aBlock\x0a\x09aNode interpreter: self continue: aBlock",
  1632. messageSends: ["interpreter:continue:"],
  1633. referencedClasses: []
  1634. }),
  1635. smalltalk.ASTInterpreter);
  1636. smalltalk.addMethod(
  1637. smalltalk.method({
  1638. selector: "interpretReturnNode:continue:",
  1639. category: 'interpreting',
  1640. fn: function (aNode,aBlock){
  1641. var self=this;
  1642. return smalltalk.withContext(function($ctx1) {
  1643. self._interpret_continue_(_st(_st(aNode)._nodes())._first(),(function(value){
  1644. return smalltalk.withContext(function($ctx2) {
  1645. self["@shouldReturn"]=true;
  1646. self["@shouldReturn"];
  1647. return self._continue_value_(aBlock,value);
  1648. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)})}));
  1649. return self}, function($ctx1) {$ctx1.fill(self,"interpretReturnNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1650. args: ["aNode", "aBlock"],
  1651. source: "interpretReturnNode: aNode continue: aBlock\x0a\x09self interpret: aNode nodes first continue: [ :value |\x0a\x09\x09shouldReturn := true.\x0a\x09\x09self continue: aBlock value: value ]",
  1652. messageSends: ["interpret:continue:", "first", "nodes", "continue:value:"],
  1653. referencedClasses: []
  1654. }),
  1655. smalltalk.ASTInterpreter);
  1656. smalltalk.addMethod(
  1657. smalltalk.method({
  1658. selector: "interpretSendNode:continue:",
  1659. category: 'interpreting',
  1660. fn: function (aNode,aBlock){
  1661. var self=this;
  1662. return smalltalk.withContext(function($ctx1) {
  1663. self._interpret_continue_(_st(aNode)._receiver(),(function(receiver){
  1664. return smalltalk.withContext(function($ctx2) {
  1665. return self._interpretAll_continue_(_st(aNode)._arguments(),(function(args){
  1666. return smalltalk.withContext(function($ctx3) {
  1667. return self._messageFromSendNode_arguments_do_(aNode,args,(function(message){
  1668. return smalltalk.withContext(function($ctx4) {
  1669. _st(self._context())._pc_(_st(_st(self._context())._pc()).__plus((1)));
  1670. return self._continue_value_(aBlock,self._sendMessage_to_superSend_(message,receiver,_st(aNode)._superSend()));
  1671. }, function($ctx4) {$ctx4.fillBlock({message:message},$ctx3,3)})}));
  1672. }, function($ctx3) {$ctx3.fillBlock({args:args},$ctx2,2)})}));
  1673. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver},$ctx1,1)})}));
  1674. return self}, function($ctx1) {$ctx1.fill(self,"interpretSendNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1675. args: ["aNode", "aBlock"],
  1676. source: "interpretSendNode: aNode continue: aBlock\x0a\x09self interpret: aNode receiver continue: [ :receiver |\x0a\x09\x09self interpretAll: aNode arguments continue: [ :args |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09messageFromSendNode: aNode\x0a\x09\x09\x09\x09arguments: args\x0a\x09\x09\x09\x09do: [ :message |\x0a\x09\x09\x09\x09\x09self context pc: self context pc + 1.\x0a\x09\x09\x09\x09\x09self\x0a\x09\x09\x09\x09\x09\x09continue: aBlock\x0a\x09\x09\x09\x09\x09\x09value: (self sendMessage: message to: receiver superSend: aNode superSend) ] ] ]",
  1677. messageSends: ["interpret:continue:", "receiver", "interpretAll:continue:", "arguments", "messageFromSendNode:arguments:do:", "pc:", "context", "+", "pc", "continue:value:", "sendMessage:to:superSend:", "superSend"],
  1678. referencedClasses: []
  1679. }),
  1680. smalltalk.ASTInterpreter);
  1681. smalltalk.addMethod(
  1682. smalltalk.method({
  1683. selector: "interpretSequenceNode:continue:",
  1684. category: 'interpreting',
  1685. fn: function (aNode,aBlock){
  1686. var self=this;
  1687. return smalltalk.withContext(function($ctx1) {
  1688. self._interpretAll_continue_(_st(aNode)._nodes(),(function(array){
  1689. return smalltalk.withContext(function($ctx2) {
  1690. return self._continue_value_(aBlock,_st(array)._last());
  1691. }, function($ctx2) {$ctx2.fillBlock({array:array},$ctx1,1)})}));
  1692. return self}, function($ctx1) {$ctx1.fill(self,"interpretSequenceNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1693. args: ["aNode", "aBlock"],
  1694. source: "interpretSequenceNode: aNode continue: aBlock\x0a\x09self interpretAll: aNode nodes continue: [ :array |\x0a\x09\x09self continue: aBlock value: array last ]",
  1695. messageSends: ["interpretAll:continue:", "nodes", "continue:value:", "last"],
  1696. referencedClasses: []
  1697. }),
  1698. smalltalk.ASTInterpreter);
  1699. smalltalk.addMethod(
  1700. smalltalk.method({
  1701. selector: "interpretValueNode:continue:",
  1702. category: 'interpreting',
  1703. fn: function (aNode,aBlock){
  1704. var self=this;
  1705. return smalltalk.withContext(function($ctx1) {
  1706. self._continue_value_(aBlock,_st(aNode)._value());
  1707. return self}, function($ctx1) {$ctx1.fill(self,"interpretValueNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1708. args: ["aNode", "aBlock"],
  1709. source: "interpretValueNode: aNode continue: aBlock\x0a\x09self continue: aBlock value: aNode value",
  1710. messageSends: ["continue:value:", "value"],
  1711. referencedClasses: []
  1712. }),
  1713. smalltalk.ASTInterpreter);
  1714. smalltalk.addMethod(
  1715. smalltalk.method({
  1716. selector: "interpretVariableNode:continue:",
  1717. category: 'interpreting',
  1718. fn: function (aNode,aBlock){
  1719. var self=this;
  1720. return smalltalk.withContext(function($ctx1) {
  1721. var $1,$2,$4,$5,$6,$3;
  1722. $1=self;
  1723. $2=aBlock;
  1724. $4=_st(_st(aNode)._binding())._isInstanceVar();
  1725. $5=(function(){
  1726. return smalltalk.withContext(function($ctx2) {
  1727. return _st(_st(self._context())._receiver())._instVarAt_(_st(aNode)._value());
  1728. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  1729. $6=(function(){
  1730. return smalltalk.withContext(function($ctx2) {
  1731. return _st(self._context())._localAt_(_st(aNode)._value());
  1732. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})});
  1733. $3=_st($4)._ifTrue_ifFalse_($5,$6);
  1734. _st($1)._continue_value_($2,$3);
  1735. return self}, function($ctx1) {$ctx1.fill(self,"interpretVariableNode:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1736. args: ["aNode", "aBlock"],
  1737. source: "interpretVariableNode: aNode continue: aBlock\x0a\x09self\x0a\x09\x09continue: aBlock\x0a\x09\x09value: (aNode binding isInstanceVar\x0a\x09\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09\x09ifFalse: [ self context localAt: aNode value ])",
  1738. messageSends: ["continue:value:", "ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:", "receiver", "context", "value", "localAt:"],
  1739. referencedClasses: []
  1740. }),
  1741. smalltalk.ASTInterpreter);
  1742. smalltalk.addMethod(
  1743. smalltalk.method({
  1744. selector: "messageFromSendNode:arguments:do:",
  1745. category: 'private',
  1746. fn: function (aSendNode,aCollection,aBlock){
  1747. var self=this;
  1748. function $Message(){return smalltalk.Message||(typeof Message=="undefined"?nil:Message)}
  1749. return smalltalk.withContext(function($ctx1) {
  1750. var $1,$2;
  1751. $1=_st($Message())._new();
  1752. _st($1)._selector_(_st(aSendNode)._selector());
  1753. _st($1)._arguments_(aCollection);
  1754. $2=_st($1)._yourself();
  1755. self._continue_value_(aBlock,$2);
  1756. return self}, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:do:",{aSendNode:aSendNode,aCollection:aCollection,aBlock:aBlock},smalltalk.ASTInterpreter)})},
  1757. args: ["aSendNode", "aCollection", "aBlock"],
  1758. source: "messageFromSendNode: aSendNode arguments: aCollection do: aBlock\x0a\x09self\x0a\x09\x09continue: aBlock\x0a\x09\x09value: (Message new\x0a\x09\x09\x09selector: aSendNode selector;\x0a\x09\x09\x09arguments: aCollection;\x0a\x09\x09\x09yourself)",
  1759. messageSends: ["continue:value:", "selector:", "new", "selector", "arguments:", "yourself"],
  1760. referencedClasses: ["Message"]
  1761. }),
  1762. smalltalk.ASTInterpreter);
  1763. smalltalk.addMethod(
  1764. smalltalk.method({
  1765. selector: "nextNode",
  1766. category: 'accessing',
  1767. fn: function (){
  1768. var self=this;
  1769. return smalltalk.withContext(function($ctx1) {
  1770. var $2,$3,$1;
  1771. $2=self["@nextNode"];
  1772. $3=(function(){
  1773. return smalltalk.withContext(function($ctx2) {
  1774. return self._currentNode();
  1775. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  1776. $1=_st($2)._ifNil_($3);
  1777. return $1;
  1778. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.ASTInterpreter)})},
  1779. args: [],
  1780. source: "nextNode\x0a\x09^ nextNode ifNil: [ self currentNode ]",
  1781. messageSends: ["ifNil:", "currentNode"],
  1782. referencedClasses: []
  1783. }),
  1784. smalltalk.ASTInterpreter);
  1785. smalltalk.addMethod(
  1786. smalltalk.method({
  1787. selector: "nextNode:",
  1788. category: 'accessing',
  1789. fn: function (aNode){
  1790. var self=this;
  1791. return smalltalk.withContext(function($ctx1) {
  1792. self["@nextNode"]=aNode;
  1793. return self}, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
  1794. args: ["aNode"],
  1795. source: "nextNode: aNode\x0a\x09nextNode := aNode",
  1796. messageSends: [],
  1797. referencedClasses: []
  1798. }),
  1799. smalltalk.ASTInterpreter);
  1800. smalltalk.addMethod(
  1801. smalltalk.method({
  1802. selector: "result",
  1803. category: 'accessing',
  1804. fn: function (){
  1805. var self=this;
  1806. return smalltalk.withContext(function($ctx1) {
  1807. var $1;
  1808. $1=self["@result"];
  1809. return $1;
  1810. }, function($ctx1) {$ctx1.fill(self,"result",{},smalltalk.ASTInterpreter)})},
  1811. args: [],
  1812. source: "result\x0a\x09^ result",
  1813. messageSends: [],
  1814. referencedClasses: []
  1815. }),
  1816. smalltalk.ASTInterpreter);
  1817. smalltalk.addMethod(
  1818. smalltalk.method({
  1819. selector: "sendMessage:to:superSend:",
  1820. category: 'private',
  1821. fn: function (aMessage,anObject,aBoolean){
  1822. var self=this;
  1823. var method;
  1824. return smalltalk.withContext(function($ctx1) {
  1825. var $1,$3,$2,$4,$6,$5,$7,$8;
  1826. var $early={};
  1827. try {
  1828. $1=aBoolean;
  1829. $2=(function(){
  1830. return smalltalk.withContext(function($ctx2) {
  1831. $3=_st(aMessage)._sendTo_(anObject);
  1832. throw $early=[$3];
  1833. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  1834. _st($1)._ifFalse_($2);
  1835. $4=_st(_st(anObject)._class())._superclass();
  1836. $5=(function(){
  1837. return smalltalk.withContext(function($ctx2) {
  1838. $6=self._messageNotUnderstood_receiver_(aMessage,anObject);
  1839. throw $early=[$6];
  1840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})});
  1841. _st($4)._ifNil_($5);
  1842. method=_st(_st(_st(_st(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_(_st(aMessage)._selector(),(function(){
  1843. return smalltalk.withContext(function($ctx2) {
  1844. $7=self._messageNotUnderstood_receiver_(aMessage,anObject);
  1845. throw $early=[$7];
  1846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1847. $8=_st(_st(method)._fn())._applyTo_arguments_(anObject,_st(aMessage)._arguments());
  1848. return $8;
  1849. }
  1850. catch(e) {if(e===$early)return e[0]; throw e}
  1851. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},smalltalk.ASTInterpreter)})},
  1852. args: ["aMessage", "anObject", "aBoolean"],
  1853. 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 fn applyTo: anObject arguments: aMessage arguments",
  1854. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "applyTo:arguments:", "fn", "arguments"],
  1855. referencedClasses: []
  1856. }),
  1857. smalltalk.ASTInterpreter);
  1858. smalltalk.addMethod(
  1859. smalltalk.method({
  1860. selector: "shouldReturn",
  1861. category: 'testing',
  1862. fn: function (){
  1863. var self=this;
  1864. return smalltalk.withContext(function($ctx1) {
  1865. var $2,$3,$1;
  1866. $2=self["@shouldReturn"];
  1867. $3=(function(){
  1868. return smalltalk.withContext(function($ctx2) {
  1869. return false;
  1870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  1871. $1=_st($2)._ifNil_($3);
  1872. return $1;
  1873. }, function($ctx1) {$ctx1.fill(self,"shouldReturn",{},smalltalk.ASTInterpreter)})},
  1874. args: [],
  1875. source: "shouldReturn\x0a\x09^ shouldReturn ifNil: [ false ]",
  1876. messageSends: ["ifNil:"],
  1877. referencedClasses: []
  1878. }),
  1879. smalltalk.ASTInterpreter);
  1880. smalltalk.addMethod(
  1881. smalltalk.method({
  1882. selector: "withBlockContext:",
  1883. category: 'private',
  1884. fn: function (aBlock){
  1885. var self=this;
  1886. var blockResult;
  1887. function $AIContext(){return smalltalk.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  1888. return smalltalk.withContext(function($ctx1) {
  1889. var $1,$2,$3;
  1890. $1=_st($AIContext())._new();
  1891. _st($1)._outerContext_(self._context());
  1892. $2=_st($1)._yourself();
  1893. self._context_($2);
  1894. blockResult=_st(aBlock)._value();
  1895. self._context_(_st(self._context())._outerContext());
  1896. $3=blockResult;
  1897. return $3;
  1898. }, function($ctx1) {$ctx1.fill(self,"withBlockContext:",{aBlock:aBlock,blockResult:blockResult},smalltalk.ASTInterpreter)})},
  1899. args: ["aBlock"],
  1900. source: "withBlockContext: aBlock\x0a\x09\x22Evaluate aBlock with a BlockContext:\x0a\x09- a context is pushed before aBlock evaluation.\x0a\x09- the context is poped after aBlock evaluation\x0a\x09- the result of aBlock evaluation is answered\x22\x0a\x09\x0a\x09| blockResult |\x0a\x09\x09\x09\x0a\x09self context: (AIContext new\x0a\x09\x09outerContext: self context;\x0a\x09\x09yourself).\x0a\x09\x0a\x09blockResult := aBlock value.\x0a\x09\x0a\x09self context: self context outerContext.\x0a\x09^ blockResult",
  1901. messageSends: ["context:", "outerContext:", "new", "context", "yourself", "value", "outerContext"],
  1902. referencedClasses: ["AIContext"]
  1903. }),
  1904. smalltalk.ASTInterpreter);
  1905. smalltalk.addClass('ASTSteppingInterpreter', smalltalk.ASTInterpreter, ['continuation', 'nextNode'], 'Compiler-Interpreter');
  1906. smalltalk.ASTSteppingInterpreter.comment="I am an interpreter with stepping capabilities. The higher level `ASTDebugger` class should be used as a debugger model, as it provides convenience methods for debugging.\x0a\x0a## API\x0a\x0aUse `#step` to actually interpret the next node. Interpretation stops at each node evaluation, weither it's a message node or not.\x0a\x0a\x0a## Usage example:\x0a\x0a\x09| ast interpreter |\x0a\x09ast := Smalltalk current parse: 'foo 1+2+4'.\x0a\x09(SemanticAnalyzer on: Object) visit: ast.\x0a\x0a\x09interpreter := ASTSteppingInterpreter new\x0a\x09\x09interpret: ast nodes first;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09interpreter step; step.\x0a\x09interpreter step; step.\x0a\x09interpreter result.\x22Answers 1\x22\x0a\x09interpreter step.\x0a\x09interpreter result. \x22Answers 3\x22\x0a\x09interpreter step.\x0a\x09interpreter result. \x22Answers 7\x22";
  1907. smalltalk.addMethod(
  1908. smalltalk.method({
  1909. selector: "atEnd",
  1910. category: 'testing',
  1911. fn: function (){
  1912. var self=this;
  1913. return smalltalk.withContext(function($ctx1) {
  1914. var $1;
  1915. $1=_st(self._shouldReturn())._or_((function(){
  1916. return smalltalk.withContext(function($ctx2) {
  1917. return _st(self._nextNode()).__eq_eq(self._currentNode());
  1918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1919. return $1;
  1920. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.ASTSteppingInterpreter)})},
  1921. args: [],
  1922. source: "atEnd\x0a\x09^ self shouldReturn or: [ self nextNode == self currentNode ]",
  1923. messageSends: ["or:", "shouldReturn", "==", "nextNode", "currentNode"],
  1924. referencedClasses: []
  1925. }),
  1926. smalltalk.ASTSteppingInterpreter);
  1927. smalltalk.addMethod(
  1928. smalltalk.method({
  1929. selector: "initialize",
  1930. category: 'initialization',
  1931. fn: function (){
  1932. var self=this;
  1933. return smalltalk.withContext(function($ctx1) {
  1934. smalltalk.ASTSteppingInterpreter.superclass.fn.prototype._initialize.apply(_st(self), []);
  1935. self["@continuation"]=(function(){
  1936. return smalltalk.withContext(function($ctx2) {
  1937. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  1938. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ASTSteppingInterpreter)})},
  1939. args: [],
  1940. source: "initialize\x0a\x09super initialize.\x0a\x09continuation := []",
  1941. messageSends: ["initialize"],
  1942. referencedClasses: []
  1943. }),
  1944. smalltalk.ASTSteppingInterpreter);
  1945. smalltalk.addMethod(
  1946. smalltalk.method({
  1947. selector: "interpret:continue:",
  1948. category: 'interpreting',
  1949. fn: function (aNode,aBlock){
  1950. var self=this;
  1951. return smalltalk.withContext(function($ctx1) {
  1952. self["@nextNode"]=aNode;
  1953. self["@continuation"]=(function(){
  1954. return smalltalk.withContext(function($ctx2) {
  1955. return smalltalk.ASTSteppingInterpreter.superclass.fn.prototype._interpret_continue_.apply(_st(self), [aNode,aBlock]);
  1956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  1957. return self}, function($ctx1) {$ctx1.fill(self,"interpret:continue:",{aNode:aNode,aBlock:aBlock},smalltalk.ASTSteppingInterpreter)})},
  1958. args: ["aNode", "aBlock"],
  1959. source: "interpret: aNode continue: aBlock\x0a\x09nextNode := aNode.\x0a\x09continuation := [\x0a\x09\x09super interpret: aNode continue: aBlock ]",
  1960. messageSends: ["interpret:continue:"],
  1961. referencedClasses: []
  1962. }),
  1963. smalltalk.ASTSteppingInterpreter);
  1964. smalltalk.addMethod(
  1965. smalltalk.method({
  1966. selector: "nextNode",
  1967. category: 'accessing',
  1968. fn: function (){
  1969. var self=this;
  1970. return smalltalk.withContext(function($ctx1) {
  1971. var $1;
  1972. $1=self["@nextNode"];
  1973. return $1;
  1974. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},smalltalk.ASTSteppingInterpreter)})},
  1975. args: [],
  1976. source: "nextNode\x0a\x09^ nextNode",
  1977. messageSends: [],
  1978. referencedClasses: []
  1979. }),
  1980. smalltalk.ASTSteppingInterpreter);
  1981. smalltalk.addMethod(
  1982. smalltalk.method({
  1983. selector: "step",
  1984. category: 'stepping',
  1985. fn: function (){
  1986. var self=this;
  1987. return smalltalk.withContext(function($ctx1) {
  1988. _st(self["@continuation"])._value();
  1989. return self}, function($ctx1) {$ctx1.fill(self,"step",{},smalltalk.ASTSteppingInterpreter)})},
  1990. args: [],
  1991. source: "step\x0a\x09continuation value",
  1992. messageSends: ["value"],
  1993. referencedClasses: []
  1994. }),
  1995. smalltalk.ASTSteppingInterpreter);
  1996. smalltalk.addClass('ASTPCNodeVisitor', smalltalk.NodeVisitor, ['useInlinings', 'pc', 'context', 'blockIndex', 'currentNode'], 'Compiler-Interpreter');
  1997. 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`";
  1998. smalltalk.addMethod(
  1999. smalltalk.method({
  2000. selector: "blockIndex",
  2001. category: 'accessing',
  2002. fn: function (){
  2003. var self=this;
  2004. return smalltalk.withContext(function($ctx1) {
  2005. var $2,$3,$1;
  2006. $2=self["@blockIndex"];
  2007. $3=(function(){
  2008. return smalltalk.withContext(function($ctx2) {
  2009. self["@blockIndex"]=(0);
  2010. return self["@blockIndex"];
  2011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  2012. $1=_st($2)._ifNil_($3);
  2013. return $1;
  2014. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},smalltalk.ASTPCNodeVisitor)})},
  2015. args: [],
  2016. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ blockIndex := 0 ]",
  2017. messageSends: ["ifNil:"],
  2018. referencedClasses: []
  2019. }),
  2020. smalltalk.ASTPCNodeVisitor);
  2021. smalltalk.addMethod(
  2022. smalltalk.method({
  2023. selector: "context",
  2024. category: 'accessing',
  2025. fn: function (){
  2026. var self=this;
  2027. return smalltalk.withContext(function($ctx1) {
  2028. var $1;
  2029. $1=self["@context"];
  2030. return $1;
  2031. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.ASTPCNodeVisitor)})},
  2032. args: [],
  2033. source: "context\x0a\x09^ context",
  2034. messageSends: [],
  2035. referencedClasses: []
  2036. }),
  2037. smalltalk.ASTPCNodeVisitor);
  2038. smalltalk.addMethod(
  2039. smalltalk.method({
  2040. selector: "context:",
  2041. category: 'accessing',
  2042. fn: function (aContext){
  2043. var self=this;
  2044. return smalltalk.withContext(function($ctx1) {
  2045. self["@context"]=aContext;
  2046. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.ASTPCNodeVisitor)})},
  2047. args: ["aContext"],
  2048. source: "context: aContext\x0a\x09context := aContext",
  2049. messageSends: [],
  2050. referencedClasses: []
  2051. }),
  2052. smalltalk.ASTPCNodeVisitor);
  2053. smalltalk.addMethod(
  2054. smalltalk.method({
  2055. selector: "currentNode",
  2056. category: 'accessing',
  2057. fn: function (){
  2058. var self=this;
  2059. return smalltalk.withContext(function($ctx1) {
  2060. var $1;
  2061. $1=self["@currentNode"];
  2062. return $1;
  2063. }, function($ctx1) {$ctx1.fill(self,"currentNode",{},smalltalk.ASTPCNodeVisitor)})},
  2064. args: [],
  2065. source: "currentNode\x0a\x09^ currentNode",
  2066. messageSends: [],
  2067. referencedClasses: []
  2068. }),
  2069. smalltalk.ASTPCNodeVisitor);
  2070. smalltalk.addMethod(
  2071. smalltalk.method({
  2072. selector: "increaseBlockIndex",
  2073. category: 'accessing',
  2074. fn: function (){
  2075. var self=this;
  2076. return smalltalk.withContext(function($ctx1) {
  2077. self["@blockIndex"]=_st(self._blockIndex()).__plus((1));
  2078. return self}, function($ctx1) {$ctx1.fill(self,"increaseBlockIndex",{},smalltalk.ASTPCNodeVisitor)})},
  2079. args: [],
  2080. source: "increaseBlockIndex\x0a\x09blockIndex := self blockIndex + 1",
  2081. messageSends: ["+", "blockIndex"],
  2082. referencedClasses: []
  2083. }),
  2084. smalltalk.ASTPCNodeVisitor);
  2085. smalltalk.addMethod(
  2086. smalltalk.method({
  2087. selector: "pc",
  2088. category: 'accessing',
  2089. fn: function (){
  2090. var self=this;
  2091. return smalltalk.withContext(function($ctx1) {
  2092. var $2,$3,$1;
  2093. $2=self["@pc"];
  2094. $3=(function(){
  2095. return smalltalk.withContext(function($ctx2) {
  2096. return (0);
  2097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  2098. $1=_st($2)._ifNil_($3);
  2099. return $1;
  2100. }, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.ASTPCNodeVisitor)})},
  2101. args: [],
  2102. source: "pc\x0a\x09^ pc ifNil: [ 0 ]",
  2103. messageSends: ["ifNil:"],
  2104. referencedClasses: []
  2105. }),
  2106. smalltalk.ASTPCNodeVisitor);
  2107. smalltalk.addMethod(
  2108. smalltalk.method({
  2109. selector: "pc:",
  2110. category: 'accessing',
  2111. fn: function (anInteger){
  2112. var self=this;
  2113. return smalltalk.withContext(function($ctx1) {
  2114. self["@pc"]=anInteger;
  2115. return self}, function($ctx1) {$ctx1.fill(self,"pc:",{anInteger:anInteger},smalltalk.ASTPCNodeVisitor)})},
  2116. args: ["anInteger"],
  2117. source: "pc: anInteger\x0a\x09pc := anInteger",
  2118. messageSends: [],
  2119. referencedClasses: []
  2120. }),
  2121. smalltalk.ASTPCNodeVisitor);
  2122. smalltalk.addMethod(
  2123. smalltalk.method({
  2124. selector: "useInlinings",
  2125. category: 'accessing',
  2126. fn: function (){
  2127. var self=this;
  2128. return smalltalk.withContext(function($ctx1) {
  2129. var $2,$3,$1;
  2130. $2=self["@useInlinings"];
  2131. $3=(function(){
  2132. return smalltalk.withContext(function($ctx2) {
  2133. return true;
  2134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  2135. $1=_st($2)._ifNil_($3);
  2136. return $1;
  2137. }, function($ctx1) {$ctx1.fill(self,"useInlinings",{},smalltalk.ASTPCNodeVisitor)})},
  2138. args: [],
  2139. source: "useInlinings\x0a\x09^ useInlinings ifNil: [ true ]",
  2140. messageSends: ["ifNil:"],
  2141. referencedClasses: []
  2142. }),
  2143. smalltalk.ASTPCNodeVisitor);
  2144. smalltalk.addMethod(
  2145. smalltalk.method({
  2146. selector: "useInlinings:",
  2147. category: 'accessing',
  2148. fn: function (aBoolean){
  2149. var self=this;
  2150. return smalltalk.withContext(function($ctx1) {
  2151. self["@useInlinings"]=aBoolean;
  2152. return self}, function($ctx1) {$ctx1.fill(self,"useInlinings:",{aBoolean:aBoolean},smalltalk.ASTPCNodeVisitor)})},
  2153. args: ["aBoolean"],
  2154. source: "useInlinings: aBoolean\x0a\x09useInlinings := aBoolean",
  2155. messageSends: [],
  2156. referencedClasses: []
  2157. }),
  2158. smalltalk.ASTPCNodeVisitor);
  2159. smalltalk.addMethod(
  2160. smalltalk.method({
  2161. selector: "visitBlockNode:",
  2162. category: 'visiting',
  2163. fn: function (aNode){
  2164. var self=this;
  2165. return smalltalk.withContext(function($ctx1) {
  2166. var $1,$2;
  2167. $1=_st(_st(_st(aNode)._parent())._isSendNode())._and_((function(){
  2168. return smalltalk.withContext(function($ctx2) {
  2169. return _st(_st(aNode)._parent())._shouldBeInlined();
  2170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2171. if(smalltalk.assert($1)){
  2172. smalltalk.ASTPCNodeVisitor.superclass.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]);
  2173. } else {
  2174. $2=_st(self._blockIndex()).__gt_eq(_st(self._context())._index());
  2175. if(! smalltalk.assert($2)){
  2176. self._increaseBlockIndex();
  2177. smalltalk.ASTPCNodeVisitor.superclass.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]);
  2178. };
  2179. };
  2180. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},smalltalk.ASTPCNodeVisitor)})},
  2181. args: ["aNode"],
  2182. 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 ]",
  2183. messageSends: ["ifFalse:ifTrue:", "and:", "isSendNode", "parent", "shouldBeInlined", "ifFalse:", ">=", "blockIndex", "index", "context", "increaseBlockIndex", "visitBlockNode:"],
  2184. referencedClasses: []
  2185. }),
  2186. smalltalk.ASTPCNodeVisitor);
  2187. smalltalk.addMethod(
  2188. smalltalk.method({
  2189. selector: "visitJSStatementNode:",
  2190. category: 'visiting',
  2191. fn: function (aNode){
  2192. var self=this;
  2193. return smalltalk.withContext(function($ctx1) {
  2194. self["@currentNode"]=aNode;
  2195. return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.ASTPCNodeVisitor)})},
  2196. args: ["aNode"],
  2197. source: "visitJSStatementNode: aNode\x0a\x09currentNode := aNode",
  2198. messageSends: [],
  2199. referencedClasses: []
  2200. }),
  2201. smalltalk.ASTPCNodeVisitor);
  2202. smalltalk.addMethod(
  2203. smalltalk.method({
  2204. selector: "visitSendNode:",
  2205. category: 'visiting',
  2206. fn: function (aNode){
  2207. var self=this;
  2208. return smalltalk.withContext(function($ctx1) {
  2209. var $1,$3,$5,$6,$4,$2;
  2210. smalltalk.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
  2211. $1=_st(self._pc()).__eq(_st(self._context())._pc());
  2212. $2=(function(){
  2213. return smalltalk.withContext(function($ctx2) {
  2214. $3=_st(aNode)._shouldBeInlined();
  2215. $4=(function(){
  2216. return smalltalk.withContext(function($ctx3) {
  2217. $5=_st(self._blockIndex()).__eq(_st(self._context())._index());
  2218. $6=(function(){
  2219. return smalltalk.withContext(function($ctx4) {
  2220. self._pc_(_st(self._pc()).__plus((1)));
  2221. self["@currentNode"]=aNode;
  2222. return self["@currentNode"];
  2223. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)})});
  2224. return _st($5)._ifTrue_($6);
  2225. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})});
  2226. return _st($3)._ifFalse_($4);
  2227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  2228. _st($1)._ifFalse_($2);
  2229. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},smalltalk.ASTPCNodeVisitor)})},
  2230. args: ["aNode"],
  2231. 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 ] ] ]",
  2232. messageSends: ["visitSendNode:", "ifFalse:", "=", "pc", "context", "shouldBeInlined", "ifTrue:", "blockIndex", "index", "pc:", "+"],
  2233. referencedClasses: []
  2234. }),
  2235. smalltalk.ASTPCNodeVisitor);
  2236. smalltalk.addClass('Interpreter', smalltalk.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned'], 'Compiler-Interpreter');
  2237. smalltalk.addMethod(
  2238. smalltalk.method({
  2239. selector: "assign:to:",
  2240. category: 'private',
  2241. fn: function (aNode,anObject){
  2242. var self=this;
  2243. return smalltalk.withContext(function($ctx1) {
  2244. var $1,$2,$3;
  2245. $1=_st(_st(aNode)._binding())._isInstanceVar();
  2246. $2=(function(){
  2247. return smalltalk.withContext(function($ctx2) {
  2248. return _st(_st(self._context())._receiver())._instVarAt_put_(_st(aNode)._value(),anObject);
  2249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  2250. $3=(function(){
  2251. return smalltalk.withContext(function($ctx2) {
  2252. return _st(self._context())._localAt_put_(_st(aNode)._value(),anObject);
  2253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})});
  2254. _st($1)._ifTrue_ifFalse_($2,$3);
  2255. return self}, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},smalltalk.Interpreter)})},
  2256. args: ["aNode", "anObject"],
  2257. 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 ]",
  2258. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"],
  2259. referencedClasses: []
  2260. }),
  2261. smalltalk.Interpreter);
  2262. smalltalk.addMethod(
  2263. smalltalk.method({
  2264. selector: "atEnd",
  2265. category: 'testing',
  2266. fn: function (){
  2267. var self=this;
  2268. return smalltalk.withContext(function($ctx1) {
  2269. var $1;
  2270. $1=_st(self._hasReturned())._or_((function(){
  2271. return smalltalk.withContext(function($ctx2) {
  2272. return _st(self._node())._isNil();
  2273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2274. return $1;
  2275. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},smalltalk.Interpreter)})},
  2276. args: [],
  2277. source: "atEnd\x0a\x09^ self hasReturned or: [ self node isNil ]",
  2278. messageSends: ["or:", "hasReturned", "isNil", "node"],
  2279. referencedClasses: []
  2280. }),
  2281. smalltalk.Interpreter);
  2282. smalltalk.addMethod(
  2283. smalltalk.method({
  2284. selector: "context",
  2285. category: 'accessing',
  2286. fn: function (){
  2287. var self=this;
  2288. return smalltalk.withContext(function($ctx1) {
  2289. var $1;
  2290. $1=self["@context"];
  2291. return $1;
  2292. }, function($ctx1) {$ctx1.fill(self,"context",{},smalltalk.Interpreter)})},
  2293. args: [],
  2294. source: "context\x0a\x09^ context",
  2295. messageSends: [],
  2296. referencedClasses: []
  2297. }),
  2298. smalltalk.Interpreter);
  2299. smalltalk.addMethod(
  2300. smalltalk.method({
  2301. selector: "context:",
  2302. category: 'accessing',
  2303. fn: function (aContext){
  2304. var self=this;
  2305. return smalltalk.withContext(function($ctx1) {
  2306. self["@context"]=aContext;
  2307. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},smalltalk.Interpreter)})},
  2308. args: ["aContext"],
  2309. source: "context: aContext\x0a\x09context := aContext",
  2310. messageSends: [],
  2311. referencedClasses: []
  2312. }),
  2313. smalltalk.Interpreter);
  2314. smalltalk.addMethod(
  2315. smalltalk.method({
  2316. selector: "eval:",
  2317. category: 'private',
  2318. fn: function (aString){
  2319. var self=this;
  2320. var source,function_;
  2321. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  2322. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  2323. return smalltalk.withContext(function($ctx1) {
  2324. var $1,$2,$3;
  2325. source=_st($String())._streamContents_((function(str){
  2326. return smalltalk.withContext(function($ctx2) {
  2327. _st(str)._nextPutAll_("(function(");
  2328. _st(_st(_st(self._context())._locals())._keys())._do_separatedBy_((function(each){
  2329. return smalltalk.withContext(function($ctx3) {
  2330. return _st(str)._nextPutAll_(each);
  2331. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  2332. return smalltalk.withContext(function($ctx3) {
  2333. return _st(str)._nextPutAll_(",");
  2334. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2335. $1=str;
  2336. _st($1)._nextPutAll_("){ return (function() {");
  2337. _st($1)._nextPutAll_(aString);
  2338. $2=_st($1)._nextPutAll_("})() })");
  2339. return $2;
  2340. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  2341. function_=_st(_st($Compiler())._new())._eval_(source);
  2342. $3=_st(function_)._valueWithPossibleArguments_(_st(_st(self._context())._locals())._values());
  2343. return $3;
  2344. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},smalltalk.Interpreter)})},
  2345. args: ["aString"],
  2346. 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",
  2347. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"],
  2348. referencedClasses: ["String", "Compiler"]
  2349. }),
  2350. smalltalk.Interpreter);
  2351. smalltalk.addMethod(
  2352. smalltalk.method({
  2353. selector: "hasReturned",
  2354. category: 'testing',
  2355. fn: function (){
  2356. var self=this;
  2357. return smalltalk.withContext(function($ctx1) {
  2358. var $2,$1;
  2359. $2=self["@returned"];
  2360. if(($receiver = $2) == nil || $receiver == undefined){
  2361. $1=false;
  2362. } else {
  2363. $1=$2;
  2364. };
  2365. return $1;
  2366. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},smalltalk.Interpreter)})},
  2367. args: [],
  2368. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  2369. messageSends: ["ifNil:"],
  2370. referencedClasses: []
  2371. }),
  2372. smalltalk.Interpreter);
  2373. smalltalk.addMethod(
  2374. smalltalk.method({
  2375. selector: "interpret",
  2376. category: 'interpreting',
  2377. fn: function (){
  2378. var self=this;
  2379. return smalltalk.withContext(function($ctx1) {
  2380. self._visit_(self._node());
  2381. return self}, function($ctx1) {$ctx1.fill(self,"interpret",{},smalltalk.Interpreter)})},
  2382. args: [],
  2383. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  2384. messageSends: ["visit:", "node"],
  2385. referencedClasses: []
  2386. }),
  2387. smalltalk.Interpreter);
  2388. smalltalk.addMethod(
  2389. smalltalk.method({
  2390. selector: "interpret:",
  2391. category: 'interpreting',
  2392. fn: function (aNode){
  2393. var self=this;
  2394. return smalltalk.withContext(function($ctx1) {
  2395. self._node_(aNode);
  2396. self._interpret();
  2397. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},smalltalk.Interpreter)})},
  2398. args: ["aNode"],
  2399. source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret",
  2400. messageSends: ["node:", "interpret"],
  2401. referencedClasses: []
  2402. }),
  2403. smalltalk.Interpreter);
  2404. smalltalk.addMethod(
  2405. smalltalk.method({
  2406. selector: "messageFromSendNode:arguments:",
  2407. category: 'private',
  2408. fn: function (aSendNode,aCollection){
  2409. var self=this;
  2410. function $Message(){return smalltalk.Message||(typeof Message=="undefined"?nil:Message)}
  2411. return smalltalk.withContext(function($ctx1) {
  2412. var $2,$3,$1;
  2413. $2=_st($Message())._new();
  2414. _st($2)._selector_(_st(aSendNode)._selector());
  2415. _st($2)._arguments_(aCollection);
  2416. $3=_st($2)._yourself();
  2417. $1=$3;
  2418. return $1;
  2419. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},smalltalk.Interpreter)})},
  2420. args: ["aSendNode", "aCollection"],
  2421. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  2422. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"],
  2423. referencedClasses: ["Message"]
  2424. }),
  2425. smalltalk.Interpreter);
  2426. smalltalk.addMethod(
  2427. smalltalk.method({
  2428. selector: "messageNotUnderstood:receiver:",
  2429. category: 'private',
  2430. fn: function (aMessage,anObject){
  2431. var self=this;
  2432. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  2433. return smalltalk.withContext(function($ctx1) {
  2434. var $1,$2;
  2435. $1=_st($MessageNotUnderstood())._new();
  2436. _st($1)._meesage_(aMessage);
  2437. _st($1)._receiver_(anObject);
  2438. $2=_st($1)._signal();
  2439. return self}, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},smalltalk.Interpreter)})},
  2440. args: ["aMessage", "anObject"],
  2441. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  2442. messageSends: ["meesage:", "new", "receiver:", "signal"],
  2443. referencedClasses: ["MessageNotUnderstood"]
  2444. }),
  2445. smalltalk.Interpreter);
  2446. smalltalk.addMethod(
  2447. smalltalk.method({
  2448. selector: "next",
  2449. category: 'interpreting',
  2450. fn: function (){
  2451. var self=this;
  2452. return smalltalk.withContext(function($ctx1) {
  2453. self._node_(_st(self._node())._nextNode());
  2454. return self}, function($ctx1) {$ctx1.fill(self,"next",{},smalltalk.Interpreter)})},
  2455. args: [],
  2456. source: "next\x0a\x09self node: self node nextNode",
  2457. messageSends: ["node:", "nextNode", "node"],
  2458. referencedClasses: []
  2459. }),
  2460. smalltalk.Interpreter);
  2461. smalltalk.addMethod(
  2462. smalltalk.method({
  2463. selector: "node",
  2464. category: 'accessing',
  2465. fn: function (){
  2466. var self=this;
  2467. return smalltalk.withContext(function($ctx1) {
  2468. var $1;
  2469. $1=self["@node"];
  2470. return $1;
  2471. }, function($ctx1) {$ctx1.fill(self,"node",{},smalltalk.Interpreter)})},
  2472. args: [],
  2473. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  2474. messageSends: [],
  2475. referencedClasses: []
  2476. }),
  2477. smalltalk.Interpreter);
  2478. smalltalk.addMethod(
  2479. smalltalk.method({
  2480. selector: "node:",
  2481. category: 'accessing',
  2482. fn: function (aNode){
  2483. var self=this;
  2484. return smalltalk.withContext(function($ctx1) {
  2485. self["@node"]=aNode;
  2486. return self}, function($ctx1) {$ctx1.fill(self,"node:",{aNode:aNode},smalltalk.Interpreter)})},
  2487. args: ["aNode"],
  2488. source: "node: aNode\x0a\x09node := aNode",
  2489. messageSends: [],
  2490. referencedClasses: []
  2491. }),
  2492. smalltalk.Interpreter);
  2493. smalltalk.addMethod(
  2494. smalltalk.method({
  2495. selector: "peek",
  2496. category: 'stack',
  2497. fn: function (){
  2498. var self=this;
  2499. return smalltalk.withContext(function($ctx1) {
  2500. var $1;
  2501. var $early={};
  2502. try {
  2503. _st(self._stack())._ifEmpty_((function(){
  2504. return smalltalk.withContext(function($ctx2) {
  2505. throw $early=[nil];
  2506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2507. $1=_st(self._stack())._last();
  2508. return $1;
  2509. }
  2510. catch(e) {if(e===$early)return e[0]; throw e}
  2511. }, function($ctx1) {$ctx1.fill(self,"peek",{},smalltalk.Interpreter)})},
  2512. args: [],
  2513. 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",
  2514. messageSends: ["ifEmpty:", "stack", "last"],
  2515. referencedClasses: []
  2516. }),
  2517. smalltalk.Interpreter);
  2518. smalltalk.addMethod(
  2519. smalltalk.method({
  2520. selector: "pop",
  2521. category: 'stack',
  2522. fn: function (){
  2523. var self=this;
  2524. var peekedValue;
  2525. return smalltalk.withContext(function($ctx1) {
  2526. var $1;
  2527. peekedValue=self._peek();
  2528. _st(self._stack())._removeLast();
  2529. $1=peekedValue;
  2530. return $1;
  2531. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},smalltalk.Interpreter)})},
  2532. args: [],
  2533. 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",
  2534. messageSends: ["peek", "removeLast", "stack"],
  2535. referencedClasses: []
  2536. }),
  2537. smalltalk.Interpreter);
  2538. smalltalk.addMethod(
  2539. smalltalk.method({
  2540. selector: "proceed",
  2541. category: 'interpreting',
  2542. fn: function (){
  2543. var self=this;
  2544. return smalltalk.withContext(function($ctx1) {
  2545. _st((function(){
  2546. return smalltalk.withContext(function($ctx2) {
  2547. return self._atEnd();
  2548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  2549. return smalltalk.withContext(function($ctx2) {
  2550. return self._step();
  2551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2552. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},smalltalk.Interpreter)})},
  2553. args: [],
  2554. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] whileFalse: [ \x0a\x09\x09self step ]",
  2555. messageSends: ["whileFalse:", "atEnd", "step"],
  2556. referencedClasses: []
  2557. }),
  2558. smalltalk.Interpreter);
  2559. smalltalk.addMethod(
  2560. smalltalk.method({
  2561. selector: "push:",
  2562. category: 'stack',
  2563. fn: function (anObject){
  2564. var self=this;
  2565. return smalltalk.withContext(function($ctx1) {
  2566. var $1;
  2567. $1=_st(self._stack())._add_(anObject);
  2568. return $1;
  2569. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},smalltalk.Interpreter)})},
  2570. args: ["anObject"],
  2571. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  2572. messageSends: ["add:", "stack"],
  2573. referencedClasses: []
  2574. }),
  2575. smalltalk.Interpreter);
  2576. smalltalk.addMethod(
  2577. smalltalk.method({
  2578. selector: "restart",
  2579. category: 'interpreting',
  2580. fn: function (){
  2581. var self=this;
  2582. return smalltalk.withContext(function($ctx1) {
  2583. self._node_(_st(_st(self._context())._ast())._nextChild());
  2584. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},smalltalk.Interpreter)})},
  2585. args: [],
  2586. source: "restart\x0a\x09self node: self context ast nextChild",
  2587. messageSends: ["node:", "nextChild", "ast", "context"],
  2588. referencedClasses: []
  2589. }),
  2590. smalltalk.Interpreter);
  2591. smalltalk.addMethod(
  2592. smalltalk.method({
  2593. selector: "result",
  2594. category: 'accessing',
  2595. fn: function (){
  2596. var self=this;
  2597. return smalltalk.withContext(function($ctx1) {
  2598. var $2,$1;
  2599. $2=self._hasReturned();
  2600. if(smalltalk.assert($2)){
  2601. $1=self._returnValue();
  2602. } else {
  2603. $1=_st(self._context())._receiver();
  2604. };
  2605. return $1;
  2606. }, function($ctx1) {$ctx1.fill(self,"result",{},smalltalk.Interpreter)})},
  2607. args: [],
  2608. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  2609. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"],
  2610. referencedClasses: []
  2611. }),
  2612. smalltalk.Interpreter);
  2613. smalltalk.addMethod(
  2614. smalltalk.method({
  2615. selector: "returnValue",
  2616. category: 'accessing',
  2617. fn: function (){
  2618. var self=this;
  2619. return smalltalk.withContext(function($ctx1) {
  2620. var $1;
  2621. $1=self["@returnValue"];
  2622. return $1;
  2623. }, function($ctx1) {$ctx1.fill(self,"returnValue",{},smalltalk.Interpreter)})},
  2624. args: [],
  2625. source: "returnValue\x0a\x09^ returnValue",
  2626. messageSends: [],
  2627. referencedClasses: []
  2628. }),
  2629. smalltalk.Interpreter);
  2630. smalltalk.addMethod(
  2631. smalltalk.method({
  2632. selector: "returnValue:",
  2633. category: 'accessing',
  2634. fn: function (anObject){
  2635. var self=this;
  2636. return smalltalk.withContext(function($ctx1) {
  2637. self["@returnValue"]=anObject;
  2638. return self}, function($ctx1) {$ctx1.fill(self,"returnValue:",{anObject:anObject},smalltalk.Interpreter)})},
  2639. args: ["anObject"],
  2640. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  2641. messageSends: [],
  2642. referencedClasses: []
  2643. }),
  2644. smalltalk.Interpreter);
  2645. smalltalk.addMethod(
  2646. smalltalk.method({
  2647. selector: "sendMessage:to:superSend:",
  2648. category: 'private',
  2649. fn: function (aMessage,anObject,aBoolean){
  2650. var self=this;
  2651. var method;
  2652. return smalltalk.withContext(function($ctx1) {
  2653. var $1,$3,$2,$4,$6,$5,$7,$8;
  2654. var $early={};
  2655. try {
  2656. $1=aBoolean;
  2657. $2=(function(){
  2658. return smalltalk.withContext(function($ctx2) {
  2659. $3=_st(aMessage)._sendTo_(anObject);
  2660. throw $early=[$3];
  2661. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  2662. _st($1)._ifFalse_($2);
  2663. $4=_st(_st(anObject)._class())._superclass();
  2664. $5=(function(){
  2665. return smalltalk.withContext(function($ctx2) {
  2666. $6=self._messageNotUnderstood_receiver_(aMessage,anObject);
  2667. throw $early=[$6];
  2668. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})});
  2669. _st($4)._ifNil_($5);
  2670. method=_st(_st(_st(_st(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_(_st(aMessage)._selector(),(function(){
  2671. return smalltalk.withContext(function($ctx2) {
  2672. $7=self._messageNotUnderstood_receiver_(aMessage,anObject);
  2673. throw $early=[$7];
  2674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  2675. $8=_st(method)._sendTo_arguments_(anObject,_st(aMessage)._arguments());
  2676. return $8;
  2677. }
  2678. catch(e) {if(e===$early)return e[0]; throw e}
  2679. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},smalltalk.Interpreter)})},
  2680. args: ["aMessage", "anObject", "aBoolean"],
  2681. 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",
  2682. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"],
  2683. referencedClasses: []
  2684. }),
  2685. smalltalk.Interpreter);
  2686. smalltalk.addMethod(
  2687. smalltalk.method({
  2688. selector: "setNonLocalReturnFromContext:",
  2689. category: 'interpreting',
  2690. fn: function (aContext){
  2691. var self=this;
  2692. return smalltalk.withContext(function($ctx1) {
  2693. var $1;
  2694. $1=_st(_st(aContext)._interpreter())._hasReturned();
  2695. if(smalltalk.assert($1)){
  2696. self["@returned"]=true;
  2697. self["@returned"];
  2698. self._returnValue_(_st(_st(aContext)._interpreter())._returnValue());
  2699. };
  2700. return self}, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},smalltalk.Interpreter)})},
  2701. args: ["aContext"],
  2702. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  2703. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"],
  2704. referencedClasses: []
  2705. }),
  2706. smalltalk.Interpreter);
  2707. smalltalk.addMethod(
  2708. smalltalk.method({
  2709. selector: "skip",
  2710. category: 'interpreting',
  2711. fn: function (){
  2712. var self=this;
  2713. return smalltalk.withContext(function($ctx1) {
  2714. self._next();
  2715. return self}, function($ctx1) {$ctx1.fill(self,"skip",{},smalltalk.Interpreter)})},
  2716. args: [],
  2717. source: "skip\x0a\x09self next",
  2718. messageSends: ["next"],
  2719. referencedClasses: []
  2720. }),
  2721. smalltalk.Interpreter);
  2722. smalltalk.addMethod(
  2723. smalltalk.method({
  2724. selector: "stack",
  2725. category: 'accessing',
  2726. fn: function (){
  2727. var self=this;
  2728. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  2729. return smalltalk.withContext(function($ctx1) {
  2730. var $2,$3,$1;
  2731. $2=self["@stack"];
  2732. $3=(function(){
  2733. return smalltalk.withContext(function($ctx2) {
  2734. self["@stack"]=_st($OrderedCollection())._new();
  2735. return self["@stack"];
  2736. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  2737. $1=_st($2)._ifNil_($3);
  2738. return $1;
  2739. }, function($ctx1) {$ctx1.fill(self,"stack",{},smalltalk.Interpreter)})},
  2740. args: [],
  2741. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  2742. messageSends: ["ifNil:", "new"],
  2743. referencedClasses: ["OrderedCollection"]
  2744. }),
  2745. smalltalk.Interpreter);
  2746. smalltalk.addMethod(
  2747. smalltalk.method({
  2748. selector: "step",
  2749. category: 'interpreting',
  2750. fn: function (){
  2751. var self=this;
  2752. return smalltalk.withContext(function($ctx1) {
  2753. var $1,$2;
  2754. $1=self;
  2755. _st($1)._interpret();
  2756. $2=_st($1)._next();
  2757. return self}, function($ctx1) {$ctx1.fill(self,"step",{},smalltalk.Interpreter)})},
  2758. args: [],
  2759. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  2760. messageSends: ["interpret", "next"],
  2761. referencedClasses: []
  2762. }),
  2763. smalltalk.Interpreter);
  2764. smalltalk.addMethod(
  2765. smalltalk.method({
  2766. selector: "stepOver",
  2767. category: 'interpreting',
  2768. fn: function (){
  2769. var self=this;
  2770. return smalltalk.withContext(function($ctx1) {
  2771. self._step();
  2772. _st((function(){
  2773. return smalltalk.withContext(function($ctx2) {
  2774. return _st(self._node())._isSteppingNode();
  2775. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  2776. return smalltalk.withContext(function($ctx2) {
  2777. return self._step();
  2778. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2779. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},smalltalk.Interpreter)})},
  2780. args: [],
  2781. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isSteppingNode ] whileFalse: [ \x0a\x09\x09self step ]",
  2782. messageSends: ["step", "whileFalse:", "isSteppingNode", "node"],
  2783. referencedClasses: []
  2784. }),
  2785. smalltalk.Interpreter);
  2786. smalltalk.addMethod(
  2787. smalltalk.method({
  2788. selector: "visit:",
  2789. category: 'visiting',
  2790. fn: function (aNode){
  2791. var self=this;
  2792. return smalltalk.withContext(function($ctx1) {
  2793. var $1;
  2794. $1=self._hasReturned();
  2795. if(! smalltalk.assert($1)){
  2796. smalltalk.Interpreter.superclass.fn.prototype._visit_.apply(_st(self), [aNode]);
  2797. };
  2798. return self}, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},smalltalk.Interpreter)})},
  2799. args: ["aNode"],
  2800. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  2801. messageSends: ["ifFalse:", "hasReturned", "visit:"],
  2802. referencedClasses: []
  2803. }),
  2804. smalltalk.Interpreter);
  2805. smalltalk.addMethod(
  2806. smalltalk.method({
  2807. selector: "visitAssignmentNode:",
  2808. category: 'visiting',
  2809. fn: function (aNode){
  2810. var self=this;
  2811. var poppedValue;
  2812. return smalltalk.withContext(function($ctx1) {
  2813. poppedValue=self._pop();
  2814. self._pop();
  2815. self._push_(poppedValue);
  2816. self._assign_to_(_st(aNode)._left(),poppedValue);
  2817. return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},smalltalk.Interpreter)})},
  2818. args: ["aNode"],
  2819. 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",
  2820. messageSends: ["pop", "push:", "assign:to:", "left"],
  2821. referencedClasses: []
  2822. }),
  2823. smalltalk.Interpreter);
  2824. smalltalk.addMethod(
  2825. smalltalk.method({
  2826. selector: "visitBlockNode:",
  2827. category: 'visiting',
  2828. fn: function (aNode){
  2829. var self=this;
  2830. var block;
  2831. function $AIBlockClosure(){return smalltalk.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)}
  2832. return smalltalk.withContext(function($ctx1) {
  2833. block=_st($AIBlockClosure())._forContext_node_(self._context(),aNode);
  2834. self._push_(block);
  2835. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},smalltalk.Interpreter)})},
  2836. args: ["aNode"],
  2837. 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",
  2838. messageSends: ["forContext:node:", "context", "push:"],
  2839. referencedClasses: ["AIBlockClosure"]
  2840. }),
  2841. smalltalk.Interpreter);
  2842. smalltalk.addMethod(
  2843. smalltalk.method({
  2844. selector: "visitClassReferenceNode:",
  2845. category: 'visiting',
  2846. fn: function (aNode){
  2847. var self=this;
  2848. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2849. function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  2850. return smalltalk.withContext(function($ctx1) {
  2851. self._push_(_st(_st($Smalltalk())._current())._at_ifAbsent_(_st(aNode)._value(),(function(){
  2852. return smalltalk.withContext(function($ctx2) {
  2853. return _st(_st($PlatformInterface())._globals())._at_(_st(aNode)._value());
  2854. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  2855. return self}, function($ctx1) {$ctx1.fill(self,"visitClassReferenceNode:",{aNode:aNode},smalltalk.Interpreter)})},
  2856. args: ["aNode"],
  2857. source: "visitClassReferenceNode: aNode\x0a\x09self push: (Smalltalk current \x0a\x09\x09at: aNode value \x0a\x09\x09ifAbsent: [ PlatformInterface globals at: aNode value ])",
  2858. messageSends: ["push:", "at:ifAbsent:", "current", "value", "at:", "globals"],
  2859. referencedClasses: ["Smalltalk", "PlatformInterface"]
  2860. }),
  2861. smalltalk.Interpreter);
  2862. smalltalk.addMethod(
  2863. smalltalk.method({
  2864. selector: "visitDynamicArrayNode:",
  2865. category: 'visiting',
  2866. fn: function (aNode){
  2867. var self=this;
  2868. var array;
  2869. return smalltalk.withContext(function($ctx1) {
  2870. array=[];
  2871. _st(_st(aNode)._nodes())._do_((function(each){
  2872. return smalltalk.withContext(function($ctx2) {
  2873. return _st(array)._addFirst_(self._pop());
  2874. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2875. self._push_(array);
  2876. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},smalltalk.Interpreter)})},
  2877. args: ["aNode"],
  2878. 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",
  2879. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"],
  2880. referencedClasses: []
  2881. }),
  2882. smalltalk.Interpreter);
  2883. smalltalk.addMethod(
  2884. smalltalk.method({
  2885. selector: "visitDynamicDictionaryNode:",
  2886. category: 'visiting',
  2887. fn: function (aNode){
  2888. var self=this;
  2889. var hashedCollection;
  2890. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2891. return smalltalk.withContext(function($ctx1) {
  2892. hashedCollection=_st($HashedCollection())._new();
  2893. _st(_st(aNode)._nodes())._do_((function(each){
  2894. return smalltalk.withContext(function($ctx2) {
  2895. return _st(hashedCollection)._add_(self._pop());
  2896. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2897. self._push_(hashedCollection);
  2898. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,hashedCollection:hashedCollection},smalltalk.Interpreter)})},
  2899. args: ["aNode"],
  2900. source: "visitDynamicDictionaryNode: aNode\x0a\x09| hashedCollection |\x0a\x09\x0a\x09hashedCollection := HashedCollection new.\x0a\x09aNode nodes do: [ :each | \x0a\x09\x09hashedCollection add: self pop ].\x0a\x09\x0a\x09self push: hashedCollection",
  2901. messageSends: ["new", "do:", "nodes", "add:", "pop", "push:"],
  2902. referencedClasses: ["HashedCollection"]
  2903. }),
  2904. smalltalk.Interpreter);
  2905. smalltalk.addMethod(
  2906. smalltalk.method({
  2907. selector: "visitJSStatementNode:",
  2908. category: 'visiting',
  2909. fn: function (aNode){
  2910. var self=this;
  2911. return smalltalk.withContext(function($ctx1) {
  2912. self["@returned"]=true;
  2913. self._returnValue_(self._eval_(_st(aNode)._source()));
  2914. return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},smalltalk.Interpreter)})},
  2915. args: ["aNode"],
  2916. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  2917. messageSends: ["returnValue:", "eval:", "source"],
  2918. referencedClasses: []
  2919. }),
  2920. smalltalk.Interpreter);
  2921. smalltalk.addMethod(
  2922. smalltalk.method({
  2923. selector: "visitNode:",
  2924. category: 'visiting',
  2925. fn: function (aNode){
  2926. var self=this;
  2927. return smalltalk.withContext(function($ctx1) {
  2928. return self}, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},smalltalk.Interpreter)})},
  2929. args: ["aNode"],
  2930. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  2931. messageSends: [],
  2932. referencedClasses: []
  2933. }),
  2934. smalltalk.Interpreter);
  2935. smalltalk.addMethod(
  2936. smalltalk.method({
  2937. selector: "visitReturnNode:",
  2938. category: 'visiting',
  2939. fn: function (aNode){
  2940. var self=this;
  2941. return smalltalk.withContext(function($ctx1) {
  2942. self["@returned"]=true;
  2943. self._returnValue_(self._pop());
  2944. return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},smalltalk.Interpreter)})},
  2945. args: ["aNode"],
  2946. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  2947. messageSends: ["returnValue:", "pop"],
  2948. referencedClasses: []
  2949. }),
  2950. smalltalk.Interpreter);
  2951. smalltalk.addMethod(
  2952. smalltalk.method({
  2953. selector: "visitSendNode:",
  2954. category: 'visiting',
  2955. fn: function (aNode){
  2956. var self=this;
  2957. var receiver,args,message,result;
  2958. return smalltalk.withContext(function($ctx1) {
  2959. var $1;
  2960. args=_st(_st(aNode)._arguments())._collect_((function(each){
  2961. return smalltalk.withContext(function($ctx2) {
  2962. return self._pop();
  2963. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2964. receiver=self._pop();
  2965. message=self._messageFromSendNode_arguments_(aNode,_st(args)._reversed());
  2966. result=self._sendMessage_to_superSend_(message,receiver,_st(aNode)._superSend());
  2967. _st(self._context())._pc_(_st(_st(self._context())._pc()).__plus((1)));
  2968. $1=_st(_st(aNode)._isCascadeSendNode())._and_((function(){
  2969. return smalltalk.withContext(function($ctx2) {
  2970. return _st(_st(aNode)._isLastChild())._not();
  2971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2972. if(smalltalk.assert($1)){
  2973. self._push_(receiver);
  2974. } else {
  2975. self._push_(result);
  2976. };
  2977. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},smalltalk.Interpreter)})},
  2978. args: ["aNode"],
  2979. 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 ]",
  2980. messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "pc:", "context", "+", "pc", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"],
  2981. referencedClasses: []
  2982. }),
  2983. smalltalk.Interpreter);
  2984. smalltalk.addMethod(
  2985. smalltalk.method({
  2986. selector: "visitValueNode:",
  2987. category: 'visiting',
  2988. fn: function (aNode){
  2989. var self=this;
  2990. return smalltalk.withContext(function($ctx1) {
  2991. self._push_(_st(aNode)._value());
  2992. return self}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},smalltalk.Interpreter)})},
  2993. args: ["aNode"],
  2994. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  2995. messageSends: ["push:", "value"],
  2996. referencedClasses: []
  2997. }),
  2998. smalltalk.Interpreter);
  2999. smalltalk.addMethod(
  3000. smalltalk.method({
  3001. selector: "visitVariableNode:",
  3002. category: 'visiting',
  3003. fn: function (aNode){
  3004. var self=this;
  3005. function $PlatformInterface(){return smalltalk.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  3006. return smalltalk.withContext(function($ctx1) {
  3007. var $1,$3,$2,$4,$6,$7,$8,$5;
  3008. var $early={};
  3009. try {
  3010. $1=_st(_st(aNode)._binding())._isUnknownVar();
  3011. $2=(function(){
  3012. return smalltalk.withContext(function($ctx2) {
  3013. $3=self._push_(_st(_st($PlatformInterface())._globals())._at_ifAbsent_(_st(aNode)._value(),(function(){
  3014. return smalltalk.withContext(function($ctx3) {
  3015. return self._error_("Unknown variable");
  3016. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})})));
  3017. throw $early=[$3];
  3018. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  3019. _st($1)._ifTrue_($2);
  3020. $4=self;
  3021. $6=_st(_st(aNode)._binding())._isInstanceVar();
  3022. $7=(function(){
  3023. return smalltalk.withContext(function($ctx2) {
  3024. return _st(_st(self._context())._receiver())._instVarAt_(_st(aNode)._value());
  3025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})});
  3026. $8=(function(){
  3027. return smalltalk.withContext(function($ctx2) {
  3028. return _st(self._context())._localAt_(_st(aNode)._value());
  3029. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})});
  3030. $5=_st($6)._ifTrue_ifFalse_($7,$8);
  3031. _st($4)._push_($5);
  3032. return self}
  3033. catch(e) {if(e===$early)return e[0]; throw e}
  3034. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},smalltalk.Interpreter)})},
  3035. args: ["aNode"],
  3036. 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 ])",
  3037. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:"],
  3038. referencedClasses: ["PlatformInterface"]
  3039. }),
  3040. smalltalk.Interpreter);
  3041. smalltalk.addMethod(
  3042. smalltalk.method({
  3043. selector: "interpreter:continue:",
  3044. category: '*Compiler-Interpreter',
  3045. fn: function (anInterpreter,aBlock){
  3046. var self=this;
  3047. return smalltalk.withContext(function($ctx1) {
  3048. var $1;
  3049. $1=_st(anInterpreter)._interpretNode_continue_(self,aBlock);
  3050. return $1;
  3051. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.Node)})},
  3052. args: ["anInterpreter", "aBlock"],
  3053. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretNode: self continue: aBlock",
  3054. messageSends: ["interpretNode:continue:"],
  3055. referencedClasses: []
  3056. }),
  3057. smalltalk.Node);
  3058. smalltalk.addMethod(
  3059. smalltalk.method({
  3060. selector: "isSteppingNode",
  3061. category: '*Compiler-Interpreter',
  3062. fn: function (){
  3063. var self=this;
  3064. return smalltalk.withContext(function($ctx1) {
  3065. return false;
  3066. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.Node)})},
  3067. args: [],
  3068. source: "isSteppingNode\x0a\x09^ false",
  3069. messageSends: [],
  3070. referencedClasses: []
  3071. }),
  3072. smalltalk.Node);
  3073. smalltalk.addMethod(
  3074. smalltalk.method({
  3075. selector: "interpreter:continue:",
  3076. category: '*Compiler-Interpreter',
  3077. fn: function (anInterpreter,aBlock){
  3078. var self=this;
  3079. return smalltalk.withContext(function($ctx1) {
  3080. var $1;
  3081. $1=_st(anInterpreter)._interpretAssignmentNode_continue_(self,aBlock);
  3082. return $1;
  3083. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.AssignmentNode)})},
  3084. args: ["anInterpreter", "aBlock"],
  3085. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretAssignmentNode: self continue: aBlock",
  3086. messageSends: ["interpretAssignmentNode:continue:"],
  3087. referencedClasses: []
  3088. }),
  3089. smalltalk.AssignmentNode);
  3090. smalltalk.addMethod(
  3091. smalltalk.method({
  3092. selector: "isSteppingNode",
  3093. category: '*Compiler-Interpreter',
  3094. fn: function (){
  3095. var self=this;
  3096. return smalltalk.withContext(function($ctx1) {
  3097. return true;
  3098. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.AssignmentNode)})},
  3099. args: [],
  3100. source: "isSteppingNode\x0a\x09^ true",
  3101. messageSends: [],
  3102. referencedClasses: []
  3103. }),
  3104. smalltalk.AssignmentNode);
  3105. smalltalk.addMethod(
  3106. smalltalk.method({
  3107. selector: "interpreter:continue:",
  3108. category: '*Compiler-Interpreter',
  3109. fn: function (anInterpreter,aBlock){
  3110. var self=this;
  3111. return smalltalk.withContext(function($ctx1) {
  3112. var $1;
  3113. $1=_st(anInterpreter)._interpretBlockNode_continue_(self,aBlock);
  3114. return $1;
  3115. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.BlockNode)})},
  3116. args: ["anInterpreter", "aBlock"],
  3117. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretBlockNode: self continue: aBlock",
  3118. messageSends: ["interpretBlockNode:continue:"],
  3119. referencedClasses: []
  3120. }),
  3121. smalltalk.BlockNode);
  3122. smalltalk.addMethod(
  3123. smalltalk.method({
  3124. selector: "isSteppingNode",
  3125. category: '*Compiler-Interpreter',
  3126. fn: function (){
  3127. var self=this;
  3128. return smalltalk.withContext(function($ctx1) {
  3129. return true;
  3130. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.BlockNode)})},
  3131. args: [],
  3132. source: "isSteppingNode\x0a\x09^ true",
  3133. messageSends: [],
  3134. referencedClasses: []
  3135. }),
  3136. smalltalk.BlockNode);
  3137. smalltalk.addMethod(
  3138. smalltalk.method({
  3139. selector: "interpreter:continue:",
  3140. category: '*Compiler-Interpreter',
  3141. fn: function (anInterpreter,aBlock){
  3142. var self=this;
  3143. return smalltalk.withContext(function($ctx1) {
  3144. var $1;
  3145. $1=_st(anInterpreter)._interpretCascadeNode_continue_(self,aBlock);
  3146. return $1;
  3147. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.CascadeNode)})},
  3148. args: ["anInterpreter", "aBlock"],
  3149. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretCascadeNode: self continue: aBlock",
  3150. messageSends: ["interpretCascadeNode:continue:"],
  3151. referencedClasses: []
  3152. }),
  3153. smalltalk.CascadeNode);
  3154. smalltalk.addMethod(
  3155. smalltalk.method({
  3156. selector: "interpreter:continue:",
  3157. category: '*Compiler-Interpreter',
  3158. fn: function (anInterpreter,aBlock){
  3159. var self=this;
  3160. return smalltalk.withContext(function($ctx1) {
  3161. var $1;
  3162. $1=_st(anInterpreter)._interpretDynamicArrayNode_continue_(self,aBlock);
  3163. return $1;
  3164. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.DynamicArrayNode)})},
  3165. args: ["anInterpreter", "aBlock"],
  3166. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretDynamicArrayNode: self continue: aBlock",
  3167. messageSends: ["interpretDynamicArrayNode:continue:"],
  3168. referencedClasses: []
  3169. }),
  3170. smalltalk.DynamicArrayNode);
  3171. smalltalk.addMethod(
  3172. smalltalk.method({
  3173. selector: "isSteppingNode",
  3174. category: '*Compiler-Interpreter',
  3175. fn: function (){
  3176. var self=this;
  3177. return smalltalk.withContext(function($ctx1) {
  3178. return true;
  3179. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicArrayNode)})},
  3180. args: [],
  3181. source: "isSteppingNode\x0a\x09^ true",
  3182. messageSends: [],
  3183. referencedClasses: []
  3184. }),
  3185. smalltalk.DynamicArrayNode);
  3186. smalltalk.addMethod(
  3187. smalltalk.method({
  3188. selector: "interpreter:continue:",
  3189. category: '*Compiler-Interpreter',
  3190. fn: function (anInterpreter,aBlock){
  3191. var self=this;
  3192. return smalltalk.withContext(function($ctx1) {
  3193. var $1;
  3194. $1=_st(anInterpreter)._interpretDynamicDictionaryNode_continue_(self,aBlock);
  3195. return $1;
  3196. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.DynamicDictionaryNode)})},
  3197. args: ["anInterpreter", "aBlock"],
  3198. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretDynamicDictionaryNode: self continue: aBlock",
  3199. messageSends: ["interpretDynamicDictionaryNode:continue:"],
  3200. referencedClasses: []
  3201. }),
  3202. smalltalk.DynamicDictionaryNode);
  3203. smalltalk.addMethod(
  3204. smalltalk.method({
  3205. selector: "isSteppingNode",
  3206. category: '*Compiler-Interpreter',
  3207. fn: function (){
  3208. var self=this;
  3209. return smalltalk.withContext(function($ctx1) {
  3210. return true;
  3211. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.DynamicDictionaryNode)})},
  3212. args: [],
  3213. source: "isSteppingNode\x0a\x09^ true",
  3214. messageSends: [],
  3215. referencedClasses: []
  3216. }),
  3217. smalltalk.DynamicDictionaryNode);
  3218. smalltalk.addMethod(
  3219. smalltalk.method({
  3220. selector: "interpreter:continue:",
  3221. category: '*Compiler-Interpreter',
  3222. fn: function (anInterpreter,aBlock){
  3223. var self=this;
  3224. return smalltalk.withContext(function($ctx1) {
  3225. var $1;
  3226. $1=_st(anInterpreter)._interpretJSStatementNode_continue_(self,aBlock);
  3227. return $1;
  3228. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.JSStatementNode)})},
  3229. args: ["anInterpreter", "aBlock"],
  3230. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretJSStatementNode: self continue: aBlock",
  3231. messageSends: ["interpretJSStatementNode:continue:"],
  3232. referencedClasses: []
  3233. }),
  3234. smalltalk.JSStatementNode);
  3235. smalltalk.addMethod(
  3236. smalltalk.method({
  3237. selector: "isSteppingNode",
  3238. category: '*Compiler-Interpreter',
  3239. fn: function (){
  3240. var self=this;
  3241. return smalltalk.withContext(function($ctx1) {
  3242. return true;
  3243. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.JSStatementNode)})},
  3244. args: [],
  3245. source: "isSteppingNode\x0a\x09^ true",
  3246. messageSends: [],
  3247. referencedClasses: []
  3248. }),
  3249. smalltalk.JSStatementNode);
  3250. smalltalk.addMethod(
  3251. smalltalk.method({
  3252. selector: "interpreter:continue:",
  3253. category: '*Compiler-Interpreter',
  3254. fn: function (anInterpreter,aBlock){
  3255. var self=this;
  3256. return smalltalk.withContext(function($ctx1) {
  3257. var $1;
  3258. $1=_st(anInterpreter)._interpretMethodNode_continue_(self,aBlock);
  3259. return $1;
  3260. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.MethodNode)})},
  3261. args: ["anInterpreter", "aBlock"],
  3262. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretMethodNode: self continue: aBlock",
  3263. messageSends: ["interpretMethodNode:continue:"],
  3264. referencedClasses: []
  3265. }),
  3266. smalltalk.MethodNode);
  3267. smalltalk.addMethod(
  3268. smalltalk.method({
  3269. selector: "interpreter:continue:",
  3270. category: '*Compiler-Interpreter',
  3271. fn: function (anInterpreter,aBlock){
  3272. var self=this;
  3273. return smalltalk.withContext(function($ctx1) {
  3274. var $1;
  3275. $1=_st(anInterpreter)._interpretReturnNode_continue_(self,aBlock);
  3276. return $1;
  3277. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ReturnNode)})},
  3278. args: ["anInterpreter", "aBlock"],
  3279. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretReturnNode: self continue: aBlock",
  3280. messageSends: ["interpretReturnNode:continue:"],
  3281. referencedClasses: []
  3282. }),
  3283. smalltalk.ReturnNode);
  3284. smalltalk.addMethod(
  3285. smalltalk.method({
  3286. selector: "interpreter:continue:",
  3287. category: '*Compiler-Interpreter',
  3288. fn: function (anInterpreter,aBlock){
  3289. var self=this;
  3290. return smalltalk.withContext(function($ctx1) {
  3291. var $1;
  3292. $1=_st(anInterpreter)._interpretSendNode_continue_(self,aBlock);
  3293. return $1;
  3294. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.SendNode)})},
  3295. args: ["anInterpreter", "aBlock"],
  3296. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretSendNode: self continue: aBlock",
  3297. messageSends: ["interpretSendNode:continue:"],
  3298. referencedClasses: []
  3299. }),
  3300. smalltalk.SendNode);
  3301. smalltalk.addMethod(
  3302. smalltalk.method({
  3303. selector: "isSteppingNode",
  3304. category: '*Compiler-Interpreter',
  3305. fn: function (){
  3306. var self=this;
  3307. return smalltalk.withContext(function($ctx1) {
  3308. return true;
  3309. }, function($ctx1) {$ctx1.fill(self,"isSteppingNode",{},smalltalk.SendNode)})},
  3310. args: [],
  3311. source: "isSteppingNode\x0a\x09^ true",
  3312. messageSends: [],
  3313. referencedClasses: []
  3314. }),
  3315. smalltalk.SendNode);
  3316. smalltalk.addMethod(
  3317. smalltalk.method({
  3318. selector: "interpreter:continue:",
  3319. category: '*Compiler-Interpreter',
  3320. fn: function (anInterpreter,aBlock){
  3321. var self=this;
  3322. return smalltalk.withContext(function($ctx1) {
  3323. var $1;
  3324. $1=_st(anInterpreter)._interpretSequenceNode_continue_(self,aBlock);
  3325. return $1;
  3326. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.SequenceNode)})},
  3327. args: ["anInterpreter", "aBlock"],
  3328. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretSequenceNode: self continue: aBlock",
  3329. messageSends: ["interpretSequenceNode:continue:"],
  3330. referencedClasses: []
  3331. }),
  3332. smalltalk.SequenceNode);
  3333. smalltalk.addMethod(
  3334. smalltalk.method({
  3335. selector: "interpreter:continue:",
  3336. category: '*Compiler-Interpreter',
  3337. fn: function (anInterpreter,aBlock){
  3338. var self=this;
  3339. return smalltalk.withContext(function($ctx1) {
  3340. var $1;
  3341. $1=_st(anInterpreter)._interpretBlockSequenceNode_continue_(self,aBlock);
  3342. return $1;
  3343. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.BlockSequenceNode)})},
  3344. args: ["anInterpreter", "aBlock"],
  3345. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretBlockSequenceNode: self continue: aBlock",
  3346. messageSends: ["interpretBlockSequenceNode:continue:"],
  3347. referencedClasses: []
  3348. }),
  3349. smalltalk.BlockSequenceNode);
  3350. smalltalk.addMethod(
  3351. smalltalk.method({
  3352. selector: "interpreter:continue:",
  3353. category: '*Compiler-Interpreter',
  3354. fn: function (anInterpreter,aBlock){
  3355. var self=this;
  3356. return smalltalk.withContext(function($ctx1) {
  3357. var $1;
  3358. $1=_st(anInterpreter)._interpretValueNode_continue_(self,aBlock);
  3359. return $1;
  3360. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ValueNode)})},
  3361. args: ["anInterpreter", "aBlock"],
  3362. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretValueNode: self continue: aBlock",
  3363. messageSends: ["interpretValueNode:continue:"],
  3364. referencedClasses: []
  3365. }),
  3366. smalltalk.ValueNode);
  3367. smalltalk.addMethod(
  3368. smalltalk.method({
  3369. selector: "interpreter:continue:",
  3370. category: '*Compiler-Interpreter',
  3371. fn: function (anInterpreter,aBlock){
  3372. var self=this;
  3373. return smalltalk.withContext(function($ctx1) {
  3374. var $1;
  3375. $1=_st(anInterpreter)._interpretVariableNode_continue_(self,aBlock);
  3376. return $1;
  3377. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.VariableNode)})},
  3378. args: ["anInterpreter", "aBlock"],
  3379. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretVariableNode: self continue: aBlock",
  3380. messageSends: ["interpretVariableNode:continue:"],
  3381. referencedClasses: []
  3382. }),
  3383. smalltalk.VariableNode);
  3384. smalltalk.addMethod(
  3385. smalltalk.method({
  3386. selector: "interpreter:continue:",
  3387. category: '*Compiler-Interpreter',
  3388. fn: function (anInterpreter,aBlock){
  3389. var self=this;
  3390. return smalltalk.withContext(function($ctx1) {
  3391. var $1;
  3392. $1=_st(anInterpreter)._interpretClassReferenceNode_continue_(self,aBlock);
  3393. return $1;
  3394. }, function($ctx1) {$ctx1.fill(self,"interpreter:continue:",{anInterpreter:anInterpreter,aBlock:aBlock},smalltalk.ClassReferenceNode)})},
  3395. args: ["anInterpreter", "aBlock"],
  3396. source: "interpreter: anInterpreter continue: aBlock\x0a\x09^ anInterpreter interpretClassReferenceNode: self continue: aBlock",
  3397. messageSends: ["interpretClassReferenceNode:continue:"],
  3398. referencedClasses: []
  3399. }),
  3400. smalltalk.ClassReferenceNode);
  3401. });