Compiler-AST.js 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676
  1. define("amber_core/Compiler-AST", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function(smalltalk,nil,_st, globals){
  2. smalltalk.addPackage('Compiler-AST');
  3. smalltalk.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('Node', globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  5. globals.Node.comment="I am the abstract root class of the abstract syntax tree.\x0a\x0aConcrete classes should implement `#accept:` to allow visiting.\x0a\x0a`position` holds a point containing line and column number of the symbol location in the original source file.";
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "accept:",
  9. protocol: 'visiting',
  10. fn: function (aVisitor){
  11. var self=this;
  12. return smalltalk.withContext(function($ctx1) {
  13. var $1;
  14. $1=_st(aVisitor)._visitNode_(self);
  15. return $1;
  16. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.Node)})},
  17. args: ["aVisitor"],
  18. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  19. messageSends: ["visitNode:"],
  20. referencedClasses: []
  21. }),
  22. globals.Node);
  23. smalltalk.addMethod(
  24. smalltalk.method({
  25. selector: "addNode:",
  26. protocol: 'accessing',
  27. fn: function (aNode){
  28. var self=this;
  29. return smalltalk.withContext(function($ctx1) {
  30. _st(self._nodes())._add_(aNode);
  31. _st(aNode)._parent_(self);
  32. return self}, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},globals.Node)})},
  33. args: ["aNode"],
  34. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  35. messageSends: ["add:", "nodes", "parent:"],
  36. referencedClasses: []
  37. }),
  38. globals.Node);
  39. smalltalk.addMethod(
  40. smalltalk.method({
  41. selector: "allNodes",
  42. protocol: 'accessing',
  43. fn: function (){
  44. var self=this;
  45. var allNodes;
  46. return smalltalk.withContext(function($ctx1) {
  47. var $1,$2;
  48. $1=self._nodes();
  49. $ctx1.sendIdx["nodes"]=1;
  50. allNodes=_st($1)._asSet();
  51. _st(self._nodes())._do_((function(each){
  52. return smalltalk.withContext(function($ctx2) {
  53. return _st(allNodes)._addAll_(_st(each)._allNodes());
  54. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  55. $2=allNodes;
  56. return $2;
  57. }, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},globals.Node)})},
  58. args: [],
  59. source: "allNodes\x0a\x09| allNodes |\x0a\x09\x0a\x09allNodes := self nodes asSet.\x0a\x09self nodes do: [ :each | \x0a\x09\x09allNodes addAll: each allNodes ].\x0a\x09\x0a\x09^ allNodes",
  60. messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"],
  61. referencedClasses: []
  62. }),
  63. globals.Node);
  64. smalltalk.addMethod(
  65. smalltalk.method({
  66. selector: "inPosition:",
  67. protocol: 'testing',
  68. fn: function (aPoint){
  69. var self=this;
  70. return smalltalk.withContext(function($ctx1) {
  71. var $1;
  72. $1=_st(_st(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  73. return smalltalk.withContext(function($ctx2) {
  74. return _st(self._positionEnd()).__gt_eq(aPoint);
  75. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  76. return $1;
  77. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},globals.Node)})},
  78. args: ["aPoint"],
  79. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  80. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"],
  81. referencedClasses: []
  82. }),
  83. globals.Node);
  84. smalltalk.addMethod(
  85. smalltalk.method({
  86. selector: "isAssignmentNode",
  87. protocol: 'testing',
  88. fn: function (){
  89. var self=this;
  90. return false;
  91. },
  92. args: [],
  93. source: "isAssignmentNode\x0a\x09^ false",
  94. messageSends: [],
  95. referencedClasses: []
  96. }),
  97. globals.Node);
  98. smalltalk.addMethod(
  99. smalltalk.method({
  100. selector: "isBlockNode",
  101. protocol: 'testing',
  102. fn: function (){
  103. var self=this;
  104. return false;
  105. },
  106. args: [],
  107. source: "isBlockNode\x0a\x09^ false",
  108. messageSends: [],
  109. referencedClasses: []
  110. }),
  111. globals.Node);
  112. smalltalk.addMethod(
  113. smalltalk.method({
  114. selector: "isBlockSequenceNode",
  115. protocol: 'testing',
  116. fn: function (){
  117. var self=this;
  118. return false;
  119. },
  120. args: [],
  121. source: "isBlockSequenceNode\x0a\x09^ false",
  122. messageSends: [],
  123. referencedClasses: []
  124. }),
  125. globals.Node);
  126. smalltalk.addMethod(
  127. smalltalk.method({
  128. selector: "isCascadeNode",
  129. protocol: 'testing',
  130. fn: function (){
  131. var self=this;
  132. return false;
  133. },
  134. args: [],
  135. source: "isCascadeNode\x0a\x09^ false",
  136. messageSends: [],
  137. referencedClasses: []
  138. }),
  139. globals.Node);
  140. smalltalk.addMethod(
  141. smalltalk.method({
  142. selector: "isImmutable",
  143. protocol: 'testing',
  144. fn: function (){
  145. var self=this;
  146. return false;
  147. },
  148. args: [],
  149. source: "isImmutable\x0a\x09^ false",
  150. messageSends: [],
  151. referencedClasses: []
  152. }),
  153. globals.Node);
  154. smalltalk.addMethod(
  155. smalltalk.method({
  156. selector: "isJSStatementNode",
  157. protocol: 'testing',
  158. fn: function (){
  159. var self=this;
  160. return false;
  161. },
  162. args: [],
  163. source: "isJSStatementNode\x0a\x09^ false",
  164. messageSends: [],
  165. referencedClasses: []
  166. }),
  167. globals.Node);
  168. smalltalk.addMethod(
  169. smalltalk.method({
  170. selector: "isLastChild",
  171. protocol: 'testing',
  172. fn: function (){
  173. var self=this;
  174. return smalltalk.withContext(function($ctx1) {
  175. var $1;
  176. $1=_st(_st(_st(self._parent())._nodes())._last()).__eq(self);
  177. return $1;
  178. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},globals.Node)})},
  179. args: [],
  180. source: "isLastChild\x0a\x09^ self parent nodes last = self",
  181. messageSends: ["=", "last", "nodes", "parent"],
  182. referencedClasses: []
  183. }),
  184. globals.Node);
  185. smalltalk.addMethod(
  186. smalltalk.method({
  187. selector: "isNavigationNode",
  188. protocol: 'testing',
  189. fn: function (){
  190. var self=this;
  191. return false;
  192. },
  193. args: [],
  194. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  195. messageSends: [],
  196. referencedClasses: []
  197. }),
  198. globals.Node);
  199. smalltalk.addMethod(
  200. smalltalk.method({
  201. selector: "isNode",
  202. protocol: 'testing',
  203. fn: function (){
  204. var self=this;
  205. return true;
  206. },
  207. args: [],
  208. source: "isNode\x0a\x09^ true",
  209. messageSends: [],
  210. referencedClasses: []
  211. }),
  212. globals.Node);
  213. smalltalk.addMethod(
  214. smalltalk.method({
  215. selector: "isReferenced",
  216. protocol: 'testing',
  217. fn: function (){
  218. var self=this;
  219. return smalltalk.withContext(function($ctx1) {
  220. var $4,$3,$2,$1;
  221. $4=self._parent();
  222. $ctx1.sendIdx["parent"]=1;
  223. $3=_st($4)._isSequenceNode();
  224. $2=_st($3)._or_((function(){
  225. return smalltalk.withContext(function($ctx2) {
  226. return _st(self._parent())._isAssignmentNode();
  227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  228. $1=_st($2)._not();
  229. return $1;
  230. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},globals.Node)})},
  231. args: [],
  232. source: "isReferenced\x0a\x09\x22Answer true if the receiver is referenced by other nodes.\x0a\x09Do not take sequences or assignments into account\x22\x0a\x09\x0a\x09^ (self parent isSequenceNode or: [\x0a\x09\x09self parent isAssignmentNode ]) not",
  233. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"],
  234. referencedClasses: []
  235. }),
  236. globals.Node);
  237. smalltalk.addMethod(
  238. smalltalk.method({
  239. selector: "isReturnNode",
  240. protocol: 'testing',
  241. fn: function (){
  242. var self=this;
  243. return false;
  244. },
  245. args: [],
  246. source: "isReturnNode\x0a\x09^ false",
  247. messageSends: [],
  248. referencedClasses: []
  249. }),
  250. globals.Node);
  251. smalltalk.addMethod(
  252. smalltalk.method({
  253. selector: "isSendNode",
  254. protocol: 'testing',
  255. fn: function (){
  256. var self=this;
  257. return false;
  258. },
  259. args: [],
  260. source: "isSendNode\x0a\x09^ false",
  261. messageSends: [],
  262. referencedClasses: []
  263. }),
  264. globals.Node);
  265. smalltalk.addMethod(
  266. smalltalk.method({
  267. selector: "isSequenceNode",
  268. protocol: 'testing',
  269. fn: function (){
  270. var self=this;
  271. return false;
  272. },
  273. args: [],
  274. source: "isSequenceNode\x0a\x09^ false",
  275. messageSends: [],
  276. referencedClasses: []
  277. }),
  278. globals.Node);
  279. smalltalk.addMethod(
  280. smalltalk.method({
  281. selector: "isValueNode",
  282. protocol: 'testing',
  283. fn: function (){
  284. var self=this;
  285. return false;
  286. },
  287. args: [],
  288. source: "isValueNode\x0a\x09^ false",
  289. messageSends: [],
  290. referencedClasses: []
  291. }),
  292. globals.Node);
  293. smalltalk.addMethod(
  294. smalltalk.method({
  295. selector: "isVariableNode",
  296. protocol: 'testing',
  297. fn: function (){
  298. var self=this;
  299. return false;
  300. },
  301. args: [],
  302. source: "isVariableNode\x0a\x09^ false",
  303. messageSends: [],
  304. referencedClasses: []
  305. }),
  306. globals.Node);
  307. smalltalk.addMethod(
  308. smalltalk.method({
  309. selector: "method",
  310. protocol: 'accessing',
  311. fn: function (){
  312. var self=this;
  313. return smalltalk.withContext(function($ctx1) {
  314. var $2,$1,$receiver;
  315. $2=self._parent();
  316. if(($receiver = $2) == null || $receiver.isNil){
  317. $1=$2;
  318. } else {
  319. var node;
  320. node=$receiver;
  321. $1=_st(node)._method();
  322. };
  323. return $1;
  324. }, function($ctx1) {$ctx1.fill(self,"method",{},globals.Node)})},
  325. args: [],
  326. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  327. messageSends: ["ifNotNil:", "parent", "method"],
  328. referencedClasses: []
  329. }),
  330. globals.Node);
  331. smalltalk.addMethod(
  332. smalltalk.method({
  333. selector: "navigationNodeAt:ifAbsent:",
  334. protocol: 'accessing',
  335. fn: function (aPoint,aBlock){
  336. var self=this;
  337. var children;
  338. return smalltalk.withContext(function($ctx1) {
  339. var $1,$4,$3,$2;
  340. var $early={};
  341. try {
  342. children=_st(self._allNodes())._select_((function(each){
  343. return smalltalk.withContext(function($ctx2) {
  344. return _st(_st(each)._isNavigationNode())._and_((function(){
  345. return smalltalk.withContext(function($ctx3) {
  346. return _st(each)._inPosition_(aPoint);
  347. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  348. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  349. _st(children)._ifEmpty_((function(){
  350. return smalltalk.withContext(function($ctx2) {
  351. $1=_st(aBlock)._value();
  352. throw $early=[$1];
  353. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  354. $2=_st(_st(_st(children)._asArray())._sort_((function(a,b){
  355. return smalltalk.withContext(function($ctx2) {
  356. $4=_st(a)._positionStart();
  357. $ctx2.sendIdx["positionStart"]=1;
  358. $3=_st($4)._dist_(aPoint);
  359. $ctx2.sendIdx["dist:"]=1;
  360. return _st($3).__lt_eq(_st(_st(b)._positionStart())._dist_(aPoint));
  361. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)})})))._first();
  362. return $2;
  363. }
  364. catch(e) {if(e===$early)return e[0]; throw e}
  365. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},globals.Node)})},
  366. args: ["aPoint", "aBlock"],
  367. source: "navigationNodeAt: aPoint ifAbsent: aBlock\x0a\x09\x22Answer the navigation node in the receiver's tree at aPoint \x0a\x09or nil if no navigation node was found.\x0a\x09\x0a\x09See `node >> isNaviationNode`\x22\x0a\x09\x0a\x09| children |\x0a\x09\x0a\x09children := self allNodes select: [ :each | \x0a\x09\x09each isNavigationNode and: [ each inPosition: aPoint ] ].\x0a\x09\x0a\x09children ifEmpty: [ ^ aBlock value ].\x0a\x09\x0a\x09^ (children asArray sort: [ :a :b | \x0a\x09\x09(a positionStart dist: aPoint) <= \x0a\x09\x09(b positionStart dist: aPoint) ]) first",
  368. messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"],
  369. referencedClasses: []
  370. }),
  371. globals.Node);
  372. smalltalk.addMethod(
  373. smalltalk.method({
  374. selector: "nextChild",
  375. protocol: 'accessing',
  376. fn: function (){
  377. var self=this;
  378. return smalltalk.withContext(function($ctx1) {
  379. var $3,$2,$1;
  380. $3=self._nodes();
  381. $ctx1.sendIdx["nodes"]=1;
  382. $2=_st($3)._isEmpty();
  383. if(smalltalk.assert($2)){
  384. $1=self;
  385. } else {
  386. $1=_st(_st(self._nodes())._first())._nextChild();
  387. };
  388. return $1;
  389. }, function($ctx1) {$ctx1.fill(self,"nextChild",{},globals.Node)})},
  390. args: [],
  391. source: "nextChild\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the receiver to answer the next node to be evaluated\x22\x0a\x09\x0a\x09^ self nodes isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self nodes first nextChild ]",
  392. messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"],
  393. referencedClasses: []
  394. }),
  395. globals.Node);
  396. smalltalk.addMethod(
  397. smalltalk.method({
  398. selector: "nextNode",
  399. protocol: 'accessing',
  400. fn: function (){
  401. var self=this;
  402. return smalltalk.withContext(function($ctx1) {
  403. var $2,$1,$receiver;
  404. $2=self._parent();
  405. if(($receiver = $2) == null || $receiver.isNil){
  406. $1=$2;
  407. } else {
  408. var node;
  409. node=$receiver;
  410. $1=_st(node)._nextNode_(self);
  411. };
  412. return $1;
  413. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},globals.Node)})},
  414. args: [],
  415. source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
  416. messageSends: ["ifNotNil:", "parent", "nextNode:"],
  417. referencedClasses: []
  418. }),
  419. globals.Node);
  420. smalltalk.addMethod(
  421. smalltalk.method({
  422. selector: "nextNode:",
  423. protocol: 'accessing',
  424. fn: function (aNode){
  425. var self=this;
  426. var next;
  427. return smalltalk.withContext(function($ctx1) {
  428. var $1,$2;
  429. var $early={};
  430. try {
  431. $1=self._nodes();
  432. $ctx1.sendIdx["nodes"]=1;
  433. next=_st($1)._at_ifAbsent_(_st(_st(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  434. throw $early=[self];
  435. }));
  436. $2=_st(next)._nextChild();
  437. return $2;
  438. }
  439. catch(e) {if(e===$early)return e[0]; throw e}
  440. }, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},globals.Node)})},
  441. args: ["aNode"],
  442. source: "nextNode: aNode\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the next node to answer the next node to be evaluated\x22\x0a\x09\x0a\x09| next |\x0a\x09\x0a\x09next := self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ self ].\x0a\x09\x0a\x09^ next nextChild",
  443. messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"],
  444. referencedClasses: []
  445. }),
  446. globals.Node);
  447. smalltalk.addMethod(
  448. smalltalk.method({
  449. selector: "nodes",
  450. protocol: 'accessing',
  451. fn: function (){
  452. var self=this;
  453. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  454. return smalltalk.withContext(function($ctx1) {
  455. var $2,$1,$receiver;
  456. $2=self["@nodes"];
  457. if(($receiver = $2) == null || $receiver.isNil){
  458. self["@nodes"]=_st($Array())._new();
  459. $1=self["@nodes"];
  460. } else {
  461. $1=$2;
  462. };
  463. return $1;
  464. }, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.Node)})},
  465. args: [],
  466. source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  467. messageSends: ["ifNil:", "new"],
  468. referencedClasses: ["Array"]
  469. }),
  470. globals.Node);
  471. smalltalk.addMethod(
  472. smalltalk.method({
  473. selector: "nodes:",
  474. protocol: 'building',
  475. fn: function (aCollection){
  476. var self=this;
  477. return smalltalk.withContext(function($ctx1) {
  478. self["@nodes"]=aCollection;
  479. _st(aCollection)._do_((function(each){
  480. return smalltalk.withContext(function($ctx2) {
  481. return _st(each)._parent_(self);
  482. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  483. return self}, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},globals.Node)})},
  484. args: ["aCollection"],
  485. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  486. messageSends: ["do:", "parent:"],
  487. referencedClasses: []
  488. }),
  489. globals.Node);
  490. smalltalk.addMethod(
  491. smalltalk.method({
  492. selector: "parent",
  493. protocol: 'accessing',
  494. fn: function (){
  495. var self=this;
  496. var $1;
  497. $1=self["@parent"];
  498. return $1;
  499. },
  500. args: [],
  501. source: "parent\x0a\x09^ parent",
  502. messageSends: [],
  503. referencedClasses: []
  504. }),
  505. globals.Node);
  506. smalltalk.addMethod(
  507. smalltalk.method({
  508. selector: "parent:",
  509. protocol: 'accessing',
  510. fn: function (aNode){
  511. var self=this;
  512. self["@parent"]=aNode;
  513. return self},
  514. args: ["aNode"],
  515. source: "parent: aNode\x0a\x09parent := aNode",
  516. messageSends: [],
  517. referencedClasses: []
  518. }),
  519. globals.Node);
  520. smalltalk.addMethod(
  521. smalltalk.method({
  522. selector: "position",
  523. protocol: 'accessing',
  524. fn: function (){
  525. var self=this;
  526. return smalltalk.withContext(function($ctx1) {
  527. var $2,$3,$1,$receiver;
  528. $2=self["@position"];
  529. if(($receiver = $2) == null || $receiver.isNil){
  530. $3=self._parent();
  531. if(($receiver = $3) == null || $receiver.isNil){
  532. $1=$3;
  533. } else {
  534. var node;
  535. node=$receiver;
  536. $1=_st(node)._position();
  537. };
  538. } else {
  539. $1=$2;
  540. };
  541. return $1;
  542. }, function($ctx1) {$ctx1.fill(self,"position",{},globals.Node)})},
  543. args: [],
  544. source: "position\x0a\x09\x22answer the line and column of the receiver in the source code\x22\x0a\x09\x0a\x09^ position ifNil: [ \x0a\x09\x09self parent ifNotNil: [ :node | node position ] ]",
  545. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"],
  546. referencedClasses: []
  547. }),
  548. globals.Node);
  549. smalltalk.addMethod(
  550. smalltalk.method({
  551. selector: "position:",
  552. protocol: 'accessing',
  553. fn: function (aPosition){
  554. var self=this;
  555. self["@position"]=aPosition;
  556. return self},
  557. args: ["aPosition"],
  558. source: "position: aPosition\x0a\x09position := aPosition",
  559. messageSends: [],
  560. referencedClasses: []
  561. }),
  562. globals.Node);
  563. smalltalk.addMethod(
  564. smalltalk.method({
  565. selector: "positionEnd",
  566. protocol: 'accessing',
  567. fn: function (){
  568. var self=this;
  569. return smalltalk.withContext(function($ctx1) {
  570. var $2,$7,$6,$5,$4,$3,$1;
  571. $2=self._positionStart();
  572. $7=self._source();
  573. $ctx1.sendIdx["source"]=1;
  574. $6=_st($7)._lines();
  575. $ctx1.sendIdx["lines"]=1;
  576. $5=_st($6)._size();
  577. $ctx1.sendIdx["size"]=1;
  578. $4=_st($5).__minus((1));
  579. $ctx1.sendIdx["-"]=1;
  580. $3=_st($4).__at(_st(_st(_st(_st(self._source())._lines())._last())._size()).__minus((1)));
  581. $1=_st($2).__plus($3);
  582. return $1;
  583. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},globals.Node)})},
  584. args: [],
  585. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  586. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"],
  587. referencedClasses: []
  588. }),
  589. globals.Node);
  590. smalltalk.addMethod(
  591. smalltalk.method({
  592. selector: "positionStart",
  593. protocol: 'accessing',
  594. fn: function (){
  595. var self=this;
  596. return smalltalk.withContext(function($ctx1) {
  597. var $1;
  598. $1=self._position();
  599. return $1;
  600. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},globals.Node)})},
  601. args: [],
  602. source: "positionStart\x0a\x09^ self position",
  603. messageSends: ["position"],
  604. referencedClasses: []
  605. }),
  606. globals.Node);
  607. smalltalk.addMethod(
  608. smalltalk.method({
  609. selector: "postCopy",
  610. protocol: 'copying',
  611. fn: function (){
  612. var self=this;
  613. return smalltalk.withContext(function($ctx1) {
  614. ($ctx1.supercall = true, globals.Node.superclass.fn.prototype._postCopy.apply(_st(self), []));
  615. $ctx1.supercall = false;
  616. _st(self._nodes())._do_((function(each){
  617. return smalltalk.withContext(function($ctx2) {
  618. return _st(each)._parent_(self);
  619. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  620. return self}, function($ctx1) {$ctx1.fill(self,"postCopy",{},globals.Node)})},
  621. args: [],
  622. source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
  623. messageSends: ["postCopy", "do:", "nodes", "parent:"],
  624. referencedClasses: []
  625. }),
  626. globals.Node);
  627. smalltalk.addMethod(
  628. smalltalk.method({
  629. selector: "requiresSmalltalkContext",
  630. protocol: 'testing',
  631. fn: function (){
  632. var self=this;
  633. return smalltalk.withContext(function($ctx1) {
  634. var $1;
  635. $1=_st(_st(self._nodes())._detect_ifNone_((function(each){
  636. return smalltalk.withContext(function($ctx2) {
  637. return _st(each)._requiresSmalltalkContext();
  638. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  639. return nil;
  640. })))._notNil();
  641. return $1;
  642. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},globals.Node)})},
  643. args: [],
  644. source: "requiresSmalltalkContext\x0a\x09\x22Answer true if the receiver requires a smalltalk context.\x0a\x09Only send nodes require a context.\x0a\x09\x0a\x09If no node requires a context, the method will be compiled without one.\x0a\x09See `IRJSTranslator` and `JSStream` for context creation\x22\x0a\x09\x0a\x09^ (self nodes \x0a\x09\x09detect: [ :each | each requiresSmalltalkContext ]\x0a\x09\x09ifNone: [ nil ]) notNil",
  645. messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"],
  646. referencedClasses: []
  647. }),
  648. globals.Node);
  649. smalltalk.addMethod(
  650. smalltalk.method({
  651. selector: "shouldBeAliased",
  652. protocol: 'accessing',
  653. fn: function (){
  654. var self=this;
  655. return smalltalk.withContext(function($ctx1) {
  656. var $2,$1,$receiver;
  657. $2=self["@shouldBeAliased"];
  658. if(($receiver = $2) == null || $receiver.isNil){
  659. $1=false;
  660. } else {
  661. $1=$2;
  662. };
  663. return $1;
  664. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},globals.Node)})},
  665. args: [],
  666. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  667. messageSends: ["ifNil:"],
  668. referencedClasses: []
  669. }),
  670. globals.Node);
  671. smalltalk.addMethod(
  672. smalltalk.method({
  673. selector: "shouldBeAliased:",
  674. protocol: 'accessing',
  675. fn: function (aBoolean){
  676. var self=this;
  677. self["@shouldBeAliased"]=aBoolean;
  678. return self},
  679. args: ["aBoolean"],
  680. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  681. messageSends: [],
  682. referencedClasses: []
  683. }),
  684. globals.Node);
  685. smalltalk.addMethod(
  686. smalltalk.method({
  687. selector: "shouldBeInlined",
  688. protocol: 'accessing',
  689. fn: function (){
  690. var self=this;
  691. return smalltalk.withContext(function($ctx1) {
  692. var $2,$1,$receiver;
  693. $2=self["@shouldBeInlined"];
  694. if(($receiver = $2) == null || $receiver.isNil){
  695. $1=false;
  696. } else {
  697. $1=$2;
  698. };
  699. return $1;
  700. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},globals.Node)})},
  701. args: [],
  702. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  703. messageSends: ["ifNil:"],
  704. referencedClasses: []
  705. }),
  706. globals.Node);
  707. smalltalk.addMethod(
  708. smalltalk.method({
  709. selector: "shouldBeInlined:",
  710. protocol: 'accessing',
  711. fn: function (aBoolean){
  712. var self=this;
  713. self["@shouldBeInlined"]=aBoolean;
  714. return self},
  715. args: ["aBoolean"],
  716. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  717. messageSends: [],
  718. referencedClasses: []
  719. }),
  720. globals.Node);
  721. smalltalk.addMethod(
  722. smalltalk.method({
  723. selector: "size",
  724. protocol: 'accessing',
  725. fn: function (){
  726. var self=this;
  727. return smalltalk.withContext(function($ctx1) {
  728. var $1;
  729. $1=_st(self._source())._size();
  730. return $1;
  731. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Node)})},
  732. args: [],
  733. source: "size\x0a\x09^ self source size",
  734. messageSends: ["size", "source"],
  735. referencedClasses: []
  736. }),
  737. globals.Node);
  738. smalltalk.addMethod(
  739. smalltalk.method({
  740. selector: "source",
  741. protocol: 'accessing',
  742. fn: function (){
  743. var self=this;
  744. return smalltalk.withContext(function($ctx1) {
  745. var $2,$1,$receiver;
  746. $2=self["@source"];
  747. if(($receiver = $2) == null || $receiver.isNil){
  748. $1="";
  749. } else {
  750. $1=$2;
  751. };
  752. return $1;
  753. }, function($ctx1) {$ctx1.fill(self,"source",{},globals.Node)})},
  754. args: [],
  755. source: "source\x0a\x09^ source ifNil: [ '' ]",
  756. messageSends: ["ifNil:"],
  757. referencedClasses: []
  758. }),
  759. globals.Node);
  760. smalltalk.addMethod(
  761. smalltalk.method({
  762. selector: "source:",
  763. protocol: 'accessing',
  764. fn: function (aString){
  765. var self=this;
  766. self["@source"]=aString;
  767. return self},
  768. args: ["aString"],
  769. source: "source: aString\x0a\x09source := aString",
  770. messageSends: [],
  771. referencedClasses: []
  772. }),
  773. globals.Node);
  774. smalltalk.addMethod(
  775. smalltalk.method({
  776. selector: "stopOnStepping",
  777. protocol: 'testing',
  778. fn: function (){
  779. var self=this;
  780. return false;
  781. },
  782. args: [],
  783. source: "stopOnStepping\x0a\x09^ false",
  784. messageSends: [],
  785. referencedClasses: []
  786. }),
  787. globals.Node);
  788. smalltalk.addMethod(
  789. smalltalk.method({
  790. selector: "subtreeNeedsAliasing",
  791. protocol: 'testing',
  792. fn: function (){
  793. var self=this;
  794. return smalltalk.withContext(function($ctx1) {
  795. var $1;
  796. $1=_st(_st(self._shouldBeAliased())._or_((function(){
  797. return smalltalk.withContext(function($ctx2) {
  798. return self._shouldBeInlined();
  799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._or_((function(){
  800. return smalltalk.withContext(function($ctx2) {
  801. return _st(self._nodes())._anySatisfy_((function(each){
  802. return smalltalk.withContext(function($ctx3) {
  803. return _st(each)._subtreeNeedsAliasing();
  804. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  805. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  806. $ctx1.sendIdx["or:"]=1;
  807. return $1;
  808. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},globals.Node)})},
  809. args: [],
  810. source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  811. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"],
  812. referencedClasses: []
  813. }),
  814. globals.Node);
  815. smalltalk.addClass('AssignmentNode', globals.Node, ['left', 'right'], 'Compiler-AST');
  816. globals.AssignmentNode.comment="I represent an assignment node.";
  817. smalltalk.addMethod(
  818. smalltalk.method({
  819. selector: "accept:",
  820. protocol: 'visiting',
  821. fn: function (aVisitor){
  822. var self=this;
  823. return smalltalk.withContext(function($ctx1) {
  824. var $1;
  825. $1=_st(aVisitor)._visitAssignmentNode_(self);
  826. return $1;
  827. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.AssignmentNode)})},
  828. args: ["aVisitor"],
  829. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  830. messageSends: ["visitAssignmentNode:"],
  831. referencedClasses: []
  832. }),
  833. globals.AssignmentNode);
  834. smalltalk.addMethod(
  835. smalltalk.method({
  836. selector: "isAssignmentNode",
  837. protocol: 'testing',
  838. fn: function (){
  839. var self=this;
  840. return true;
  841. },
  842. args: [],
  843. source: "isAssignmentNode\x0a\x09^ true",
  844. messageSends: [],
  845. referencedClasses: []
  846. }),
  847. globals.AssignmentNode);
  848. smalltalk.addMethod(
  849. smalltalk.method({
  850. selector: "left",
  851. protocol: 'accessing',
  852. fn: function (){
  853. var self=this;
  854. var $1;
  855. $1=self["@left"];
  856. return $1;
  857. },
  858. args: [],
  859. source: "left\x0a\x09^ left",
  860. messageSends: [],
  861. referencedClasses: []
  862. }),
  863. globals.AssignmentNode);
  864. smalltalk.addMethod(
  865. smalltalk.method({
  866. selector: "left:",
  867. protocol: 'accessing',
  868. fn: function (aNode){
  869. var self=this;
  870. return smalltalk.withContext(function($ctx1) {
  871. self["@left"]=aNode;
  872. _st(aNode)._parent_(self);
  873. return self}, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},globals.AssignmentNode)})},
  874. args: ["aNode"],
  875. source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
  876. messageSends: ["parent:"],
  877. referencedClasses: []
  878. }),
  879. globals.AssignmentNode);
  880. smalltalk.addMethod(
  881. smalltalk.method({
  882. selector: "nodes",
  883. protocol: 'accessing',
  884. fn: function (){
  885. var self=this;
  886. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  887. return smalltalk.withContext(function($ctx1) {
  888. var $1;
  889. $1=_st($Array())._with_with_(self._left(),self._right());
  890. return $1;
  891. }, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.AssignmentNode)})},
  892. args: [],
  893. source: "nodes\x0a\x09^ Array with: self left with: self right",
  894. messageSends: ["with:with:", "left", "right"],
  895. referencedClasses: ["Array"]
  896. }),
  897. globals.AssignmentNode);
  898. smalltalk.addMethod(
  899. smalltalk.method({
  900. selector: "right",
  901. protocol: 'accessing',
  902. fn: function (){
  903. var self=this;
  904. var $1;
  905. $1=self["@right"];
  906. return $1;
  907. },
  908. args: [],
  909. source: "right\x0a\x09^ right",
  910. messageSends: [],
  911. referencedClasses: []
  912. }),
  913. globals.AssignmentNode);
  914. smalltalk.addMethod(
  915. smalltalk.method({
  916. selector: "right:",
  917. protocol: 'accessing',
  918. fn: function (aNode){
  919. var self=this;
  920. return smalltalk.withContext(function($ctx1) {
  921. self["@right"]=aNode;
  922. _st(aNode)._parent_(self);
  923. return self}, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},globals.AssignmentNode)})},
  924. args: ["aNode"],
  925. source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
  926. messageSends: ["parent:"],
  927. referencedClasses: []
  928. }),
  929. globals.AssignmentNode);
  930. smalltalk.addMethod(
  931. smalltalk.method({
  932. selector: "shouldBeAliased",
  933. protocol: 'testing',
  934. fn: function (){
  935. var self=this;
  936. return smalltalk.withContext(function($ctx1) {
  937. var $2,$1;
  938. $2=($ctx1.supercall = true, globals.AssignmentNode.superclass.fn.prototype._shouldBeAliased.apply(_st(self), []));
  939. $ctx1.supercall = false;
  940. $1=_st($2)._or_((function(){
  941. return smalltalk.withContext(function($ctx2) {
  942. return self._isReferenced();
  943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  944. return $1;
  945. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},globals.AssignmentNode)})},
  946. args: [],
  947. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  948. messageSends: ["or:", "shouldBeAliased", "isReferenced"],
  949. referencedClasses: []
  950. }),
  951. globals.AssignmentNode);
  952. smalltalk.addClass('BlockNode', globals.Node, ['parameters', 'scope'], 'Compiler-AST');
  953. globals.BlockNode.comment="I represent an block closure node.";
  954. smalltalk.addMethod(
  955. smalltalk.method({
  956. selector: "accept:",
  957. protocol: 'visiting',
  958. fn: function (aVisitor){
  959. var self=this;
  960. return smalltalk.withContext(function($ctx1) {
  961. var $1;
  962. $1=_st(aVisitor)._visitBlockNode_(self);
  963. return $1;
  964. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.BlockNode)})},
  965. args: ["aVisitor"],
  966. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  967. messageSends: ["visitBlockNode:"],
  968. referencedClasses: []
  969. }),
  970. globals.BlockNode);
  971. smalltalk.addMethod(
  972. smalltalk.method({
  973. selector: "isBlockNode",
  974. protocol: 'testing',
  975. fn: function (){
  976. var self=this;
  977. return true;
  978. },
  979. args: [],
  980. source: "isBlockNode\x0a\x09^ true",
  981. messageSends: [],
  982. referencedClasses: []
  983. }),
  984. globals.BlockNode);
  985. smalltalk.addMethod(
  986. smalltalk.method({
  987. selector: "nextChild",
  988. protocol: 'accessing',
  989. fn: function (){
  990. var self=this;
  991. return self;
  992. },
  993. args: [],
  994. source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  995. messageSends: [],
  996. referencedClasses: []
  997. }),
  998. globals.BlockNode);
  999. smalltalk.addMethod(
  1000. smalltalk.method({
  1001. selector: "nextNode:",
  1002. protocol: 'accessing',
  1003. fn: function (aNode){
  1004. var self=this;
  1005. return self;
  1006. },
  1007. args: ["aNode"],
  1008. source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  1009. messageSends: [],
  1010. referencedClasses: []
  1011. }),
  1012. globals.BlockNode);
  1013. smalltalk.addMethod(
  1014. smalltalk.method({
  1015. selector: "parameters",
  1016. protocol: 'accessing',
  1017. fn: function (){
  1018. var self=this;
  1019. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  1020. return smalltalk.withContext(function($ctx1) {
  1021. var $2,$1,$receiver;
  1022. $2=self["@parameters"];
  1023. if(($receiver = $2) == null || $receiver.isNil){
  1024. self["@parameters"]=_st($Array())._new();
  1025. $1=self["@parameters"];
  1026. } else {
  1027. $1=$2;
  1028. };
  1029. return $1;
  1030. }, function($ctx1) {$ctx1.fill(self,"parameters",{},globals.BlockNode)})},
  1031. args: [],
  1032. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  1033. messageSends: ["ifNil:", "new"],
  1034. referencedClasses: ["Array"]
  1035. }),
  1036. globals.BlockNode);
  1037. smalltalk.addMethod(
  1038. smalltalk.method({
  1039. selector: "parameters:",
  1040. protocol: 'accessing',
  1041. fn: function (aCollection){
  1042. var self=this;
  1043. self["@parameters"]=aCollection;
  1044. return self},
  1045. args: ["aCollection"],
  1046. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  1047. messageSends: [],
  1048. referencedClasses: []
  1049. }),
  1050. globals.BlockNode);
  1051. smalltalk.addMethod(
  1052. smalltalk.method({
  1053. selector: "scope",
  1054. protocol: 'accessing',
  1055. fn: function (){
  1056. var self=this;
  1057. var $1;
  1058. $1=self["@scope"];
  1059. return $1;
  1060. },
  1061. args: [],
  1062. source: "scope\x0a\x09^ scope",
  1063. messageSends: [],
  1064. referencedClasses: []
  1065. }),
  1066. globals.BlockNode);
  1067. smalltalk.addMethod(
  1068. smalltalk.method({
  1069. selector: "scope:",
  1070. protocol: 'accessing',
  1071. fn: function (aLexicalScope){
  1072. var self=this;
  1073. self["@scope"]=aLexicalScope;
  1074. return self},
  1075. args: ["aLexicalScope"],
  1076. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  1077. messageSends: [],
  1078. referencedClasses: []
  1079. }),
  1080. globals.BlockNode);
  1081. smalltalk.addMethod(
  1082. smalltalk.method({
  1083. selector: "subtreeNeedsAliasing",
  1084. protocol: 'testing',
  1085. fn: function (){
  1086. var self=this;
  1087. return smalltalk.withContext(function($ctx1) {
  1088. var $1;
  1089. $1=_st(self._shouldBeAliased())._or_((function(){
  1090. return smalltalk.withContext(function($ctx2) {
  1091. return self._shouldBeInlined();
  1092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1093. return $1;
  1094. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},globals.BlockNode)})},
  1095. args: [],
  1096. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  1097. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"],
  1098. referencedClasses: []
  1099. }),
  1100. globals.BlockNode);
  1101. smalltalk.addClass('CascadeNode', globals.Node, ['receiver'], 'Compiler-AST');
  1102. globals.CascadeNode.comment="I represent an cascade node.";
  1103. smalltalk.addMethod(
  1104. smalltalk.method({
  1105. selector: "accept:",
  1106. protocol: 'visiting',
  1107. fn: function (aVisitor){
  1108. var self=this;
  1109. return smalltalk.withContext(function($ctx1) {
  1110. var $1;
  1111. $1=_st(aVisitor)._visitCascadeNode_(self);
  1112. return $1;
  1113. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.CascadeNode)})},
  1114. args: ["aVisitor"],
  1115. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  1116. messageSends: ["visitCascadeNode:"],
  1117. referencedClasses: []
  1118. }),
  1119. globals.CascadeNode);
  1120. smalltalk.addMethod(
  1121. smalltalk.method({
  1122. selector: "isCascadeNode",
  1123. protocol: 'testing',
  1124. fn: function (){
  1125. var self=this;
  1126. return true;
  1127. },
  1128. args: [],
  1129. source: "isCascadeNode\x0a\x09^ true",
  1130. messageSends: [],
  1131. referencedClasses: []
  1132. }),
  1133. globals.CascadeNode);
  1134. smalltalk.addMethod(
  1135. smalltalk.method({
  1136. selector: "receiver",
  1137. protocol: 'accessing',
  1138. fn: function (){
  1139. var self=this;
  1140. var $1;
  1141. $1=self["@receiver"];
  1142. return $1;
  1143. },
  1144. args: [],
  1145. source: "receiver\x0a\x09^ receiver",
  1146. messageSends: [],
  1147. referencedClasses: []
  1148. }),
  1149. globals.CascadeNode);
  1150. smalltalk.addMethod(
  1151. smalltalk.method({
  1152. selector: "receiver:",
  1153. protocol: 'accessing',
  1154. fn: function (aNode){
  1155. var self=this;
  1156. self["@receiver"]=aNode;
  1157. return self},
  1158. args: ["aNode"],
  1159. source: "receiver: aNode\x0a\x09receiver := aNode",
  1160. messageSends: [],
  1161. referencedClasses: []
  1162. }),
  1163. globals.CascadeNode);
  1164. smalltalk.addClass('DynamicArrayNode', globals.Node, [], 'Compiler-AST');
  1165. globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  1166. smalltalk.addMethod(
  1167. smalltalk.method({
  1168. selector: "accept:",
  1169. protocol: 'visiting',
  1170. fn: function (aVisitor){
  1171. var self=this;
  1172. return smalltalk.withContext(function($ctx1) {
  1173. var $1;
  1174. $1=_st(aVisitor)._visitDynamicArrayNode_(self);
  1175. return $1;
  1176. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.DynamicArrayNode)})},
  1177. args: ["aVisitor"],
  1178. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  1179. messageSends: ["visitDynamicArrayNode:"],
  1180. referencedClasses: []
  1181. }),
  1182. globals.DynamicArrayNode);
  1183. smalltalk.addClass('DynamicDictionaryNode', globals.Node, [], 'Compiler-AST');
  1184. globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  1185. smalltalk.addMethod(
  1186. smalltalk.method({
  1187. selector: "accept:",
  1188. protocol: 'visiting',
  1189. fn: function (aVisitor){
  1190. var self=this;
  1191. return smalltalk.withContext(function($ctx1) {
  1192. var $1;
  1193. $1=_st(aVisitor)._visitDynamicDictionaryNode_(self);
  1194. return $1;
  1195. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.DynamicDictionaryNode)})},
  1196. args: ["aVisitor"],
  1197. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  1198. messageSends: ["visitDynamicDictionaryNode:"],
  1199. referencedClasses: []
  1200. }),
  1201. globals.DynamicDictionaryNode);
  1202. smalltalk.addClass('JSStatementNode', globals.Node, [], 'Compiler-AST');
  1203. globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  1204. smalltalk.addMethod(
  1205. smalltalk.method({
  1206. selector: "accept:",
  1207. protocol: 'visiting',
  1208. fn: function (aVisitor){
  1209. var self=this;
  1210. return smalltalk.withContext(function($ctx1) {
  1211. var $1;
  1212. $1=_st(aVisitor)._visitJSStatementNode_(self);
  1213. return $1;
  1214. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.JSStatementNode)})},
  1215. args: ["aVisitor"],
  1216. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  1217. messageSends: ["visitJSStatementNode:"],
  1218. referencedClasses: []
  1219. }),
  1220. globals.JSStatementNode);
  1221. smalltalk.addMethod(
  1222. smalltalk.method({
  1223. selector: "isJSStatementNode",
  1224. protocol: 'testing',
  1225. fn: function (){
  1226. var self=this;
  1227. return true;
  1228. },
  1229. args: [],
  1230. source: "isJSStatementNode\x0a\x09^ true",
  1231. messageSends: [],
  1232. referencedClasses: []
  1233. }),
  1234. globals.JSStatementNode);
  1235. smalltalk.addMethod(
  1236. smalltalk.method({
  1237. selector: "requiresSmalltalkContext",
  1238. protocol: 'testing',
  1239. fn: function (){
  1240. var self=this;
  1241. return true;
  1242. },
  1243. args: [],
  1244. source: "requiresSmalltalkContext\x0a\x09^ true",
  1245. messageSends: [],
  1246. referencedClasses: []
  1247. }),
  1248. globals.JSStatementNode);
  1249. smalltalk.addClass('MethodNode', globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes', 'superSends'], 'Compiler-AST');
  1250. globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  1251. smalltalk.addMethod(
  1252. smalltalk.method({
  1253. selector: "accept:",
  1254. protocol: 'visiting',
  1255. fn: function (aVisitor){
  1256. var self=this;
  1257. return smalltalk.withContext(function($ctx1) {
  1258. var $1;
  1259. $1=_st(aVisitor)._visitMethodNode_(self);
  1260. return $1;
  1261. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.MethodNode)})},
  1262. args: ["aVisitor"],
  1263. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  1264. messageSends: ["visitMethodNode:"],
  1265. referencedClasses: []
  1266. }),
  1267. globals.MethodNode);
  1268. smalltalk.addMethod(
  1269. smalltalk.method({
  1270. selector: "arguments",
  1271. protocol: 'accessing',
  1272. fn: function (){
  1273. var self=this;
  1274. return smalltalk.withContext(function($ctx1) {
  1275. var $2,$1,$receiver;
  1276. $2=self["@arguments"];
  1277. if(($receiver = $2) == null || $receiver.isNil){
  1278. $1=[];
  1279. } else {
  1280. $1=$2;
  1281. };
  1282. return $1;
  1283. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.MethodNode)})},
  1284. args: [],
  1285. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  1286. messageSends: ["ifNil:"],
  1287. referencedClasses: []
  1288. }),
  1289. globals.MethodNode);
  1290. smalltalk.addMethod(
  1291. smalltalk.method({
  1292. selector: "arguments:",
  1293. protocol: 'accessing',
  1294. fn: function (aCollection){
  1295. var self=this;
  1296. self["@arguments"]=aCollection;
  1297. return self},
  1298. args: ["aCollection"],
  1299. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  1300. messageSends: [],
  1301. referencedClasses: []
  1302. }),
  1303. globals.MethodNode);
  1304. smalltalk.addMethod(
  1305. smalltalk.method({
  1306. selector: "classReferences",
  1307. protocol: 'accessing',
  1308. fn: function (){
  1309. var self=this;
  1310. var $1;
  1311. $1=self["@classReferences"];
  1312. return $1;
  1313. },
  1314. args: [],
  1315. source: "classReferences\x0a\x09^ classReferences",
  1316. messageSends: [],
  1317. referencedClasses: []
  1318. }),
  1319. globals.MethodNode);
  1320. smalltalk.addMethod(
  1321. smalltalk.method({
  1322. selector: "classReferences:",
  1323. protocol: 'accessing',
  1324. fn: function (aCollection){
  1325. var self=this;
  1326. self["@classReferences"]=aCollection;
  1327. return self},
  1328. args: ["aCollection"],
  1329. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  1330. messageSends: [],
  1331. referencedClasses: []
  1332. }),
  1333. globals.MethodNode);
  1334. smalltalk.addMethod(
  1335. smalltalk.method({
  1336. selector: "messageSends",
  1337. protocol: 'accessing',
  1338. fn: function (){
  1339. var self=this;
  1340. return smalltalk.withContext(function($ctx1) {
  1341. var $1;
  1342. $1=_st(self._sendIndexes())._keys();
  1343. return $1;
  1344. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.MethodNode)})},
  1345. args: [],
  1346. source: "messageSends\x0a\x09^ self sendIndexes keys",
  1347. messageSends: ["keys", "sendIndexes"],
  1348. referencedClasses: []
  1349. }),
  1350. globals.MethodNode);
  1351. smalltalk.addMethod(
  1352. smalltalk.method({
  1353. selector: "method",
  1354. protocol: 'accessing',
  1355. fn: function (){
  1356. var self=this;
  1357. return self;
  1358. },
  1359. args: [],
  1360. source: "method\x0a\x09^ self",
  1361. messageSends: [],
  1362. referencedClasses: []
  1363. }),
  1364. globals.MethodNode);
  1365. smalltalk.addMethod(
  1366. smalltalk.method({
  1367. selector: "scope",
  1368. protocol: 'accessing',
  1369. fn: function (){
  1370. var self=this;
  1371. var $1;
  1372. $1=self["@scope"];
  1373. return $1;
  1374. },
  1375. args: [],
  1376. source: "scope\x0a\x09^ scope",
  1377. messageSends: [],
  1378. referencedClasses: []
  1379. }),
  1380. globals.MethodNode);
  1381. smalltalk.addMethod(
  1382. smalltalk.method({
  1383. selector: "scope:",
  1384. protocol: 'accessing',
  1385. fn: function (aMethodScope){
  1386. var self=this;
  1387. self["@scope"]=aMethodScope;
  1388. return self},
  1389. args: ["aMethodScope"],
  1390. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  1391. messageSends: [],
  1392. referencedClasses: []
  1393. }),
  1394. globals.MethodNode);
  1395. smalltalk.addMethod(
  1396. smalltalk.method({
  1397. selector: "selector",
  1398. protocol: 'accessing',
  1399. fn: function (){
  1400. var self=this;
  1401. var $1;
  1402. $1=self["@selector"];
  1403. return $1;
  1404. },
  1405. args: [],
  1406. source: "selector\x0a\x09^ selector",
  1407. messageSends: [],
  1408. referencedClasses: []
  1409. }),
  1410. globals.MethodNode);
  1411. smalltalk.addMethod(
  1412. smalltalk.method({
  1413. selector: "selector:",
  1414. protocol: 'accessing',
  1415. fn: function (aString){
  1416. var self=this;
  1417. self["@selector"]=aString;
  1418. return self},
  1419. args: ["aString"],
  1420. source: "selector: aString\x0a\x09selector := aString",
  1421. messageSends: [],
  1422. referencedClasses: []
  1423. }),
  1424. globals.MethodNode);
  1425. smalltalk.addMethod(
  1426. smalltalk.method({
  1427. selector: "sendIndexes",
  1428. protocol: 'accessing',
  1429. fn: function (){
  1430. var self=this;
  1431. var $1;
  1432. $1=self["@sendIndexes"];
  1433. return $1;
  1434. },
  1435. args: [],
  1436. source: "sendIndexes\x0a\x09^ sendIndexes",
  1437. messageSends: [],
  1438. referencedClasses: []
  1439. }),
  1440. globals.MethodNode);
  1441. smalltalk.addMethod(
  1442. smalltalk.method({
  1443. selector: "sendIndexes:",
  1444. protocol: 'accessing',
  1445. fn: function (aDictionary){
  1446. var self=this;
  1447. self["@sendIndexes"]=aDictionary;
  1448. return self},
  1449. args: ["aDictionary"],
  1450. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  1451. messageSends: [],
  1452. referencedClasses: []
  1453. }),
  1454. globals.MethodNode);
  1455. smalltalk.addMethod(
  1456. smalltalk.method({
  1457. selector: "sequenceNode",
  1458. protocol: 'accessing',
  1459. fn: function (){
  1460. var self=this;
  1461. return smalltalk.withContext(function($ctx1) {
  1462. var $1;
  1463. var $early={};
  1464. try {
  1465. _st(self._nodes())._do_((function(each){
  1466. return smalltalk.withContext(function($ctx2) {
  1467. $1=_st(each)._isSequenceNode();
  1468. if(smalltalk.assert($1)){
  1469. throw $early=[each];
  1470. };
  1471. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1472. return nil;
  1473. }
  1474. catch(e) {if(e===$early)return e[0]; throw e}
  1475. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},globals.MethodNode)})},
  1476. args: [],
  1477. source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  1478. messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"],
  1479. referencedClasses: []
  1480. }),
  1481. globals.MethodNode);
  1482. smalltalk.addMethod(
  1483. smalltalk.method({
  1484. selector: "source",
  1485. protocol: 'accessing',
  1486. fn: function (){
  1487. var self=this;
  1488. var $1;
  1489. $1=self["@source"];
  1490. return $1;
  1491. },
  1492. args: [],
  1493. source: "source\x0a\x09^ source",
  1494. messageSends: [],
  1495. referencedClasses: []
  1496. }),
  1497. globals.MethodNode);
  1498. smalltalk.addMethod(
  1499. smalltalk.method({
  1500. selector: "source:",
  1501. protocol: 'accessing',
  1502. fn: function (aString){
  1503. var self=this;
  1504. self["@source"]=aString;
  1505. return self},
  1506. args: ["aString"],
  1507. source: "source: aString\x0a\x09source := aString",
  1508. messageSends: [],
  1509. referencedClasses: []
  1510. }),
  1511. globals.MethodNode);
  1512. smalltalk.addMethod(
  1513. smalltalk.method({
  1514. selector: "superSends",
  1515. protocol: 'accessing',
  1516. fn: function (){
  1517. var self=this;
  1518. var $1;
  1519. $1=self["@superSends"];
  1520. return $1;
  1521. },
  1522. args: [],
  1523. source: "superSends\x0a\x09^ superSends",
  1524. messageSends: [],
  1525. referencedClasses: []
  1526. }),
  1527. globals.MethodNode);
  1528. smalltalk.addMethod(
  1529. smalltalk.method({
  1530. selector: "superSends:",
  1531. protocol: 'accessing',
  1532. fn: function (aCollection){
  1533. var self=this;
  1534. self["@superSends"]=aCollection;
  1535. return self},
  1536. args: ["aCollection"],
  1537. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  1538. messageSends: [],
  1539. referencedClasses: []
  1540. }),
  1541. globals.MethodNode);
  1542. smalltalk.addClass('ReturnNode', globals.Node, ['scope'], 'Compiler-AST');
  1543. globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  1544. smalltalk.addMethod(
  1545. smalltalk.method({
  1546. selector: "accept:",
  1547. protocol: 'visiting',
  1548. fn: function (aVisitor){
  1549. var self=this;
  1550. return smalltalk.withContext(function($ctx1) {
  1551. var $1;
  1552. $1=_st(aVisitor)._visitReturnNode_(self);
  1553. return $1;
  1554. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.ReturnNode)})},
  1555. args: ["aVisitor"],
  1556. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  1557. messageSends: ["visitReturnNode:"],
  1558. referencedClasses: []
  1559. }),
  1560. globals.ReturnNode);
  1561. smalltalk.addMethod(
  1562. smalltalk.method({
  1563. selector: "isReturnNode",
  1564. protocol: 'testing',
  1565. fn: function (){
  1566. var self=this;
  1567. return true;
  1568. },
  1569. args: [],
  1570. source: "isReturnNode\x0a\x09^ true",
  1571. messageSends: [],
  1572. referencedClasses: []
  1573. }),
  1574. globals.ReturnNode);
  1575. smalltalk.addMethod(
  1576. smalltalk.method({
  1577. selector: "nonLocalReturn",
  1578. protocol: 'testing',
  1579. fn: function (){
  1580. var self=this;
  1581. return smalltalk.withContext(function($ctx1) {
  1582. var $1;
  1583. $1=_st(_st(self._scope())._isMethodScope())._not();
  1584. return $1;
  1585. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},globals.ReturnNode)})},
  1586. args: [],
  1587. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  1588. messageSends: ["not", "isMethodScope", "scope"],
  1589. referencedClasses: []
  1590. }),
  1591. globals.ReturnNode);
  1592. smalltalk.addMethod(
  1593. smalltalk.method({
  1594. selector: "scope",
  1595. protocol: 'accessing',
  1596. fn: function (){
  1597. var self=this;
  1598. var $1;
  1599. $1=self["@scope"];
  1600. return $1;
  1601. },
  1602. args: [],
  1603. source: "scope\x0a\x09^ scope",
  1604. messageSends: [],
  1605. referencedClasses: []
  1606. }),
  1607. globals.ReturnNode);
  1608. smalltalk.addMethod(
  1609. smalltalk.method({
  1610. selector: "scope:",
  1611. protocol: 'accessing',
  1612. fn: function (aLexicalScope){
  1613. var self=this;
  1614. self["@scope"]=aLexicalScope;
  1615. return self},
  1616. args: ["aLexicalScope"],
  1617. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  1618. messageSends: [],
  1619. referencedClasses: []
  1620. }),
  1621. globals.ReturnNode);
  1622. smalltalk.addClass('SendNode', globals.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
  1623. globals.SendNode.comment="I represent an message send node.";
  1624. smalltalk.addMethod(
  1625. smalltalk.method({
  1626. selector: "accept:",
  1627. protocol: 'visiting',
  1628. fn: function (aVisitor){
  1629. var self=this;
  1630. return smalltalk.withContext(function($ctx1) {
  1631. var $1;
  1632. $1=_st(aVisitor)._visitSendNode_(self);
  1633. return $1;
  1634. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.SendNode)})},
  1635. args: ["aVisitor"],
  1636. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  1637. messageSends: ["visitSendNode:"],
  1638. referencedClasses: []
  1639. }),
  1640. globals.SendNode);
  1641. smalltalk.addMethod(
  1642. smalltalk.method({
  1643. selector: "arguments",
  1644. protocol: 'accessing',
  1645. fn: function (){
  1646. var self=this;
  1647. return smalltalk.withContext(function($ctx1) {
  1648. var $2,$1,$receiver;
  1649. $2=self["@arguments"];
  1650. if(($receiver = $2) == null || $receiver.isNil){
  1651. self["@arguments"]=[];
  1652. $1=self["@arguments"];
  1653. } else {
  1654. $1=$2;
  1655. };
  1656. return $1;
  1657. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.SendNode)})},
  1658. args: [],
  1659. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  1660. messageSends: ["ifNil:"],
  1661. referencedClasses: []
  1662. }),
  1663. globals.SendNode);
  1664. smalltalk.addMethod(
  1665. smalltalk.method({
  1666. selector: "arguments:",
  1667. protocol: 'accessing',
  1668. fn: function (aCollection){
  1669. var self=this;
  1670. return smalltalk.withContext(function($ctx1) {
  1671. self["@arguments"]=aCollection;
  1672. _st(aCollection)._do_((function(each){
  1673. return smalltalk.withContext(function($ctx2) {
  1674. return _st(each)._parent_(self);
  1675. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1676. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},globals.SendNode)})},
  1677. args: ["aCollection"],
  1678. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  1679. messageSends: ["do:", "parent:"],
  1680. referencedClasses: []
  1681. }),
  1682. globals.SendNode);
  1683. smalltalk.addMethod(
  1684. smalltalk.method({
  1685. selector: "cascadeNodeWithMessages:",
  1686. protocol: 'accessing',
  1687. fn: function (aCollection){
  1688. var self=this;
  1689. var first;
  1690. function $SendNode(){return globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  1691. function $CascadeNode(){return globals.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
  1692. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  1693. return smalltalk.withContext(function($ctx1) {
  1694. var $1,$2,$4,$5,$3;
  1695. $1=_st($SendNode())._new();
  1696. $ctx1.sendIdx["new"]=1;
  1697. _st($1)._selector_(self._selector());
  1698. _st($1)._arguments_(self._arguments());
  1699. $2=_st($1)._yourself();
  1700. $ctx1.sendIdx["yourself"]=1;
  1701. first=$2;
  1702. $4=_st($CascadeNode())._new();
  1703. _st($4)._receiver_(self._receiver());
  1704. _st($4)._nodes_(_st(_st($Array())._with_(first)).__comma(aCollection));
  1705. $5=_st($4)._yourself();
  1706. $3=$5;
  1707. return $3;
  1708. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},globals.SendNode)})},
  1709. args: ["aCollection"],
  1710. source: "cascadeNodeWithMessages: aCollection\x0a\x09| first |\x0a\x09first := SendNode new\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself.\x0a\x09^ CascadeNode new\x0a\x09\x09receiver: self receiver;\x0a\x09\x09nodes: (Array with: first), aCollection;\x0a\x09\x09yourself",
  1711. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"],
  1712. referencedClasses: ["SendNode", "CascadeNode", "Array"]
  1713. }),
  1714. globals.SendNode);
  1715. smalltalk.addMethod(
  1716. smalltalk.method({
  1717. selector: "index",
  1718. protocol: 'accessing',
  1719. fn: function (){
  1720. var self=this;
  1721. var $1;
  1722. $1=self["@index"];
  1723. return $1;
  1724. },
  1725. args: [],
  1726. source: "index\x0a\x09^ index",
  1727. messageSends: [],
  1728. referencedClasses: []
  1729. }),
  1730. globals.SendNode);
  1731. smalltalk.addMethod(
  1732. smalltalk.method({
  1733. selector: "index:",
  1734. protocol: 'accessing',
  1735. fn: function (anInteger){
  1736. var self=this;
  1737. self["@index"]=anInteger;
  1738. return self},
  1739. args: ["anInteger"],
  1740. source: "index: anInteger\x0a\x09index := anInteger",
  1741. messageSends: [],
  1742. referencedClasses: []
  1743. }),
  1744. globals.SendNode);
  1745. smalltalk.addMethod(
  1746. smalltalk.method({
  1747. selector: "isCascadeSendNode",
  1748. protocol: 'testing',
  1749. fn: function (){
  1750. var self=this;
  1751. return smalltalk.withContext(function($ctx1) {
  1752. var $1;
  1753. $1=_st(self._parent())._isCascadeNode();
  1754. return $1;
  1755. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},globals.SendNode)})},
  1756. args: [],
  1757. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  1758. messageSends: ["isCascadeNode", "parent"],
  1759. referencedClasses: []
  1760. }),
  1761. globals.SendNode);
  1762. smalltalk.addMethod(
  1763. smalltalk.method({
  1764. selector: "isNavigationNode",
  1765. protocol: 'testing',
  1766. fn: function (){
  1767. var self=this;
  1768. return true;
  1769. },
  1770. args: [],
  1771. source: "isNavigationNode\x0a\x09^ true",
  1772. messageSends: [],
  1773. referencedClasses: []
  1774. }),
  1775. globals.SendNode);
  1776. smalltalk.addMethod(
  1777. smalltalk.method({
  1778. selector: "isSendNode",
  1779. protocol: 'testing',
  1780. fn: function (){
  1781. var self=this;
  1782. return true;
  1783. },
  1784. args: [],
  1785. source: "isSendNode\x0a\x09^ true",
  1786. messageSends: [],
  1787. referencedClasses: []
  1788. }),
  1789. globals.SendNode);
  1790. smalltalk.addMethod(
  1791. smalltalk.method({
  1792. selector: "navigationLink",
  1793. protocol: 'accessing',
  1794. fn: function (){
  1795. var self=this;
  1796. return smalltalk.withContext(function($ctx1) {
  1797. var $1;
  1798. $1=self._selector();
  1799. return $1;
  1800. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},globals.SendNode)})},
  1801. args: [],
  1802. source: "navigationLink\x0a\x09^ self selector",
  1803. messageSends: ["selector"],
  1804. referencedClasses: []
  1805. }),
  1806. globals.SendNode);
  1807. smalltalk.addMethod(
  1808. smalltalk.method({
  1809. selector: "nodes",
  1810. protocol: 'accessing',
  1811. fn: function (){
  1812. var self=this;
  1813. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  1814. return smalltalk.withContext(function($ctx1) {
  1815. var $1,$3,$2,$5,$6,$4,$receiver;
  1816. $1=self._receiver();
  1817. $ctx1.sendIdx["receiver"]=1;
  1818. if(($receiver = $1) == null || $receiver.isNil){
  1819. $3=self._arguments();
  1820. $ctx1.sendIdx["arguments"]=1;
  1821. $2=_st($3)._copy();
  1822. return $2;
  1823. } else {
  1824. $1;
  1825. };
  1826. $5=_st($Array())._with_(self._receiver());
  1827. _st($5)._addAll_(self._arguments());
  1828. $6=_st($5)._yourself();
  1829. $4=$6;
  1830. return $4;
  1831. }, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.SendNode)})},
  1832. args: [],
  1833. source: "nodes\x0a\x09self receiver ifNil: [ ^ self arguments copy ].\x0a\x09\x0a\x09^ (Array with: self receiver)\x0a\x09\x09addAll: self arguments;\x0a\x09\x09yourself",
  1834. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"],
  1835. referencedClasses: ["Array"]
  1836. }),
  1837. globals.SendNode);
  1838. smalltalk.addMethod(
  1839. smalltalk.method({
  1840. selector: "receiver",
  1841. protocol: 'accessing',
  1842. fn: function (){
  1843. var self=this;
  1844. var $1;
  1845. $1=self["@receiver"];
  1846. return $1;
  1847. },
  1848. args: [],
  1849. source: "receiver\x0a\x09^ receiver",
  1850. messageSends: [],
  1851. referencedClasses: []
  1852. }),
  1853. globals.SendNode);
  1854. smalltalk.addMethod(
  1855. smalltalk.method({
  1856. selector: "receiver:",
  1857. protocol: 'accessing',
  1858. fn: function (aNode){
  1859. var self=this;
  1860. return smalltalk.withContext(function($ctx1) {
  1861. var $1;
  1862. self["@receiver"]=aNode;
  1863. $1=_st(aNode)._isNode();
  1864. if(smalltalk.assert($1)){
  1865. _st(aNode)._parent_(self);
  1866. };
  1867. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},globals.SendNode)})},
  1868. args: ["aNode"],
  1869. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  1870. messageSends: ["ifTrue:", "isNode", "parent:"],
  1871. referencedClasses: []
  1872. }),
  1873. globals.SendNode);
  1874. smalltalk.addMethod(
  1875. smalltalk.method({
  1876. selector: "requiresSmalltalkContext",
  1877. protocol: 'testing',
  1878. fn: function (){
  1879. var self=this;
  1880. return true;
  1881. },
  1882. args: [],
  1883. source: "requiresSmalltalkContext\x0a\x09^ true",
  1884. messageSends: [],
  1885. referencedClasses: []
  1886. }),
  1887. globals.SendNode);
  1888. smalltalk.addMethod(
  1889. smalltalk.method({
  1890. selector: "selector",
  1891. protocol: 'accessing',
  1892. fn: function (){
  1893. var self=this;
  1894. var $1;
  1895. $1=self["@selector"];
  1896. return $1;
  1897. },
  1898. args: [],
  1899. source: "selector\x0a\x09^ selector",
  1900. messageSends: [],
  1901. referencedClasses: []
  1902. }),
  1903. globals.SendNode);
  1904. smalltalk.addMethod(
  1905. smalltalk.method({
  1906. selector: "selector:",
  1907. protocol: 'accessing',
  1908. fn: function (aString){
  1909. var self=this;
  1910. self["@selector"]=aString;
  1911. return self},
  1912. args: ["aString"],
  1913. source: "selector: aString\x0a\x09selector := aString",
  1914. messageSends: [],
  1915. referencedClasses: []
  1916. }),
  1917. globals.SendNode);
  1918. smalltalk.addMethod(
  1919. smalltalk.method({
  1920. selector: "shouldBeAliased",
  1921. protocol: 'testing',
  1922. fn: function (){
  1923. var self=this;
  1924. var sends;
  1925. return smalltalk.withContext(function($ctx1) {
  1926. var $2,$1;
  1927. sends=_st(_st(_st(self._method())._sendIndexes())._at_(self._selector()))._size();
  1928. $2=($ctx1.supercall = true, globals.SendNode.superclass.fn.prototype._shouldBeAliased.apply(_st(self), []));
  1929. $ctx1.supercall = false;
  1930. $1=_st($2)._or_((function(){
  1931. return smalltalk.withContext(function($ctx2) {
  1932. return _st(self._isReferenced())._and_((function(){
  1933. return smalltalk.withContext(function($ctx3) {
  1934. return _st(_st(_st(sends).__gt((1)))._and_((function(){
  1935. return smalltalk.withContext(function($ctx4) {
  1936. return _st(self._index()).__lt(sends);
  1937. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)})})))._or_((function(){
  1938. return smalltalk.withContext(function($ctx4) {
  1939. return self._superSend();
  1940. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})}));
  1941. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  1942. $ctx2.sendIdx["and:"]=1;
  1943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1944. $ctx1.sendIdx["or:"]=1;
  1945. return $1;
  1946. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},globals.SendNode)})},
  1947. args: [],
  1948. source: "shouldBeAliased\x0a\x09\x22Because we keep track of send indexes, some send nodes need additional care for aliasing. \x0a\x09See IRJSVisitor >> visitIRSend:\x22\x0a\x09\x0a\x09| sends |\x0a\x09\x0a\x09sends := (self method sendIndexes at: self selector) size.\x0a\x09\x0a\x09^ (super shouldBeAliased or: [\x0a\x09\x09self isReferenced and: [\x0a\x09\x09\x09(sends > 1 and: [ self index < sends ])\x0a\x09\x09\x09\x09or: [ self superSend ] ] ])",
  1949. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", ">", "<", "index", "superSend"],
  1950. referencedClasses: []
  1951. }),
  1952. globals.SendNode);
  1953. smalltalk.addMethod(
  1954. smalltalk.method({
  1955. selector: "stopOnStepping",
  1956. protocol: 'testing',
  1957. fn: function (){
  1958. var self=this;
  1959. return true;
  1960. },
  1961. args: [],
  1962. source: "stopOnStepping\x0a\x09^ true",
  1963. messageSends: [],
  1964. referencedClasses: []
  1965. }),
  1966. globals.SendNode);
  1967. smalltalk.addMethod(
  1968. smalltalk.method({
  1969. selector: "superSend",
  1970. protocol: 'accessing',
  1971. fn: function (){
  1972. var self=this;
  1973. return smalltalk.withContext(function($ctx1) {
  1974. var $2,$1,$receiver;
  1975. $2=self["@superSend"];
  1976. if(($receiver = $2) == null || $receiver.isNil){
  1977. $1=false;
  1978. } else {
  1979. $1=$2;
  1980. };
  1981. return $1;
  1982. }, function($ctx1) {$ctx1.fill(self,"superSend",{},globals.SendNode)})},
  1983. args: [],
  1984. source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
  1985. messageSends: ["ifNil:"],
  1986. referencedClasses: []
  1987. }),
  1988. globals.SendNode);
  1989. smalltalk.addMethod(
  1990. smalltalk.method({
  1991. selector: "superSend:",
  1992. protocol: 'accessing',
  1993. fn: function (aBoolean){
  1994. var self=this;
  1995. self["@superSend"]=aBoolean;
  1996. return self},
  1997. args: ["aBoolean"],
  1998. source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
  1999. messageSends: [],
  2000. referencedClasses: []
  2001. }),
  2002. globals.SendNode);
  2003. smalltalk.addMethod(
  2004. smalltalk.method({
  2005. selector: "valueForReceiver:",
  2006. protocol: 'accessing',
  2007. fn: function (anObject){
  2008. var self=this;
  2009. function $SendNode(){return globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  2010. return smalltalk.withContext(function($ctx1) {
  2011. var $2,$3,$5,$4,$6,$1,$receiver;
  2012. $2=_st($SendNode())._new();
  2013. _st($2)._position_(self._position());
  2014. _st($2)._source_(self._source());
  2015. $3=$2;
  2016. $5=self._receiver();
  2017. $ctx1.sendIdx["receiver"]=1;
  2018. if(($receiver = $5) == null || $receiver.isNil){
  2019. $4=anObject;
  2020. } else {
  2021. $4=_st(self._receiver())._valueForReceiver_(anObject);
  2022. };
  2023. _st($3)._receiver_($4);
  2024. _st($2)._selector_(self._selector());
  2025. _st($2)._arguments_(self._arguments());
  2026. $6=_st($2)._yourself();
  2027. $1=$6;
  2028. return $1;
  2029. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},globals.SendNode)})},
  2030. args: ["anObject"],
  2031. source: "valueForReceiver: anObject\x0a\x09^ SendNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09receiver: (self receiver\x0a\x09\x09ifNil: [ anObject ] \x0a\x09\x09ifNotNil: [ self receiver valueForReceiver: anObject ]);\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself",
  2032. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"],
  2033. referencedClasses: ["SendNode"]
  2034. }),
  2035. globals.SendNode);
  2036. smalltalk.addClass('SequenceNode', globals.Node, ['temps', 'scope'], 'Compiler-AST');
  2037. globals.SequenceNode.comment="I represent an sequence node. A sequence represent a set of instructions inside the same scope (the method scope or a block scope).";
  2038. smalltalk.addMethod(
  2039. smalltalk.method({
  2040. selector: "accept:",
  2041. protocol: 'visiting',
  2042. fn: function (aVisitor){
  2043. var self=this;
  2044. return smalltalk.withContext(function($ctx1) {
  2045. var $1;
  2046. $1=_st(aVisitor)._visitSequenceNode_(self);
  2047. return $1;
  2048. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.SequenceNode)})},
  2049. args: ["aVisitor"],
  2050. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  2051. messageSends: ["visitSequenceNode:"],
  2052. referencedClasses: []
  2053. }),
  2054. globals.SequenceNode);
  2055. smalltalk.addMethod(
  2056. smalltalk.method({
  2057. selector: "asBlockSequenceNode",
  2058. protocol: 'converting',
  2059. fn: function (){
  2060. var self=this;
  2061. function $BlockSequenceNode(){return globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
  2062. return smalltalk.withContext(function($ctx1) {
  2063. var $2,$3,$1;
  2064. $2=_st($BlockSequenceNode())._new();
  2065. _st($2)._position_(self._position());
  2066. _st($2)._source_(self._source());
  2067. _st($2)._nodes_(self._nodes());
  2068. _st($2)._temps_(self._temps());
  2069. $3=_st($2)._yourself();
  2070. $1=$3;
  2071. return $1;
  2072. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},globals.SequenceNode)})},
  2073. args: [],
  2074. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09nodes: self nodes;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
  2075. messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"],
  2076. referencedClasses: ["BlockSequenceNode"]
  2077. }),
  2078. globals.SequenceNode);
  2079. smalltalk.addMethod(
  2080. smalltalk.method({
  2081. selector: "isSequenceNode",
  2082. protocol: 'testing',
  2083. fn: function (){
  2084. var self=this;
  2085. return true;
  2086. },
  2087. args: [],
  2088. source: "isSequenceNode\x0a\x09^ true",
  2089. messageSends: [],
  2090. referencedClasses: []
  2091. }),
  2092. globals.SequenceNode);
  2093. smalltalk.addMethod(
  2094. smalltalk.method({
  2095. selector: "scope",
  2096. protocol: 'accessing',
  2097. fn: function (){
  2098. var self=this;
  2099. var $1;
  2100. $1=self["@scope"];
  2101. return $1;
  2102. },
  2103. args: [],
  2104. source: "scope\x0a\x09^ scope",
  2105. messageSends: [],
  2106. referencedClasses: []
  2107. }),
  2108. globals.SequenceNode);
  2109. smalltalk.addMethod(
  2110. smalltalk.method({
  2111. selector: "scope:",
  2112. protocol: 'accessing',
  2113. fn: function (aLexicalScope){
  2114. var self=this;
  2115. self["@scope"]=aLexicalScope;
  2116. return self},
  2117. args: ["aLexicalScope"],
  2118. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  2119. messageSends: [],
  2120. referencedClasses: []
  2121. }),
  2122. globals.SequenceNode);
  2123. smalltalk.addMethod(
  2124. smalltalk.method({
  2125. selector: "temps",
  2126. protocol: 'accessing',
  2127. fn: function (){
  2128. var self=this;
  2129. return smalltalk.withContext(function($ctx1) {
  2130. var $2,$1,$receiver;
  2131. $2=self["@temps"];
  2132. if(($receiver = $2) == null || $receiver.isNil){
  2133. $1=[];
  2134. } else {
  2135. $1=$2;
  2136. };
  2137. return $1;
  2138. }, function($ctx1) {$ctx1.fill(self,"temps",{},globals.SequenceNode)})},
  2139. args: [],
  2140. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  2141. messageSends: ["ifNil:"],
  2142. referencedClasses: []
  2143. }),
  2144. globals.SequenceNode);
  2145. smalltalk.addMethod(
  2146. smalltalk.method({
  2147. selector: "temps:",
  2148. protocol: 'accessing',
  2149. fn: function (aCollection){
  2150. var self=this;
  2151. self["@temps"]=aCollection;
  2152. return self},
  2153. args: ["aCollection"],
  2154. source: "temps: aCollection\x0a\x09temps := aCollection",
  2155. messageSends: [],
  2156. referencedClasses: []
  2157. }),
  2158. globals.SequenceNode);
  2159. smalltalk.addClass('BlockSequenceNode', globals.SequenceNode, [], 'Compiler-AST');
  2160. globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  2161. smalltalk.addMethod(
  2162. smalltalk.method({
  2163. selector: "accept:",
  2164. protocol: 'visiting',
  2165. fn: function (aVisitor){
  2166. var self=this;
  2167. return smalltalk.withContext(function($ctx1) {
  2168. var $1;
  2169. $1=_st(aVisitor)._visitBlockSequenceNode_(self);
  2170. return $1;
  2171. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.BlockSequenceNode)})},
  2172. args: ["aVisitor"],
  2173. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  2174. messageSends: ["visitBlockSequenceNode:"],
  2175. referencedClasses: []
  2176. }),
  2177. globals.BlockSequenceNode);
  2178. smalltalk.addMethod(
  2179. smalltalk.method({
  2180. selector: "isBlockSequenceNode",
  2181. protocol: 'testing',
  2182. fn: function (){
  2183. var self=this;
  2184. return true;
  2185. },
  2186. args: [],
  2187. source: "isBlockSequenceNode\x0a\x09^ true",
  2188. messageSends: [],
  2189. referencedClasses: []
  2190. }),
  2191. globals.BlockSequenceNode);
  2192. smalltalk.addClass('ValueNode', globals.Node, ['value'], 'Compiler-AST');
  2193. globals.ValueNode.comment="I represent a value node.";
  2194. smalltalk.addMethod(
  2195. smalltalk.method({
  2196. selector: "accept:",
  2197. protocol: 'visiting',
  2198. fn: function (aVisitor){
  2199. var self=this;
  2200. return smalltalk.withContext(function($ctx1) {
  2201. var $1;
  2202. $1=_st(aVisitor)._visitValueNode_(self);
  2203. return $1;
  2204. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.ValueNode)})},
  2205. args: ["aVisitor"],
  2206. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  2207. messageSends: ["visitValueNode:"],
  2208. referencedClasses: []
  2209. }),
  2210. globals.ValueNode);
  2211. smalltalk.addMethod(
  2212. smalltalk.method({
  2213. selector: "isImmutable",
  2214. protocol: 'testing',
  2215. fn: function (){
  2216. var self=this;
  2217. return smalltalk.withContext(function($ctx1) {
  2218. var $1;
  2219. $1=_st(self._value())._isImmutable();
  2220. return $1;
  2221. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},globals.ValueNode)})},
  2222. args: [],
  2223. source: "isImmutable\x0a\x09^ self value isImmutable",
  2224. messageSends: ["isImmutable", "value"],
  2225. referencedClasses: []
  2226. }),
  2227. globals.ValueNode);
  2228. smalltalk.addMethod(
  2229. smalltalk.method({
  2230. selector: "isValueNode",
  2231. protocol: 'testing',
  2232. fn: function (){
  2233. var self=this;
  2234. return true;
  2235. },
  2236. args: [],
  2237. source: "isValueNode\x0a\x09^ true",
  2238. messageSends: [],
  2239. referencedClasses: []
  2240. }),
  2241. globals.ValueNode);
  2242. smalltalk.addMethod(
  2243. smalltalk.method({
  2244. selector: "value",
  2245. protocol: 'accessing',
  2246. fn: function (){
  2247. var self=this;
  2248. var $1;
  2249. $1=self["@value"];
  2250. return $1;
  2251. },
  2252. args: [],
  2253. source: "value\x0a\x09^ value",
  2254. messageSends: [],
  2255. referencedClasses: []
  2256. }),
  2257. globals.ValueNode);
  2258. smalltalk.addMethod(
  2259. smalltalk.method({
  2260. selector: "value:",
  2261. protocol: 'accessing',
  2262. fn: function (anObject){
  2263. var self=this;
  2264. self["@value"]=anObject;
  2265. return self},
  2266. args: ["anObject"],
  2267. source: "value: anObject\x0a\x09value := anObject",
  2268. messageSends: [],
  2269. referencedClasses: []
  2270. }),
  2271. globals.ValueNode);
  2272. smalltalk.addClass('VariableNode', globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  2273. globals.VariableNode.comment="I represent an variable node.";
  2274. smalltalk.addMethod(
  2275. smalltalk.method({
  2276. selector: "accept:",
  2277. protocol: 'visiting',
  2278. fn: function (aVisitor){
  2279. var self=this;
  2280. return smalltalk.withContext(function($ctx1) {
  2281. var $1;
  2282. $1=_st(aVisitor)._visitVariableNode_(self);
  2283. return $1;
  2284. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.VariableNode)})},
  2285. args: ["aVisitor"],
  2286. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  2287. messageSends: ["visitVariableNode:"],
  2288. referencedClasses: []
  2289. }),
  2290. globals.VariableNode);
  2291. smalltalk.addMethod(
  2292. smalltalk.method({
  2293. selector: "alias",
  2294. protocol: 'accessing',
  2295. fn: function (){
  2296. var self=this;
  2297. return smalltalk.withContext(function($ctx1) {
  2298. var $1;
  2299. $1=_st(self._binding())._alias();
  2300. return $1;
  2301. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.VariableNode)})},
  2302. args: [],
  2303. source: "alias\x0a\x09^ self binding alias",
  2304. messageSends: ["alias", "binding"],
  2305. referencedClasses: []
  2306. }),
  2307. globals.VariableNode);
  2308. smalltalk.addMethod(
  2309. smalltalk.method({
  2310. selector: "assigned",
  2311. protocol: 'accessing',
  2312. fn: function (){
  2313. var self=this;
  2314. return smalltalk.withContext(function($ctx1) {
  2315. var $2,$1,$receiver;
  2316. $2=self["@assigned"];
  2317. if(($receiver = $2) == null || $receiver.isNil){
  2318. $1=false;
  2319. } else {
  2320. $1=$2;
  2321. };
  2322. return $1;
  2323. }, function($ctx1) {$ctx1.fill(self,"assigned",{},globals.VariableNode)})},
  2324. args: [],
  2325. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  2326. messageSends: ["ifNil:"],
  2327. referencedClasses: []
  2328. }),
  2329. globals.VariableNode);
  2330. smalltalk.addMethod(
  2331. smalltalk.method({
  2332. selector: "assigned:",
  2333. protocol: 'accessing',
  2334. fn: function (aBoolean){
  2335. var self=this;
  2336. self["@assigned"]=aBoolean;
  2337. return self},
  2338. args: ["aBoolean"],
  2339. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  2340. messageSends: [],
  2341. referencedClasses: []
  2342. }),
  2343. globals.VariableNode);
  2344. smalltalk.addMethod(
  2345. smalltalk.method({
  2346. selector: "beAssigned",
  2347. protocol: 'accessing',
  2348. fn: function (){
  2349. var self=this;
  2350. return smalltalk.withContext(function($ctx1) {
  2351. _st(self._binding())._validateAssignment();
  2352. self["@assigned"]=true;
  2353. return self}, function($ctx1) {$ctx1.fill(self,"beAssigned",{},globals.VariableNode)})},
  2354. args: [],
  2355. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  2356. messageSends: ["validateAssignment", "binding"],
  2357. referencedClasses: []
  2358. }),
  2359. globals.VariableNode);
  2360. smalltalk.addMethod(
  2361. smalltalk.method({
  2362. selector: "binding",
  2363. protocol: 'accessing',
  2364. fn: function (){
  2365. var self=this;
  2366. var $1;
  2367. $1=self["@binding"];
  2368. return $1;
  2369. },
  2370. args: [],
  2371. source: "binding\x0a\x09^ binding",
  2372. messageSends: [],
  2373. referencedClasses: []
  2374. }),
  2375. globals.VariableNode);
  2376. smalltalk.addMethod(
  2377. smalltalk.method({
  2378. selector: "binding:",
  2379. protocol: 'accessing',
  2380. fn: function (aScopeVar){
  2381. var self=this;
  2382. self["@binding"]=aScopeVar;
  2383. return self},
  2384. args: ["aScopeVar"],
  2385. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  2386. messageSends: [],
  2387. referencedClasses: []
  2388. }),
  2389. globals.VariableNode);
  2390. smalltalk.addMethod(
  2391. smalltalk.method({
  2392. selector: "isArgument",
  2393. protocol: 'testing',
  2394. fn: function (){
  2395. var self=this;
  2396. return smalltalk.withContext(function($ctx1) {
  2397. var $1;
  2398. $1=_st(self._binding())._isArgVar();
  2399. return $1;
  2400. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},globals.VariableNode)})},
  2401. args: [],
  2402. source: "isArgument\x0a\x09^ self binding isArgVar",
  2403. messageSends: ["isArgVar", "binding"],
  2404. referencedClasses: []
  2405. }),
  2406. globals.VariableNode);
  2407. smalltalk.addMethod(
  2408. smalltalk.method({
  2409. selector: "isImmutable",
  2410. protocol: 'testing',
  2411. fn: function (){
  2412. var self=this;
  2413. return smalltalk.withContext(function($ctx1) {
  2414. var $1;
  2415. $1=_st(self._binding())._isImmutable();
  2416. return $1;
  2417. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},globals.VariableNode)})},
  2418. args: [],
  2419. source: "isImmutable\x0a\x09^ self binding isImmutable",
  2420. messageSends: ["isImmutable", "binding"],
  2421. referencedClasses: []
  2422. }),
  2423. globals.VariableNode);
  2424. smalltalk.addMethod(
  2425. smalltalk.method({
  2426. selector: "isNavigationNode",
  2427. protocol: 'testing',
  2428. fn: function (){
  2429. var self=this;
  2430. return true;
  2431. },
  2432. args: [],
  2433. source: "isNavigationNode\x0a\x09^ true",
  2434. messageSends: [],
  2435. referencedClasses: []
  2436. }),
  2437. globals.VariableNode);
  2438. smalltalk.addMethod(
  2439. smalltalk.method({
  2440. selector: "isVariableNode",
  2441. protocol: 'testing',
  2442. fn: function (){
  2443. var self=this;
  2444. return true;
  2445. },
  2446. args: [],
  2447. source: "isVariableNode\x0a\x09^ true",
  2448. messageSends: [],
  2449. referencedClasses: []
  2450. }),
  2451. globals.VariableNode);
  2452. smalltalk.addMethod(
  2453. smalltalk.method({
  2454. selector: "navigationLink",
  2455. protocol: 'accessing',
  2456. fn: function (){
  2457. var self=this;
  2458. return smalltalk.withContext(function($ctx1) {
  2459. var $1;
  2460. $1=self._value();
  2461. return $1;
  2462. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},globals.VariableNode)})},
  2463. args: [],
  2464. source: "navigationLink\x0a\x09^ self value",
  2465. messageSends: ["value"],
  2466. referencedClasses: []
  2467. }),
  2468. globals.VariableNode);
  2469. smalltalk.addMethod(
  2470. smalltalk.method({
  2471. selector: "ast",
  2472. protocol: '*Compiler-AST',
  2473. fn: function (){
  2474. var self=this;
  2475. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2476. return smalltalk.withContext(function($ctx1) {
  2477. var $1,$2;
  2478. $1=self._source();
  2479. $ctx1.sendIdx["source"]=1;
  2480. _st($1)._ifEmpty_((function(){
  2481. return smalltalk.withContext(function($ctx2) {
  2482. return self._error_("Method source is empty");
  2483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2484. $2=_st($Smalltalk())._parse_(self._source());
  2485. return $2;
  2486. }, function($ctx1) {$ctx1.fill(self,"ast",{},globals.CompiledMethod)})},
  2487. args: [],
  2488. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  2489. messageSends: ["ifEmpty:", "source", "error:", "parse:"],
  2490. referencedClasses: ["Smalltalk"]
  2491. }),
  2492. globals.CompiledMethod);
  2493. smalltalk.addMethod(
  2494. smalltalk.method({
  2495. selector: "isNode",
  2496. protocol: '*Compiler-AST',
  2497. fn: function (){
  2498. var self=this;
  2499. return false;
  2500. },
  2501. args: [],
  2502. source: "isNode\x0a\x09^ false",
  2503. messageSends: [],
  2504. referencedClasses: []
  2505. }),
  2506. globals.Object);
  2507. });