Compiler-AST.js 62 KB

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