Compiler-AST.js 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639
  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;
  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;
  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;
  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;
  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;
  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;
  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;
  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;
  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;
  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: "source",
  1455. protocol: 'accessing',
  1456. fn: function (){
  1457. var self=this;
  1458. var $1;
  1459. $1=self["@source"];
  1460. return $1;
  1461. },
  1462. args: [],
  1463. source: "source\x0a\x09^ source",
  1464. messageSends: [],
  1465. referencedClasses: []
  1466. }),
  1467. globals.MethodNode);
  1468. smalltalk.addMethod(
  1469. smalltalk.method({
  1470. selector: "source:",
  1471. protocol: 'accessing',
  1472. fn: function (aString){
  1473. var self=this;
  1474. self["@source"]=aString;
  1475. return self},
  1476. args: ["aString"],
  1477. source: "source: aString\x0a\x09source := aString",
  1478. messageSends: [],
  1479. referencedClasses: []
  1480. }),
  1481. globals.MethodNode);
  1482. smalltalk.addMethod(
  1483. smalltalk.method({
  1484. selector: "superSends",
  1485. protocol: 'accessing',
  1486. fn: function (){
  1487. var self=this;
  1488. var $1;
  1489. $1=self["@superSends"];
  1490. return $1;
  1491. },
  1492. args: [],
  1493. source: "superSends\x0a\x09^ superSends",
  1494. messageSends: [],
  1495. referencedClasses: []
  1496. }),
  1497. globals.MethodNode);
  1498. smalltalk.addMethod(
  1499. smalltalk.method({
  1500. selector: "superSends:",
  1501. protocol: 'accessing',
  1502. fn: function (aCollection){
  1503. var self=this;
  1504. self["@superSends"]=aCollection;
  1505. return self},
  1506. args: ["aCollection"],
  1507. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  1508. messageSends: [],
  1509. referencedClasses: []
  1510. }),
  1511. globals.MethodNode);
  1512. smalltalk.addClass('ReturnNode', globals.Node, ['scope'], 'Compiler-AST');
  1513. globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  1514. smalltalk.addMethod(
  1515. smalltalk.method({
  1516. selector: "accept:",
  1517. protocol: 'visiting',
  1518. fn: function (aVisitor){
  1519. var self=this;
  1520. return smalltalk.withContext(function($ctx1) {
  1521. var $1;
  1522. $1=_st(aVisitor)._visitReturnNode_(self);
  1523. return $1;
  1524. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.ReturnNode)})},
  1525. args: ["aVisitor"],
  1526. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  1527. messageSends: ["visitReturnNode:"],
  1528. referencedClasses: []
  1529. }),
  1530. globals.ReturnNode);
  1531. smalltalk.addMethod(
  1532. smalltalk.method({
  1533. selector: "isReturnNode",
  1534. protocol: 'testing',
  1535. fn: function (){
  1536. var self=this;
  1537. return true;
  1538. },
  1539. args: [],
  1540. source: "isReturnNode\x0a\x09^ true",
  1541. messageSends: [],
  1542. referencedClasses: []
  1543. }),
  1544. globals.ReturnNode);
  1545. smalltalk.addMethod(
  1546. smalltalk.method({
  1547. selector: "nonLocalReturn",
  1548. protocol: 'testing',
  1549. fn: function (){
  1550. var self=this;
  1551. return smalltalk.withContext(function($ctx1) {
  1552. var $1;
  1553. $1=_st(_st(self._scope())._isMethodScope())._not();
  1554. return $1;
  1555. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},globals.ReturnNode)})},
  1556. args: [],
  1557. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  1558. messageSends: ["not", "isMethodScope", "scope"],
  1559. referencedClasses: []
  1560. }),
  1561. globals.ReturnNode);
  1562. smalltalk.addMethod(
  1563. smalltalk.method({
  1564. selector: "scope",
  1565. protocol: 'accessing',
  1566. fn: function (){
  1567. var self=this;
  1568. var $1;
  1569. $1=self["@scope"];
  1570. return $1;
  1571. },
  1572. args: [],
  1573. source: "scope\x0a\x09^ scope",
  1574. messageSends: [],
  1575. referencedClasses: []
  1576. }),
  1577. globals.ReturnNode);
  1578. smalltalk.addMethod(
  1579. smalltalk.method({
  1580. selector: "scope:",
  1581. protocol: 'accessing',
  1582. fn: function (aLexicalScope){
  1583. var self=this;
  1584. self["@scope"]=aLexicalScope;
  1585. return self},
  1586. args: ["aLexicalScope"],
  1587. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  1588. messageSends: [],
  1589. referencedClasses: []
  1590. }),
  1591. globals.ReturnNode);
  1592. smalltalk.addClass('SendNode', globals.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
  1593. globals.SendNode.comment="I represent an message send node.";
  1594. smalltalk.addMethod(
  1595. smalltalk.method({
  1596. selector: "accept:",
  1597. protocol: 'visiting',
  1598. fn: function (aVisitor){
  1599. var self=this;
  1600. return smalltalk.withContext(function($ctx1) {
  1601. var $1;
  1602. $1=_st(aVisitor)._visitSendNode_(self);
  1603. return $1;
  1604. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.SendNode)})},
  1605. args: ["aVisitor"],
  1606. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  1607. messageSends: ["visitSendNode:"],
  1608. referencedClasses: []
  1609. }),
  1610. globals.SendNode);
  1611. smalltalk.addMethod(
  1612. smalltalk.method({
  1613. selector: "arguments",
  1614. protocol: 'accessing',
  1615. fn: function (){
  1616. var self=this;
  1617. return smalltalk.withContext(function($ctx1) {
  1618. var $2,$1;
  1619. $2=self["@arguments"];
  1620. if(($receiver = $2) == nil || $receiver == null){
  1621. self["@arguments"]=[];
  1622. $1=self["@arguments"];
  1623. } else {
  1624. $1=$2;
  1625. };
  1626. return $1;
  1627. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.SendNode)})},
  1628. args: [],
  1629. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  1630. messageSends: ["ifNil:"],
  1631. referencedClasses: []
  1632. }),
  1633. globals.SendNode);
  1634. smalltalk.addMethod(
  1635. smalltalk.method({
  1636. selector: "arguments:",
  1637. protocol: 'accessing',
  1638. fn: function (aCollection){
  1639. var self=this;
  1640. return smalltalk.withContext(function($ctx1) {
  1641. self["@arguments"]=aCollection;
  1642. _st(aCollection)._do_((function(each){
  1643. return smalltalk.withContext(function($ctx2) {
  1644. return _st(each)._parent_(self);
  1645. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1646. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},globals.SendNode)})},
  1647. args: ["aCollection"],
  1648. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  1649. messageSends: ["do:", "parent:"],
  1650. referencedClasses: []
  1651. }),
  1652. globals.SendNode);
  1653. smalltalk.addMethod(
  1654. smalltalk.method({
  1655. selector: "cascadeNodeWithMessages:",
  1656. protocol: 'accessing',
  1657. fn: function (aCollection){
  1658. var self=this;
  1659. var first;
  1660. function $SendNode(){return globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  1661. function $CascadeNode(){return globals.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
  1662. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  1663. return smalltalk.withContext(function($ctx1) {
  1664. var $1,$2,$4,$5,$3;
  1665. $1=_st($SendNode())._new();
  1666. $ctx1.sendIdx["new"]=1;
  1667. _st($1)._selector_(self._selector());
  1668. _st($1)._arguments_(self._arguments());
  1669. $2=_st($1)._yourself();
  1670. $ctx1.sendIdx["yourself"]=1;
  1671. first=$2;
  1672. $4=_st($CascadeNode())._new();
  1673. _st($4)._receiver_(self._receiver());
  1674. _st($4)._nodes_(_st(_st($Array())._with_(first)).__comma(aCollection));
  1675. $5=_st($4)._yourself();
  1676. $3=$5;
  1677. return $3;
  1678. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},globals.SendNode)})},
  1679. args: ["aCollection"],
  1680. 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",
  1681. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"],
  1682. referencedClasses: ["SendNode", "CascadeNode", "Array"]
  1683. }),
  1684. globals.SendNode);
  1685. smalltalk.addMethod(
  1686. smalltalk.method({
  1687. selector: "index",
  1688. protocol: 'accessing',
  1689. fn: function (){
  1690. var self=this;
  1691. var $1;
  1692. $1=self["@index"];
  1693. return $1;
  1694. },
  1695. args: [],
  1696. source: "index\x0a\x09^ index",
  1697. messageSends: [],
  1698. referencedClasses: []
  1699. }),
  1700. globals.SendNode);
  1701. smalltalk.addMethod(
  1702. smalltalk.method({
  1703. selector: "index:",
  1704. protocol: 'accessing',
  1705. fn: function (anInteger){
  1706. var self=this;
  1707. self["@index"]=anInteger;
  1708. return self},
  1709. args: ["anInteger"],
  1710. source: "index: anInteger\x0a\x09index := anInteger",
  1711. messageSends: [],
  1712. referencedClasses: []
  1713. }),
  1714. globals.SendNode);
  1715. smalltalk.addMethod(
  1716. smalltalk.method({
  1717. selector: "isCascadeSendNode",
  1718. protocol: 'testing',
  1719. fn: function (){
  1720. var self=this;
  1721. return smalltalk.withContext(function($ctx1) {
  1722. var $1;
  1723. $1=_st(self._parent())._isCascadeNode();
  1724. return $1;
  1725. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},globals.SendNode)})},
  1726. args: [],
  1727. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  1728. messageSends: ["isCascadeNode", "parent"],
  1729. referencedClasses: []
  1730. }),
  1731. globals.SendNode);
  1732. smalltalk.addMethod(
  1733. smalltalk.method({
  1734. selector: "isNavigationNode",
  1735. protocol: 'testing',
  1736. fn: function (){
  1737. var self=this;
  1738. return true;
  1739. },
  1740. args: [],
  1741. source: "isNavigationNode\x0a\x09^ true",
  1742. messageSends: [],
  1743. referencedClasses: []
  1744. }),
  1745. globals.SendNode);
  1746. smalltalk.addMethod(
  1747. smalltalk.method({
  1748. selector: "isSendNode",
  1749. protocol: 'testing',
  1750. fn: function (){
  1751. var self=this;
  1752. return true;
  1753. },
  1754. args: [],
  1755. source: "isSendNode\x0a\x09^ true",
  1756. messageSends: [],
  1757. referencedClasses: []
  1758. }),
  1759. globals.SendNode);
  1760. smalltalk.addMethod(
  1761. smalltalk.method({
  1762. selector: "navigationLink",
  1763. protocol: 'accessing',
  1764. fn: function (){
  1765. var self=this;
  1766. return smalltalk.withContext(function($ctx1) {
  1767. var $1;
  1768. $1=self._selector();
  1769. return $1;
  1770. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},globals.SendNode)})},
  1771. args: [],
  1772. source: "navigationLink\x0a\x09^ self selector",
  1773. messageSends: ["selector"],
  1774. referencedClasses: []
  1775. }),
  1776. globals.SendNode);
  1777. smalltalk.addMethod(
  1778. smalltalk.method({
  1779. selector: "nodes",
  1780. protocol: 'accessing',
  1781. fn: function (){
  1782. var self=this;
  1783. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  1784. return smalltalk.withContext(function($ctx1) {
  1785. var $1,$3,$2,$5,$6,$4;
  1786. $1=self._receiver();
  1787. $ctx1.sendIdx["receiver"]=1;
  1788. if(($receiver = $1) == nil || $receiver == null){
  1789. $3=self._arguments();
  1790. $ctx1.sendIdx["arguments"]=1;
  1791. $2=_st($3)._copy();
  1792. return $2;
  1793. } else {
  1794. $1;
  1795. };
  1796. $5=_st($Array())._with_(self._receiver());
  1797. _st($5)._addAll_(self._arguments());
  1798. $6=_st($5)._yourself();
  1799. $4=$6;
  1800. return $4;
  1801. }, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.SendNode)})},
  1802. args: [],
  1803. 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",
  1804. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"],
  1805. referencedClasses: ["Array"]
  1806. }),
  1807. globals.SendNode);
  1808. smalltalk.addMethod(
  1809. smalltalk.method({
  1810. selector: "receiver",
  1811. protocol: 'accessing',
  1812. fn: function (){
  1813. var self=this;
  1814. var $1;
  1815. $1=self["@receiver"];
  1816. return $1;
  1817. },
  1818. args: [],
  1819. source: "receiver\x0a\x09^ receiver",
  1820. messageSends: [],
  1821. referencedClasses: []
  1822. }),
  1823. globals.SendNode);
  1824. smalltalk.addMethod(
  1825. smalltalk.method({
  1826. selector: "receiver:",
  1827. protocol: 'accessing',
  1828. fn: function (aNode){
  1829. var self=this;
  1830. return smalltalk.withContext(function($ctx1) {
  1831. var $1;
  1832. self["@receiver"]=aNode;
  1833. $1=_st(aNode)._isNode();
  1834. if(smalltalk.assert($1)){
  1835. _st(aNode)._parent_(self);
  1836. };
  1837. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},globals.SendNode)})},
  1838. args: ["aNode"],
  1839. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  1840. messageSends: ["ifTrue:", "isNode", "parent:"],
  1841. referencedClasses: []
  1842. }),
  1843. globals.SendNode);
  1844. smalltalk.addMethod(
  1845. smalltalk.method({
  1846. selector: "requiresSmalltalkContext",
  1847. protocol: 'testing',
  1848. fn: function (){
  1849. var self=this;
  1850. return true;
  1851. },
  1852. args: [],
  1853. source: "requiresSmalltalkContext\x0a\x09^ true",
  1854. messageSends: [],
  1855. referencedClasses: []
  1856. }),
  1857. globals.SendNode);
  1858. smalltalk.addMethod(
  1859. smalltalk.method({
  1860. selector: "selector",
  1861. protocol: 'accessing',
  1862. fn: function (){
  1863. var self=this;
  1864. var $1;
  1865. $1=self["@selector"];
  1866. return $1;
  1867. },
  1868. args: [],
  1869. source: "selector\x0a\x09^ selector",
  1870. messageSends: [],
  1871. referencedClasses: []
  1872. }),
  1873. globals.SendNode);
  1874. smalltalk.addMethod(
  1875. smalltalk.method({
  1876. selector: "selector:",
  1877. protocol: 'accessing',
  1878. fn: function (aString){
  1879. var self=this;
  1880. self["@selector"]=aString;
  1881. return self},
  1882. args: ["aString"],
  1883. source: "selector: aString\x0a\x09selector := aString",
  1884. messageSends: [],
  1885. referencedClasses: []
  1886. }),
  1887. globals.SendNode);
  1888. smalltalk.addMethod(
  1889. smalltalk.method({
  1890. selector: "shouldBeAliased",
  1891. protocol: 'testing',
  1892. fn: function (){
  1893. var self=this;
  1894. var sends;
  1895. return smalltalk.withContext(function($ctx1) {
  1896. var $1;
  1897. sends=_st(_st(_st(self._method())._sendIndexes())._at_(self._selector()))._size();
  1898. $1=_st(globals.SendNode.superclass.fn.prototype._shouldBeAliased.apply(_st(self), []))._or_((function(){
  1899. return smalltalk.withContext(function($ctx2) {
  1900. return _st(_st(_st(sends).__gt((1)))._and_((function(){
  1901. return smalltalk.withContext(function($ctx3) {
  1902. return _st(self._index()).__lt(sends);
  1903. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})})))._and_((function(){
  1904. return smalltalk.withContext(function($ctx3) {
  1905. return self._isReferenced();
  1906. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  1907. $ctx2.sendIdx["and:"]=1;
  1908. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1909. return $1;
  1910. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},globals.SendNode)})},
  1911. args: [],
  1912. 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 ] ]",
  1913. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", ">", "<", "index", "isReferenced"],
  1914. referencedClasses: []
  1915. }),
  1916. globals.SendNode);
  1917. smalltalk.addMethod(
  1918. smalltalk.method({
  1919. selector: "stopOnStepping",
  1920. protocol: 'testing',
  1921. fn: function (){
  1922. var self=this;
  1923. return true;
  1924. },
  1925. args: [],
  1926. source: "stopOnStepping\x0a\x09^ true",
  1927. messageSends: [],
  1928. referencedClasses: []
  1929. }),
  1930. globals.SendNode);
  1931. smalltalk.addMethod(
  1932. smalltalk.method({
  1933. selector: "superSend",
  1934. protocol: 'accessing',
  1935. fn: function (){
  1936. var self=this;
  1937. return smalltalk.withContext(function($ctx1) {
  1938. var $2,$1;
  1939. $2=self["@superSend"];
  1940. if(($receiver = $2) == nil || $receiver == null){
  1941. $1=false;
  1942. } else {
  1943. $1=$2;
  1944. };
  1945. return $1;
  1946. }, function($ctx1) {$ctx1.fill(self,"superSend",{},globals.SendNode)})},
  1947. args: [],
  1948. source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
  1949. messageSends: ["ifNil:"],
  1950. referencedClasses: []
  1951. }),
  1952. globals.SendNode);
  1953. smalltalk.addMethod(
  1954. smalltalk.method({
  1955. selector: "superSend:",
  1956. protocol: 'accessing',
  1957. fn: function (aBoolean){
  1958. var self=this;
  1959. self["@superSend"]=aBoolean;
  1960. return self},
  1961. args: ["aBoolean"],
  1962. source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
  1963. messageSends: [],
  1964. referencedClasses: []
  1965. }),
  1966. globals.SendNode);
  1967. smalltalk.addMethod(
  1968. smalltalk.method({
  1969. selector: "valueForReceiver:",
  1970. protocol: 'accessing',
  1971. fn: function (anObject){
  1972. var self=this;
  1973. function $SendNode(){return globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  1974. return smalltalk.withContext(function($ctx1) {
  1975. var $2,$3,$5,$4,$6,$1;
  1976. $2=_st($SendNode())._new();
  1977. _st($2)._position_(self._position());
  1978. _st($2)._source_(self._source());
  1979. $3=$2;
  1980. $5=self._receiver();
  1981. $ctx1.sendIdx["receiver"]=1;
  1982. if(($receiver = $5) == nil || $receiver == null){
  1983. $4=anObject;
  1984. } else {
  1985. $4=_st(self._receiver())._valueForReceiver_(anObject);
  1986. };
  1987. _st($3)._receiver_($4);
  1988. _st($2)._selector_(self._selector());
  1989. _st($2)._arguments_(self._arguments());
  1990. $6=_st($2)._yourself();
  1991. $1=$6;
  1992. return $1;
  1993. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},globals.SendNode)})},
  1994. args: ["anObject"],
  1995. 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",
  1996. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"],
  1997. referencedClasses: ["SendNode"]
  1998. }),
  1999. globals.SendNode);
  2000. smalltalk.addClass('SequenceNode', globals.Node, ['temps', 'scope'], 'Compiler-AST');
  2001. 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).";
  2002. smalltalk.addMethod(
  2003. smalltalk.method({
  2004. selector: "accept:",
  2005. protocol: 'visiting',
  2006. fn: function (aVisitor){
  2007. var self=this;
  2008. return smalltalk.withContext(function($ctx1) {
  2009. var $1;
  2010. $1=_st(aVisitor)._visitSequenceNode_(self);
  2011. return $1;
  2012. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.SequenceNode)})},
  2013. args: ["aVisitor"],
  2014. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  2015. messageSends: ["visitSequenceNode:"],
  2016. referencedClasses: []
  2017. }),
  2018. globals.SequenceNode);
  2019. smalltalk.addMethod(
  2020. smalltalk.method({
  2021. selector: "asBlockSequenceNode",
  2022. protocol: 'converting',
  2023. fn: function (){
  2024. var self=this;
  2025. function $BlockSequenceNode(){return globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
  2026. return smalltalk.withContext(function($ctx1) {
  2027. var $2,$3,$1;
  2028. $2=_st($BlockSequenceNode())._new();
  2029. _st($2)._position_(self._position());
  2030. _st($2)._source_(self._source());
  2031. _st($2)._nodes_(self._nodes());
  2032. _st($2)._temps_(self._temps());
  2033. $3=_st($2)._yourself();
  2034. $1=$3;
  2035. return $1;
  2036. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},globals.SequenceNode)})},
  2037. args: [],
  2038. 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",
  2039. messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"],
  2040. referencedClasses: ["BlockSequenceNode"]
  2041. }),
  2042. globals.SequenceNode);
  2043. smalltalk.addMethod(
  2044. smalltalk.method({
  2045. selector: "isSequenceNode",
  2046. protocol: 'testing',
  2047. fn: function (){
  2048. var self=this;
  2049. return true;
  2050. },
  2051. args: [],
  2052. source: "isSequenceNode\x0a\x09^ true",
  2053. messageSends: [],
  2054. referencedClasses: []
  2055. }),
  2056. globals.SequenceNode);
  2057. smalltalk.addMethod(
  2058. smalltalk.method({
  2059. selector: "scope",
  2060. protocol: 'accessing',
  2061. fn: function (){
  2062. var self=this;
  2063. var $1;
  2064. $1=self["@scope"];
  2065. return $1;
  2066. },
  2067. args: [],
  2068. source: "scope\x0a\x09^ scope",
  2069. messageSends: [],
  2070. referencedClasses: []
  2071. }),
  2072. globals.SequenceNode);
  2073. smalltalk.addMethod(
  2074. smalltalk.method({
  2075. selector: "scope:",
  2076. protocol: 'accessing',
  2077. fn: function (aLexicalScope){
  2078. var self=this;
  2079. self["@scope"]=aLexicalScope;
  2080. return self},
  2081. args: ["aLexicalScope"],
  2082. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  2083. messageSends: [],
  2084. referencedClasses: []
  2085. }),
  2086. globals.SequenceNode);
  2087. smalltalk.addMethod(
  2088. smalltalk.method({
  2089. selector: "temps",
  2090. protocol: 'accessing',
  2091. fn: function (){
  2092. var self=this;
  2093. return smalltalk.withContext(function($ctx1) {
  2094. var $2,$1;
  2095. $2=self["@temps"];
  2096. if(($receiver = $2) == nil || $receiver == null){
  2097. $1=[];
  2098. } else {
  2099. $1=$2;
  2100. };
  2101. return $1;
  2102. }, function($ctx1) {$ctx1.fill(self,"temps",{},globals.SequenceNode)})},
  2103. args: [],
  2104. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  2105. messageSends: ["ifNil:"],
  2106. referencedClasses: []
  2107. }),
  2108. globals.SequenceNode);
  2109. smalltalk.addMethod(
  2110. smalltalk.method({
  2111. selector: "temps:",
  2112. protocol: 'accessing',
  2113. fn: function (aCollection){
  2114. var self=this;
  2115. self["@temps"]=aCollection;
  2116. return self},
  2117. args: ["aCollection"],
  2118. source: "temps: aCollection\x0a\x09temps := aCollection",
  2119. messageSends: [],
  2120. referencedClasses: []
  2121. }),
  2122. globals.SequenceNode);
  2123. smalltalk.addClass('BlockSequenceNode', globals.SequenceNode, [], 'Compiler-AST');
  2124. globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  2125. smalltalk.addMethod(
  2126. smalltalk.method({
  2127. selector: "accept:",
  2128. protocol: 'visiting',
  2129. fn: function (aVisitor){
  2130. var self=this;
  2131. return smalltalk.withContext(function($ctx1) {
  2132. var $1;
  2133. $1=_st(aVisitor)._visitBlockSequenceNode_(self);
  2134. return $1;
  2135. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.BlockSequenceNode)})},
  2136. args: ["aVisitor"],
  2137. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  2138. messageSends: ["visitBlockSequenceNode:"],
  2139. referencedClasses: []
  2140. }),
  2141. globals.BlockSequenceNode);
  2142. smalltalk.addMethod(
  2143. smalltalk.method({
  2144. selector: "isBlockSequenceNode",
  2145. protocol: 'testing',
  2146. fn: function (){
  2147. var self=this;
  2148. return true;
  2149. },
  2150. args: [],
  2151. source: "isBlockSequenceNode\x0a\x09^ true",
  2152. messageSends: [],
  2153. referencedClasses: []
  2154. }),
  2155. globals.BlockSequenceNode);
  2156. smalltalk.addClass('ValueNode', globals.Node, ['value'], 'Compiler-AST');
  2157. globals.ValueNode.comment="I represent a value node.";
  2158. smalltalk.addMethod(
  2159. smalltalk.method({
  2160. selector: "accept:",
  2161. protocol: 'visiting',
  2162. fn: function (aVisitor){
  2163. var self=this;
  2164. return smalltalk.withContext(function($ctx1) {
  2165. var $1;
  2166. $1=_st(aVisitor)._visitValueNode_(self);
  2167. return $1;
  2168. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.ValueNode)})},
  2169. args: ["aVisitor"],
  2170. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  2171. messageSends: ["visitValueNode:"],
  2172. referencedClasses: []
  2173. }),
  2174. globals.ValueNode);
  2175. smalltalk.addMethod(
  2176. smalltalk.method({
  2177. selector: "isImmutable",
  2178. protocol: 'testing',
  2179. fn: function (){
  2180. var self=this;
  2181. return smalltalk.withContext(function($ctx1) {
  2182. var $1;
  2183. $1=_st(self._value())._isImmutable();
  2184. return $1;
  2185. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},globals.ValueNode)})},
  2186. args: [],
  2187. source: "isImmutable\x0a\x09^ self value isImmutable",
  2188. messageSends: ["isImmutable", "value"],
  2189. referencedClasses: []
  2190. }),
  2191. globals.ValueNode);
  2192. smalltalk.addMethod(
  2193. smalltalk.method({
  2194. selector: "isValueNode",
  2195. protocol: 'testing',
  2196. fn: function (){
  2197. var self=this;
  2198. return true;
  2199. },
  2200. args: [],
  2201. source: "isValueNode\x0a\x09^ true",
  2202. messageSends: [],
  2203. referencedClasses: []
  2204. }),
  2205. globals.ValueNode);
  2206. smalltalk.addMethod(
  2207. smalltalk.method({
  2208. selector: "value",
  2209. protocol: 'accessing',
  2210. fn: function (){
  2211. var self=this;
  2212. var $1;
  2213. $1=self["@value"];
  2214. return $1;
  2215. },
  2216. args: [],
  2217. source: "value\x0a\x09^ value",
  2218. messageSends: [],
  2219. referencedClasses: []
  2220. }),
  2221. globals.ValueNode);
  2222. smalltalk.addMethod(
  2223. smalltalk.method({
  2224. selector: "value:",
  2225. protocol: 'accessing',
  2226. fn: function (anObject){
  2227. var self=this;
  2228. self["@value"]=anObject;
  2229. return self},
  2230. args: ["anObject"],
  2231. source: "value: anObject\x0a\x09value := anObject",
  2232. messageSends: [],
  2233. referencedClasses: []
  2234. }),
  2235. globals.ValueNode);
  2236. smalltalk.addClass('VariableNode', globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  2237. globals.VariableNode.comment="I represent an variable node.";
  2238. smalltalk.addMethod(
  2239. smalltalk.method({
  2240. selector: "accept:",
  2241. protocol: 'visiting',
  2242. fn: function (aVisitor){
  2243. var self=this;
  2244. return smalltalk.withContext(function($ctx1) {
  2245. var $1;
  2246. $1=_st(aVisitor)._visitVariableNode_(self);
  2247. return $1;
  2248. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.VariableNode)})},
  2249. args: ["aVisitor"],
  2250. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  2251. messageSends: ["visitVariableNode:"],
  2252. referencedClasses: []
  2253. }),
  2254. globals.VariableNode);
  2255. smalltalk.addMethod(
  2256. smalltalk.method({
  2257. selector: "alias",
  2258. protocol: 'accessing',
  2259. fn: function (){
  2260. var self=this;
  2261. return smalltalk.withContext(function($ctx1) {
  2262. var $1;
  2263. $1=_st(self._binding())._alias();
  2264. return $1;
  2265. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.VariableNode)})},
  2266. args: [],
  2267. source: "alias\x0a\x09^ self binding alias",
  2268. messageSends: ["alias", "binding"],
  2269. referencedClasses: []
  2270. }),
  2271. globals.VariableNode);
  2272. smalltalk.addMethod(
  2273. smalltalk.method({
  2274. selector: "assigned",
  2275. protocol: 'accessing',
  2276. fn: function (){
  2277. var self=this;
  2278. return smalltalk.withContext(function($ctx1) {
  2279. var $2,$1;
  2280. $2=self["@assigned"];
  2281. if(($receiver = $2) == nil || $receiver == null){
  2282. $1=false;
  2283. } else {
  2284. $1=$2;
  2285. };
  2286. return $1;
  2287. }, function($ctx1) {$ctx1.fill(self,"assigned",{},globals.VariableNode)})},
  2288. args: [],
  2289. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  2290. messageSends: ["ifNil:"],
  2291. referencedClasses: []
  2292. }),
  2293. globals.VariableNode);
  2294. smalltalk.addMethod(
  2295. smalltalk.method({
  2296. selector: "assigned:",
  2297. protocol: 'accessing',
  2298. fn: function (aBoolean){
  2299. var self=this;
  2300. self["@assigned"]=aBoolean;
  2301. return self},
  2302. args: ["aBoolean"],
  2303. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  2304. messageSends: [],
  2305. referencedClasses: []
  2306. }),
  2307. globals.VariableNode);
  2308. smalltalk.addMethod(
  2309. smalltalk.method({
  2310. selector: "beAssigned",
  2311. protocol: 'accessing',
  2312. fn: function (){
  2313. var self=this;
  2314. return smalltalk.withContext(function($ctx1) {
  2315. _st(self._binding())._validateAssignment();
  2316. self["@assigned"]=true;
  2317. return self}, function($ctx1) {$ctx1.fill(self,"beAssigned",{},globals.VariableNode)})},
  2318. args: [],
  2319. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  2320. messageSends: ["validateAssignment", "binding"],
  2321. referencedClasses: []
  2322. }),
  2323. globals.VariableNode);
  2324. smalltalk.addMethod(
  2325. smalltalk.method({
  2326. selector: "binding",
  2327. protocol: 'accessing',
  2328. fn: function (){
  2329. var self=this;
  2330. var $1;
  2331. $1=self["@binding"];
  2332. return $1;
  2333. },
  2334. args: [],
  2335. source: "binding\x0a\x09^ binding",
  2336. messageSends: [],
  2337. referencedClasses: []
  2338. }),
  2339. globals.VariableNode);
  2340. smalltalk.addMethod(
  2341. smalltalk.method({
  2342. selector: "binding:",
  2343. protocol: 'accessing',
  2344. fn: function (aScopeVar){
  2345. var self=this;
  2346. self["@binding"]=aScopeVar;
  2347. return self},
  2348. args: ["aScopeVar"],
  2349. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  2350. messageSends: [],
  2351. referencedClasses: []
  2352. }),
  2353. globals.VariableNode);
  2354. smalltalk.addMethod(
  2355. smalltalk.method({
  2356. selector: "isArgument",
  2357. protocol: 'testing',
  2358. fn: function (){
  2359. var self=this;
  2360. return smalltalk.withContext(function($ctx1) {
  2361. var $1;
  2362. $1=_st(self._binding())._isArgVar();
  2363. return $1;
  2364. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},globals.VariableNode)})},
  2365. args: [],
  2366. source: "isArgument\x0a\x09^ self binding isArgVar",
  2367. messageSends: ["isArgVar", "binding"],
  2368. referencedClasses: []
  2369. }),
  2370. globals.VariableNode);
  2371. smalltalk.addMethod(
  2372. smalltalk.method({
  2373. selector: "isImmutable",
  2374. protocol: 'testing',
  2375. fn: function (){
  2376. var self=this;
  2377. return smalltalk.withContext(function($ctx1) {
  2378. var $1;
  2379. $1=_st(self._binding())._isImmutable();
  2380. return $1;
  2381. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},globals.VariableNode)})},
  2382. args: [],
  2383. source: "isImmutable\x0a\x09^ self binding isImmutable",
  2384. messageSends: ["isImmutable", "binding"],
  2385. referencedClasses: []
  2386. }),
  2387. globals.VariableNode);
  2388. smalltalk.addMethod(
  2389. smalltalk.method({
  2390. selector: "isNavigationNode",
  2391. protocol: 'testing',
  2392. fn: function (){
  2393. var self=this;
  2394. return true;
  2395. },
  2396. args: [],
  2397. source: "isNavigationNode\x0a\x09^ true",
  2398. messageSends: [],
  2399. referencedClasses: []
  2400. }),
  2401. globals.VariableNode);
  2402. smalltalk.addMethod(
  2403. smalltalk.method({
  2404. selector: "isVariableNode",
  2405. protocol: 'testing',
  2406. fn: function (){
  2407. var self=this;
  2408. return true;
  2409. },
  2410. args: [],
  2411. source: "isVariableNode\x0a\x09^ true",
  2412. messageSends: [],
  2413. referencedClasses: []
  2414. }),
  2415. globals.VariableNode);
  2416. smalltalk.addMethod(
  2417. smalltalk.method({
  2418. selector: "navigationLink",
  2419. protocol: 'accessing',
  2420. fn: function (){
  2421. var self=this;
  2422. return smalltalk.withContext(function($ctx1) {
  2423. var $1;
  2424. $1=self._value();
  2425. return $1;
  2426. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},globals.VariableNode)})},
  2427. args: [],
  2428. source: "navigationLink\x0a\x09^ self value",
  2429. messageSends: ["value"],
  2430. referencedClasses: []
  2431. }),
  2432. globals.VariableNode);
  2433. smalltalk.addMethod(
  2434. smalltalk.method({
  2435. selector: "ast",
  2436. protocol: '*Compiler-AST',
  2437. fn: function (){
  2438. var self=this;
  2439. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2440. return smalltalk.withContext(function($ctx1) {
  2441. var $1,$2;
  2442. $1=self._source();
  2443. $ctx1.sendIdx["source"]=1;
  2444. _st($1)._ifEmpty_((function(){
  2445. return smalltalk.withContext(function($ctx2) {
  2446. return self._error_("Method source is empty");
  2447. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2448. $2=_st($Smalltalk())._parse_(self._source());
  2449. return $2;
  2450. }, function($ctx1) {$ctx1.fill(self,"ast",{},globals.CompiledMethod)})},
  2451. args: [],
  2452. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  2453. messageSends: ["ifEmpty:", "source", "error:", "parse:"],
  2454. referencedClasses: ["Smalltalk"]
  2455. }),
  2456. globals.CompiledMethod);
  2457. smalltalk.addMethod(
  2458. smalltalk.method({
  2459. selector: "isNode",
  2460. protocol: '*Compiler-AST',
  2461. fn: function (){
  2462. var self=this;
  2463. return false;
  2464. },
  2465. args: [],
  2466. source: "isNode\x0a\x09^ false",
  2467. messageSends: [],
  2468. referencedClasses: []
  2469. }),
  2470. globals.Object);
  2471. });