Compiler-AST.js 66 KB

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