Compiler-AST.js 66 KB

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