Compiler-AST.js 67 KB

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