2
0

Compiler-AST.js 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480
  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.addClass('MethodNode', globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes', 'superSends'], 'Compiler-AST');
  1135. globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  1136. smalltalk.addMethod(
  1137. smalltalk.method({
  1138. selector: "accept:",
  1139. protocol: 'visiting',
  1140. fn: function (aVisitor){
  1141. var self=this;
  1142. return smalltalk.withContext(function($ctx1) {
  1143. var $1;
  1144. $1=_st(aVisitor)._visitMethodNode_(self);
  1145. return $1;
  1146. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.MethodNode)})},
  1147. args: ["aVisitor"],
  1148. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  1149. messageSends: ["visitMethodNode:"],
  1150. referencedClasses: []
  1151. }),
  1152. globals.MethodNode);
  1153. smalltalk.addMethod(
  1154. smalltalk.method({
  1155. selector: "arguments",
  1156. protocol: 'accessing',
  1157. fn: function (){
  1158. var self=this;
  1159. return smalltalk.withContext(function($ctx1) {
  1160. var $2,$1;
  1161. $2=self["@arguments"];
  1162. if(($receiver = $2) == nil || $receiver == null){
  1163. $1=[];
  1164. } else {
  1165. $1=$2;
  1166. };
  1167. return $1;
  1168. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.MethodNode)})},
  1169. args: [],
  1170. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  1171. messageSends: ["ifNil:"],
  1172. referencedClasses: []
  1173. }),
  1174. globals.MethodNode);
  1175. smalltalk.addMethod(
  1176. smalltalk.method({
  1177. selector: "arguments:",
  1178. protocol: 'accessing',
  1179. fn: function (aCollection){
  1180. var self=this;
  1181. self["@arguments"]=aCollection;
  1182. return self},
  1183. args: ["aCollection"],
  1184. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  1185. messageSends: [],
  1186. referencedClasses: []
  1187. }),
  1188. globals.MethodNode);
  1189. smalltalk.addMethod(
  1190. smalltalk.method({
  1191. selector: "classReferences",
  1192. protocol: 'accessing',
  1193. fn: function (){
  1194. var self=this;
  1195. var $1;
  1196. $1=self["@classReferences"];
  1197. return $1;
  1198. },
  1199. args: [],
  1200. source: "classReferences\x0a\x09^ classReferences",
  1201. messageSends: [],
  1202. referencedClasses: []
  1203. }),
  1204. globals.MethodNode);
  1205. smalltalk.addMethod(
  1206. smalltalk.method({
  1207. selector: "classReferences:",
  1208. protocol: 'accessing',
  1209. fn: function (aCollection){
  1210. var self=this;
  1211. self["@classReferences"]=aCollection;
  1212. return self},
  1213. args: ["aCollection"],
  1214. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  1215. messageSends: [],
  1216. referencedClasses: []
  1217. }),
  1218. globals.MethodNode);
  1219. smalltalk.addMethod(
  1220. smalltalk.method({
  1221. selector: "extent",
  1222. protocol: 'accessing',
  1223. fn: function (){
  1224. var self=this;
  1225. return smalltalk.withContext(function($ctx1) {
  1226. var $4,$3,$2,$1;
  1227. $4=self._source();
  1228. $ctx1.sendIdx["source"]=1;
  1229. $3=_st($4)._lines();
  1230. $ctx1.sendIdx["lines"]=1;
  1231. $2=_st($3)._size();
  1232. $ctx1.sendIdx["size"]=1;
  1233. $1=_st($2).__at(_st(_st(_st(_st(self._source())._lines())._last())._size()).__plus((1)));
  1234. return $1;
  1235. }, function($ctx1) {$ctx1.fill(self,"extent",{},globals.MethodNode)})},
  1236. args: [],
  1237. source: "extent\x0a\x09^ self source lines size @ (self source lines last size + 1)",
  1238. messageSends: ["@", "size", "lines", "source", "+", "last"],
  1239. referencedClasses: []
  1240. }),
  1241. globals.MethodNode);
  1242. smalltalk.addMethod(
  1243. smalltalk.method({
  1244. selector: "messageSends",
  1245. protocol: 'accessing',
  1246. fn: function (){
  1247. var self=this;
  1248. return smalltalk.withContext(function($ctx1) {
  1249. var $1;
  1250. $1=_st(self._sendIndexes())._keys();
  1251. return $1;
  1252. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.MethodNode)})},
  1253. args: [],
  1254. source: "messageSends\x0a\x09^ self sendIndexes keys",
  1255. messageSends: ["keys", "sendIndexes"],
  1256. referencedClasses: []
  1257. }),
  1258. globals.MethodNode);
  1259. smalltalk.addMethod(
  1260. smalltalk.method({
  1261. selector: "method",
  1262. protocol: 'accessing',
  1263. fn: function (){
  1264. var self=this;
  1265. return self;
  1266. },
  1267. args: [],
  1268. source: "method\x0a\x09^ self",
  1269. messageSends: [],
  1270. referencedClasses: []
  1271. }),
  1272. globals.MethodNode);
  1273. smalltalk.addMethod(
  1274. smalltalk.method({
  1275. selector: "scope",
  1276. protocol: 'accessing',
  1277. fn: function (){
  1278. var self=this;
  1279. var $1;
  1280. $1=self["@scope"];
  1281. return $1;
  1282. },
  1283. args: [],
  1284. source: "scope\x0a\x09^ scope",
  1285. messageSends: [],
  1286. referencedClasses: []
  1287. }),
  1288. globals.MethodNode);
  1289. smalltalk.addMethod(
  1290. smalltalk.method({
  1291. selector: "scope:",
  1292. protocol: 'accessing',
  1293. fn: function (aMethodScope){
  1294. var self=this;
  1295. self["@scope"]=aMethodScope;
  1296. return self},
  1297. args: ["aMethodScope"],
  1298. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  1299. messageSends: [],
  1300. referencedClasses: []
  1301. }),
  1302. globals.MethodNode);
  1303. smalltalk.addMethod(
  1304. smalltalk.method({
  1305. selector: "selector",
  1306. protocol: 'accessing',
  1307. fn: function (){
  1308. var self=this;
  1309. var $1;
  1310. $1=self["@selector"];
  1311. return $1;
  1312. },
  1313. args: [],
  1314. source: "selector\x0a\x09^ selector",
  1315. messageSends: [],
  1316. referencedClasses: []
  1317. }),
  1318. globals.MethodNode);
  1319. smalltalk.addMethod(
  1320. smalltalk.method({
  1321. selector: "selector:",
  1322. protocol: 'accessing',
  1323. fn: function (aString){
  1324. var self=this;
  1325. self["@selector"]=aString;
  1326. return self},
  1327. args: ["aString"],
  1328. source: "selector: aString\x0a\x09selector := aString",
  1329. messageSends: [],
  1330. referencedClasses: []
  1331. }),
  1332. globals.MethodNode);
  1333. smalltalk.addMethod(
  1334. smalltalk.method({
  1335. selector: "sendIndexes",
  1336. protocol: 'accessing',
  1337. fn: function (){
  1338. var self=this;
  1339. var $1;
  1340. $1=self["@sendIndexes"];
  1341. return $1;
  1342. },
  1343. args: [],
  1344. source: "sendIndexes\x0a\x09^ sendIndexes",
  1345. messageSends: [],
  1346. referencedClasses: []
  1347. }),
  1348. globals.MethodNode);
  1349. smalltalk.addMethod(
  1350. smalltalk.method({
  1351. selector: "sendIndexes:",
  1352. protocol: 'accessing',
  1353. fn: function (aDictionary){
  1354. var self=this;
  1355. self["@sendIndexes"]=aDictionary;
  1356. return self},
  1357. args: ["aDictionary"],
  1358. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  1359. messageSends: [],
  1360. referencedClasses: []
  1361. }),
  1362. globals.MethodNode);
  1363. smalltalk.addMethod(
  1364. smalltalk.method({
  1365. selector: "source",
  1366. protocol: 'accessing',
  1367. fn: function (){
  1368. var self=this;
  1369. var $1;
  1370. $1=self["@source"];
  1371. return $1;
  1372. },
  1373. args: [],
  1374. source: "source\x0a\x09^ source",
  1375. messageSends: [],
  1376. referencedClasses: []
  1377. }),
  1378. globals.MethodNode);
  1379. smalltalk.addMethod(
  1380. smalltalk.method({
  1381. selector: "source:",
  1382. protocol: 'accessing',
  1383. fn: function (aString){
  1384. var self=this;
  1385. self["@source"]=aString;
  1386. return self},
  1387. args: ["aString"],
  1388. source: "source: aString\x0a\x09source := aString",
  1389. messageSends: [],
  1390. referencedClasses: []
  1391. }),
  1392. globals.MethodNode);
  1393. smalltalk.addMethod(
  1394. smalltalk.method({
  1395. selector: "superSends",
  1396. protocol: 'accessing',
  1397. fn: function (){
  1398. var self=this;
  1399. var $1;
  1400. $1=self["@superSends"];
  1401. return $1;
  1402. },
  1403. args: [],
  1404. source: "superSends\x0a\x09^ superSends",
  1405. messageSends: [],
  1406. referencedClasses: []
  1407. }),
  1408. globals.MethodNode);
  1409. smalltalk.addMethod(
  1410. smalltalk.method({
  1411. selector: "superSends:",
  1412. protocol: 'accessing',
  1413. fn: function (aCollection){
  1414. var self=this;
  1415. self["@superSends"]=aCollection;
  1416. return self},
  1417. args: ["aCollection"],
  1418. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  1419. messageSends: [],
  1420. referencedClasses: []
  1421. }),
  1422. globals.MethodNode);
  1423. smalltalk.addClass('ReturnNode', globals.Node, ['scope'], 'Compiler-AST');
  1424. globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  1425. smalltalk.addMethod(
  1426. smalltalk.method({
  1427. selector: "accept:",
  1428. protocol: 'visiting',
  1429. fn: function (aVisitor){
  1430. var self=this;
  1431. return smalltalk.withContext(function($ctx1) {
  1432. var $1;
  1433. $1=_st(aVisitor)._visitReturnNode_(self);
  1434. return $1;
  1435. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.ReturnNode)})},
  1436. args: ["aVisitor"],
  1437. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  1438. messageSends: ["visitReturnNode:"],
  1439. referencedClasses: []
  1440. }),
  1441. globals.ReturnNode);
  1442. smalltalk.addMethod(
  1443. smalltalk.method({
  1444. selector: "isReturnNode",
  1445. protocol: 'testing',
  1446. fn: function (){
  1447. var self=this;
  1448. return true;
  1449. },
  1450. args: [],
  1451. source: "isReturnNode\x0a\x09^ true",
  1452. messageSends: [],
  1453. referencedClasses: []
  1454. }),
  1455. globals.ReturnNode);
  1456. smalltalk.addMethod(
  1457. smalltalk.method({
  1458. selector: "nonLocalReturn",
  1459. protocol: 'testing',
  1460. fn: function (){
  1461. var self=this;
  1462. return smalltalk.withContext(function($ctx1) {
  1463. var $1;
  1464. $1=_st(_st(self._scope())._isMethodScope())._not();
  1465. return $1;
  1466. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},globals.ReturnNode)})},
  1467. args: [],
  1468. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  1469. messageSends: ["not", "isMethodScope", "scope"],
  1470. referencedClasses: []
  1471. }),
  1472. globals.ReturnNode);
  1473. smalltalk.addMethod(
  1474. smalltalk.method({
  1475. selector: "scope",
  1476. protocol: 'accessing',
  1477. fn: function (){
  1478. var self=this;
  1479. var $1;
  1480. $1=self["@scope"];
  1481. return $1;
  1482. },
  1483. args: [],
  1484. source: "scope\x0a\x09^ scope",
  1485. messageSends: [],
  1486. referencedClasses: []
  1487. }),
  1488. globals.ReturnNode);
  1489. smalltalk.addMethod(
  1490. smalltalk.method({
  1491. selector: "scope:",
  1492. protocol: 'accessing',
  1493. fn: function (aLexicalScope){
  1494. var self=this;
  1495. self["@scope"]=aLexicalScope;
  1496. return self},
  1497. args: ["aLexicalScope"],
  1498. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  1499. messageSends: [],
  1500. referencedClasses: []
  1501. }),
  1502. globals.ReturnNode);
  1503. smalltalk.addClass('SendNode', globals.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
  1504. globals.SendNode.comment="I represent an message send node.";
  1505. smalltalk.addMethod(
  1506. smalltalk.method({
  1507. selector: "accept:",
  1508. protocol: 'visiting',
  1509. fn: function (aVisitor){
  1510. var self=this;
  1511. return smalltalk.withContext(function($ctx1) {
  1512. var $1;
  1513. $1=_st(aVisitor)._visitSendNode_(self);
  1514. return $1;
  1515. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.SendNode)})},
  1516. args: ["aVisitor"],
  1517. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  1518. messageSends: ["visitSendNode:"],
  1519. referencedClasses: []
  1520. }),
  1521. globals.SendNode);
  1522. smalltalk.addMethod(
  1523. smalltalk.method({
  1524. selector: "arguments",
  1525. protocol: 'accessing',
  1526. fn: function (){
  1527. var self=this;
  1528. return smalltalk.withContext(function($ctx1) {
  1529. var $2,$1;
  1530. $2=self["@arguments"];
  1531. if(($receiver = $2) == nil || $receiver == null){
  1532. self["@arguments"]=[];
  1533. $1=self["@arguments"];
  1534. } else {
  1535. $1=$2;
  1536. };
  1537. return $1;
  1538. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.SendNode)})},
  1539. args: [],
  1540. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  1541. messageSends: ["ifNil:"],
  1542. referencedClasses: []
  1543. }),
  1544. globals.SendNode);
  1545. smalltalk.addMethod(
  1546. smalltalk.method({
  1547. selector: "arguments:",
  1548. protocol: 'accessing',
  1549. fn: function (aCollection){
  1550. var self=this;
  1551. return smalltalk.withContext(function($ctx1) {
  1552. self["@arguments"]=aCollection;
  1553. _st(aCollection)._do_((function(each){
  1554. return smalltalk.withContext(function($ctx2) {
  1555. return _st(each)._parent_(self);
  1556. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1557. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},globals.SendNode)})},
  1558. args: ["aCollection"],
  1559. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  1560. messageSends: ["do:", "parent:"],
  1561. referencedClasses: []
  1562. }),
  1563. globals.SendNode);
  1564. smalltalk.addMethod(
  1565. smalltalk.method({
  1566. selector: "cascadeNodeWithMessages:",
  1567. protocol: 'accessing',
  1568. fn: function (aCollection){
  1569. var self=this;
  1570. var first;
  1571. function $SendNode(){return globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  1572. function $CascadeNode(){return globals.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
  1573. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  1574. return smalltalk.withContext(function($ctx1) {
  1575. var $1,$2,$4,$5,$3;
  1576. $1=_st($SendNode())._new();
  1577. $ctx1.sendIdx["new"]=1;
  1578. _st($1)._selector_(self._selector());
  1579. _st($1)._arguments_(self._arguments());
  1580. $2=_st($1)._yourself();
  1581. $ctx1.sendIdx["yourself"]=1;
  1582. first=$2;
  1583. $4=_st($CascadeNode())._new();
  1584. _st($4)._receiver_(self._receiver());
  1585. _st($4)._nodes_(_st(_st($Array())._with_(first)).__comma(aCollection));
  1586. $5=_st($4)._yourself();
  1587. $3=$5;
  1588. return $3;
  1589. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},globals.SendNode)})},
  1590. args: ["aCollection"],
  1591. 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",
  1592. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"],
  1593. referencedClasses: ["SendNode", "CascadeNode", "Array"]
  1594. }),
  1595. globals.SendNode);
  1596. smalltalk.addMethod(
  1597. smalltalk.method({
  1598. selector: "index",
  1599. protocol: 'accessing',
  1600. fn: function (){
  1601. var self=this;
  1602. var $1;
  1603. $1=self["@index"];
  1604. return $1;
  1605. },
  1606. args: [],
  1607. source: "index\x0a\x09^ index",
  1608. messageSends: [],
  1609. referencedClasses: []
  1610. }),
  1611. globals.SendNode);
  1612. smalltalk.addMethod(
  1613. smalltalk.method({
  1614. selector: "index:",
  1615. protocol: 'accessing',
  1616. fn: function (anInteger){
  1617. var self=this;
  1618. self["@index"]=anInteger;
  1619. return self},
  1620. args: ["anInteger"],
  1621. source: "index: anInteger\x0a\x09index := anInteger",
  1622. messageSends: [],
  1623. referencedClasses: []
  1624. }),
  1625. globals.SendNode);
  1626. smalltalk.addMethod(
  1627. smalltalk.method({
  1628. selector: "isCascadeSendNode",
  1629. protocol: 'testing',
  1630. fn: function (){
  1631. var self=this;
  1632. return smalltalk.withContext(function($ctx1) {
  1633. var $1;
  1634. $1=_st(self._parent())._isCascadeNode();
  1635. return $1;
  1636. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},globals.SendNode)})},
  1637. args: [],
  1638. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  1639. messageSends: ["isCascadeNode", "parent"],
  1640. referencedClasses: []
  1641. }),
  1642. globals.SendNode);
  1643. smalltalk.addMethod(
  1644. smalltalk.method({
  1645. selector: "isSendNode",
  1646. protocol: 'testing',
  1647. fn: function (){
  1648. var self=this;
  1649. return true;
  1650. },
  1651. args: [],
  1652. source: "isSendNode\x0a\x09^ true",
  1653. messageSends: [],
  1654. referencedClasses: []
  1655. }),
  1656. globals.SendNode);
  1657. smalltalk.addMethod(
  1658. smalltalk.method({
  1659. selector: "nodes",
  1660. protocol: 'accessing',
  1661. fn: function (){
  1662. var self=this;
  1663. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  1664. return smalltalk.withContext(function($ctx1) {
  1665. var $1,$3,$2,$5,$6,$4;
  1666. $1=self._receiver();
  1667. $ctx1.sendIdx["receiver"]=1;
  1668. if(($receiver = $1) == nil || $receiver == null){
  1669. $3=self._arguments();
  1670. $ctx1.sendIdx["arguments"]=1;
  1671. $2=_st($3)._copy();
  1672. return $2;
  1673. } else {
  1674. $1;
  1675. };
  1676. $5=_st($Array())._with_(self._receiver());
  1677. _st($5)._addAll_(self._arguments());
  1678. $6=_st($5)._yourself();
  1679. $4=$6;
  1680. return $4;
  1681. }, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.SendNode)})},
  1682. args: [],
  1683. 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",
  1684. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"],
  1685. referencedClasses: ["Array"]
  1686. }),
  1687. globals.SendNode);
  1688. smalltalk.addMethod(
  1689. smalltalk.method({
  1690. selector: "receiver",
  1691. protocol: 'accessing',
  1692. fn: function (){
  1693. var self=this;
  1694. var $1;
  1695. $1=self["@receiver"];
  1696. return $1;
  1697. },
  1698. args: [],
  1699. source: "receiver\x0a\x09^ receiver",
  1700. messageSends: [],
  1701. referencedClasses: []
  1702. }),
  1703. globals.SendNode);
  1704. smalltalk.addMethod(
  1705. smalltalk.method({
  1706. selector: "receiver:",
  1707. protocol: 'accessing',
  1708. fn: function (aNode){
  1709. var self=this;
  1710. return smalltalk.withContext(function($ctx1) {
  1711. var $1;
  1712. self["@receiver"]=aNode;
  1713. $1=_st(aNode)._isNode();
  1714. if(smalltalk.assert($1)){
  1715. _st(aNode)._parent_(self);
  1716. };
  1717. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},globals.SendNode)})},
  1718. args: ["aNode"],
  1719. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  1720. messageSends: ["ifTrue:", "isNode", "parent:"],
  1721. referencedClasses: []
  1722. }),
  1723. globals.SendNode);
  1724. smalltalk.addMethod(
  1725. smalltalk.method({
  1726. selector: "requiresSmalltalkContext",
  1727. protocol: 'testing',
  1728. fn: function (){
  1729. var self=this;
  1730. return true;
  1731. },
  1732. args: [],
  1733. source: "requiresSmalltalkContext\x0a\x09^ true",
  1734. messageSends: [],
  1735. referencedClasses: []
  1736. }),
  1737. globals.SendNode);
  1738. smalltalk.addMethod(
  1739. smalltalk.method({
  1740. selector: "selector",
  1741. protocol: 'accessing',
  1742. fn: function (){
  1743. var self=this;
  1744. var $1;
  1745. $1=self["@selector"];
  1746. return $1;
  1747. },
  1748. args: [],
  1749. source: "selector\x0a\x09^ selector",
  1750. messageSends: [],
  1751. referencedClasses: []
  1752. }),
  1753. globals.SendNode);
  1754. smalltalk.addMethod(
  1755. smalltalk.method({
  1756. selector: "selector:",
  1757. protocol: 'accessing',
  1758. fn: function (aString){
  1759. var self=this;
  1760. self["@selector"]=aString;
  1761. return self},
  1762. args: ["aString"],
  1763. source: "selector: aString\x0a\x09selector := aString",
  1764. messageSends: [],
  1765. referencedClasses: []
  1766. }),
  1767. globals.SendNode);
  1768. smalltalk.addMethod(
  1769. smalltalk.method({
  1770. selector: "shouldBeAliased",
  1771. protocol: 'testing',
  1772. fn: function (){
  1773. var self=this;
  1774. var sends;
  1775. return smalltalk.withContext(function($ctx1) {
  1776. var $1;
  1777. sends=_st(_st(_st(self._method())._sendIndexes())._at_(self._selector()))._size();
  1778. $1=_st(globals.SendNode.superclass.fn.prototype._shouldBeAliased.apply(_st(self), []))._or_((function(){
  1779. return smalltalk.withContext(function($ctx2) {
  1780. return _st(_st(_st(sends).__gt((1)))._and_((function(){
  1781. return smalltalk.withContext(function($ctx3) {
  1782. return _st(self._index()).__lt(sends);
  1783. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})})))._and_((function(){
  1784. return smalltalk.withContext(function($ctx3) {
  1785. return self._isReferenced();
  1786. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  1787. $ctx2.sendIdx["and:"]=1;
  1788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1789. return $1;
  1790. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},globals.SendNode)})},
  1791. args: [],
  1792. 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 ] ]",
  1793. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", ">", "<", "index", "isReferenced"],
  1794. referencedClasses: []
  1795. }),
  1796. globals.SendNode);
  1797. smalltalk.addMethod(
  1798. smalltalk.method({
  1799. selector: "stopOnStepping",
  1800. protocol: 'testing',
  1801. fn: function (){
  1802. var self=this;
  1803. return true;
  1804. },
  1805. args: [],
  1806. source: "stopOnStepping\x0a\x09^ true",
  1807. messageSends: [],
  1808. referencedClasses: []
  1809. }),
  1810. globals.SendNode);
  1811. smalltalk.addMethod(
  1812. smalltalk.method({
  1813. selector: "superSend",
  1814. protocol: 'accessing',
  1815. fn: function (){
  1816. var self=this;
  1817. return smalltalk.withContext(function($ctx1) {
  1818. var $2,$1;
  1819. $2=self["@superSend"];
  1820. if(($receiver = $2) == nil || $receiver == null){
  1821. $1=false;
  1822. } else {
  1823. $1=$2;
  1824. };
  1825. return $1;
  1826. }, function($ctx1) {$ctx1.fill(self,"superSend",{},globals.SendNode)})},
  1827. args: [],
  1828. source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
  1829. messageSends: ["ifNil:"],
  1830. referencedClasses: []
  1831. }),
  1832. globals.SendNode);
  1833. smalltalk.addMethod(
  1834. smalltalk.method({
  1835. selector: "superSend:",
  1836. protocol: 'accessing',
  1837. fn: function (aBoolean){
  1838. var self=this;
  1839. self["@superSend"]=aBoolean;
  1840. return self},
  1841. args: ["aBoolean"],
  1842. source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
  1843. messageSends: [],
  1844. referencedClasses: []
  1845. }),
  1846. globals.SendNode);
  1847. smalltalk.addMethod(
  1848. smalltalk.method({
  1849. selector: "valueForReceiver:",
  1850. protocol: 'accessing',
  1851. fn: function (anObject){
  1852. var self=this;
  1853. function $SendNode(){return globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  1854. return smalltalk.withContext(function($ctx1) {
  1855. var $2,$3,$5,$4,$6,$1;
  1856. $2=_st($SendNode())._new();
  1857. _st($2)._position_(self._position());
  1858. _st($2)._source_(self._source());
  1859. $3=$2;
  1860. $5=self._receiver();
  1861. $ctx1.sendIdx["receiver"]=1;
  1862. if(($receiver = $5) == nil || $receiver == null){
  1863. $4=anObject;
  1864. } else {
  1865. $4=_st(self._receiver())._valueForReceiver_(anObject);
  1866. };
  1867. _st($3)._receiver_($4);
  1868. _st($2)._selector_(self._selector());
  1869. _st($2)._arguments_(self._arguments());
  1870. $6=_st($2)._yourself();
  1871. $1=$6;
  1872. return $1;
  1873. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},globals.SendNode)})},
  1874. args: ["anObject"],
  1875. 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",
  1876. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"],
  1877. referencedClasses: ["SendNode"]
  1878. }),
  1879. globals.SendNode);
  1880. smalltalk.addClass('SequenceNode', globals.Node, ['temps', 'scope'], 'Compiler-AST');
  1881. 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).";
  1882. smalltalk.addMethod(
  1883. smalltalk.method({
  1884. selector: "accept:",
  1885. protocol: 'visiting',
  1886. fn: function (aVisitor){
  1887. var self=this;
  1888. return smalltalk.withContext(function($ctx1) {
  1889. var $1;
  1890. $1=_st(aVisitor)._visitSequenceNode_(self);
  1891. return $1;
  1892. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.SequenceNode)})},
  1893. args: ["aVisitor"],
  1894. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  1895. messageSends: ["visitSequenceNode:"],
  1896. referencedClasses: []
  1897. }),
  1898. globals.SequenceNode);
  1899. smalltalk.addMethod(
  1900. smalltalk.method({
  1901. selector: "asBlockSequenceNode",
  1902. protocol: 'converting',
  1903. fn: function (){
  1904. var self=this;
  1905. function $BlockSequenceNode(){return globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
  1906. return smalltalk.withContext(function($ctx1) {
  1907. var $2,$3,$1;
  1908. $2=_st($BlockSequenceNode())._new();
  1909. _st($2)._position_(self._position());
  1910. _st($2)._source_(self._source());
  1911. _st($2)._nodes_(self._nodes());
  1912. _st($2)._temps_(self._temps());
  1913. $3=_st($2)._yourself();
  1914. $1=$3;
  1915. return $1;
  1916. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},globals.SequenceNode)})},
  1917. args: [],
  1918. 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",
  1919. messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"],
  1920. referencedClasses: ["BlockSequenceNode"]
  1921. }),
  1922. globals.SequenceNode);
  1923. smalltalk.addMethod(
  1924. smalltalk.method({
  1925. selector: "isSequenceNode",
  1926. protocol: 'testing',
  1927. fn: function (){
  1928. var self=this;
  1929. return true;
  1930. },
  1931. args: [],
  1932. source: "isSequenceNode\x0a\x09^ true",
  1933. messageSends: [],
  1934. referencedClasses: []
  1935. }),
  1936. globals.SequenceNode);
  1937. smalltalk.addMethod(
  1938. smalltalk.method({
  1939. selector: "scope",
  1940. protocol: 'accessing',
  1941. fn: function (){
  1942. var self=this;
  1943. var $1;
  1944. $1=self["@scope"];
  1945. return $1;
  1946. },
  1947. args: [],
  1948. source: "scope\x0a\x09^ scope",
  1949. messageSends: [],
  1950. referencedClasses: []
  1951. }),
  1952. globals.SequenceNode);
  1953. smalltalk.addMethod(
  1954. smalltalk.method({
  1955. selector: "scope:",
  1956. protocol: 'accessing',
  1957. fn: function (aLexicalScope){
  1958. var self=this;
  1959. self["@scope"]=aLexicalScope;
  1960. return self},
  1961. args: ["aLexicalScope"],
  1962. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  1963. messageSends: [],
  1964. referencedClasses: []
  1965. }),
  1966. globals.SequenceNode);
  1967. smalltalk.addMethod(
  1968. smalltalk.method({
  1969. selector: "temps",
  1970. protocol: 'accessing',
  1971. fn: function (){
  1972. var self=this;
  1973. return smalltalk.withContext(function($ctx1) {
  1974. var $2,$1;
  1975. $2=self["@temps"];
  1976. if(($receiver = $2) == nil || $receiver == null){
  1977. $1=[];
  1978. } else {
  1979. $1=$2;
  1980. };
  1981. return $1;
  1982. }, function($ctx1) {$ctx1.fill(self,"temps",{},globals.SequenceNode)})},
  1983. args: [],
  1984. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  1985. messageSends: ["ifNil:"],
  1986. referencedClasses: []
  1987. }),
  1988. globals.SequenceNode);
  1989. smalltalk.addMethod(
  1990. smalltalk.method({
  1991. selector: "temps:",
  1992. protocol: 'accessing',
  1993. fn: function (aCollection){
  1994. var self=this;
  1995. self["@temps"]=aCollection;
  1996. return self},
  1997. args: ["aCollection"],
  1998. source: "temps: aCollection\x0a\x09temps := aCollection",
  1999. messageSends: [],
  2000. referencedClasses: []
  2001. }),
  2002. globals.SequenceNode);
  2003. smalltalk.addClass('BlockSequenceNode', globals.SequenceNode, [], 'Compiler-AST');
  2004. globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  2005. smalltalk.addMethod(
  2006. smalltalk.method({
  2007. selector: "accept:",
  2008. protocol: 'visiting',
  2009. fn: function (aVisitor){
  2010. var self=this;
  2011. return smalltalk.withContext(function($ctx1) {
  2012. var $1;
  2013. $1=_st(aVisitor)._visitBlockSequenceNode_(self);
  2014. return $1;
  2015. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.BlockSequenceNode)})},
  2016. args: ["aVisitor"],
  2017. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  2018. messageSends: ["visitBlockSequenceNode:"],
  2019. referencedClasses: []
  2020. }),
  2021. globals.BlockSequenceNode);
  2022. smalltalk.addMethod(
  2023. smalltalk.method({
  2024. selector: "isBlockSequenceNode",
  2025. protocol: 'testing',
  2026. fn: function (){
  2027. var self=this;
  2028. return true;
  2029. },
  2030. args: [],
  2031. source: "isBlockSequenceNode\x0a\x09^ true",
  2032. messageSends: [],
  2033. referencedClasses: []
  2034. }),
  2035. globals.BlockSequenceNode);
  2036. smalltalk.addClass('ValueNode', globals.Node, ['value'], 'Compiler-AST');
  2037. globals.ValueNode.comment="I represent a value node.";
  2038. smalltalk.addMethod(
  2039. smalltalk.method({
  2040. selector: "accept:",
  2041. protocol: 'visiting',
  2042. fn: function (aVisitor){
  2043. var self=this;
  2044. return smalltalk.withContext(function($ctx1) {
  2045. var $1;
  2046. $1=_st(aVisitor)._visitValueNode_(self);
  2047. return $1;
  2048. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.ValueNode)})},
  2049. args: ["aVisitor"],
  2050. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  2051. messageSends: ["visitValueNode:"],
  2052. referencedClasses: []
  2053. }),
  2054. globals.ValueNode);
  2055. smalltalk.addMethod(
  2056. smalltalk.method({
  2057. selector: "isImmutable",
  2058. protocol: 'testing',
  2059. fn: function (){
  2060. var self=this;
  2061. return smalltalk.withContext(function($ctx1) {
  2062. var $1;
  2063. $1=_st(self._value())._isImmutable();
  2064. return $1;
  2065. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},globals.ValueNode)})},
  2066. args: [],
  2067. source: "isImmutable\x0a\x09^ self value isImmutable",
  2068. messageSends: ["isImmutable", "value"],
  2069. referencedClasses: []
  2070. }),
  2071. globals.ValueNode);
  2072. smalltalk.addMethod(
  2073. smalltalk.method({
  2074. selector: "isValueNode",
  2075. protocol: 'testing',
  2076. fn: function (){
  2077. var self=this;
  2078. return true;
  2079. },
  2080. args: [],
  2081. source: "isValueNode\x0a\x09^ true",
  2082. messageSends: [],
  2083. referencedClasses: []
  2084. }),
  2085. globals.ValueNode);
  2086. smalltalk.addMethod(
  2087. smalltalk.method({
  2088. selector: "value",
  2089. protocol: 'accessing',
  2090. fn: function (){
  2091. var self=this;
  2092. var $1;
  2093. $1=self["@value"];
  2094. return $1;
  2095. },
  2096. args: [],
  2097. source: "value\x0a\x09^ value",
  2098. messageSends: [],
  2099. referencedClasses: []
  2100. }),
  2101. globals.ValueNode);
  2102. smalltalk.addMethod(
  2103. smalltalk.method({
  2104. selector: "value:",
  2105. protocol: 'accessing',
  2106. fn: function (anObject){
  2107. var self=this;
  2108. self["@value"]=anObject;
  2109. return self},
  2110. args: ["anObject"],
  2111. source: "value: anObject\x0a\x09value := anObject",
  2112. messageSends: [],
  2113. referencedClasses: []
  2114. }),
  2115. globals.ValueNode);
  2116. smalltalk.addClass('VariableNode', globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  2117. globals.VariableNode.comment="I represent an variable node.";
  2118. smalltalk.addMethod(
  2119. smalltalk.method({
  2120. selector: "accept:",
  2121. protocol: 'visiting',
  2122. fn: function (aVisitor){
  2123. var self=this;
  2124. return smalltalk.withContext(function($ctx1) {
  2125. var $1;
  2126. $1=_st(aVisitor)._visitVariableNode_(self);
  2127. return $1;
  2128. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.VariableNode)})},
  2129. args: ["aVisitor"],
  2130. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  2131. messageSends: ["visitVariableNode:"],
  2132. referencedClasses: []
  2133. }),
  2134. globals.VariableNode);
  2135. smalltalk.addMethod(
  2136. smalltalk.method({
  2137. selector: "alias",
  2138. protocol: 'accessing',
  2139. fn: function (){
  2140. var self=this;
  2141. return smalltalk.withContext(function($ctx1) {
  2142. var $1;
  2143. $1=_st(self._binding())._alias();
  2144. return $1;
  2145. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.VariableNode)})},
  2146. args: [],
  2147. source: "alias\x0a\x09^ self binding alias",
  2148. messageSends: ["alias", "binding"],
  2149. referencedClasses: []
  2150. }),
  2151. globals.VariableNode);
  2152. smalltalk.addMethod(
  2153. smalltalk.method({
  2154. selector: "assigned",
  2155. protocol: 'accessing',
  2156. fn: function (){
  2157. var self=this;
  2158. return smalltalk.withContext(function($ctx1) {
  2159. var $2,$1;
  2160. $2=self["@assigned"];
  2161. if(($receiver = $2) == nil || $receiver == null){
  2162. $1=false;
  2163. } else {
  2164. $1=$2;
  2165. };
  2166. return $1;
  2167. }, function($ctx1) {$ctx1.fill(self,"assigned",{},globals.VariableNode)})},
  2168. args: [],
  2169. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  2170. messageSends: ["ifNil:"],
  2171. referencedClasses: []
  2172. }),
  2173. globals.VariableNode);
  2174. smalltalk.addMethod(
  2175. smalltalk.method({
  2176. selector: "assigned:",
  2177. protocol: 'accessing',
  2178. fn: function (aBoolean){
  2179. var self=this;
  2180. self["@assigned"]=aBoolean;
  2181. return self},
  2182. args: ["aBoolean"],
  2183. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  2184. messageSends: [],
  2185. referencedClasses: []
  2186. }),
  2187. globals.VariableNode);
  2188. smalltalk.addMethod(
  2189. smalltalk.method({
  2190. selector: "beAssigned",
  2191. protocol: 'accessing',
  2192. fn: function (){
  2193. var self=this;
  2194. return smalltalk.withContext(function($ctx1) {
  2195. _st(self._binding())._validateAssignment();
  2196. self["@assigned"]=true;
  2197. return self}, function($ctx1) {$ctx1.fill(self,"beAssigned",{},globals.VariableNode)})},
  2198. args: [],
  2199. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  2200. messageSends: ["validateAssignment", "binding"],
  2201. referencedClasses: []
  2202. }),
  2203. globals.VariableNode);
  2204. smalltalk.addMethod(
  2205. smalltalk.method({
  2206. selector: "binding",
  2207. protocol: 'accessing',
  2208. fn: function (){
  2209. var self=this;
  2210. var $1;
  2211. $1=self["@binding"];
  2212. return $1;
  2213. },
  2214. args: [],
  2215. source: "binding\x0a\x09^ binding",
  2216. messageSends: [],
  2217. referencedClasses: []
  2218. }),
  2219. globals.VariableNode);
  2220. smalltalk.addMethod(
  2221. smalltalk.method({
  2222. selector: "binding:",
  2223. protocol: 'accessing',
  2224. fn: function (aScopeVar){
  2225. var self=this;
  2226. self["@binding"]=aScopeVar;
  2227. return self},
  2228. args: ["aScopeVar"],
  2229. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  2230. messageSends: [],
  2231. referencedClasses: []
  2232. }),
  2233. globals.VariableNode);
  2234. smalltalk.addMethod(
  2235. smalltalk.method({
  2236. selector: "isArgument",
  2237. protocol: 'testing',
  2238. fn: function (){
  2239. var self=this;
  2240. return smalltalk.withContext(function($ctx1) {
  2241. var $1;
  2242. $1=_st(self._binding())._isArgVar();
  2243. return $1;
  2244. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},globals.VariableNode)})},
  2245. args: [],
  2246. source: "isArgument\x0a\x09^ self binding isArgVar",
  2247. messageSends: ["isArgVar", "binding"],
  2248. referencedClasses: []
  2249. }),
  2250. globals.VariableNode);
  2251. smalltalk.addMethod(
  2252. smalltalk.method({
  2253. selector: "isImmutable",
  2254. protocol: 'testing',
  2255. fn: function (){
  2256. var self=this;
  2257. return smalltalk.withContext(function($ctx1) {
  2258. var $1;
  2259. $1=_st(self._binding())._isImmutable();
  2260. return $1;
  2261. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},globals.VariableNode)})},
  2262. args: [],
  2263. source: "isImmutable\x0a\x09^ self binding isImmutable",
  2264. messageSends: ["isImmutable", "binding"],
  2265. referencedClasses: []
  2266. }),
  2267. globals.VariableNode);
  2268. smalltalk.addMethod(
  2269. smalltalk.method({
  2270. selector: "isVariableNode",
  2271. protocol: 'testing',
  2272. fn: function (){
  2273. var self=this;
  2274. return true;
  2275. },
  2276. args: [],
  2277. source: "isVariableNode\x0a\x09^ true",
  2278. messageSends: [],
  2279. referencedClasses: []
  2280. }),
  2281. globals.VariableNode);
  2282. smalltalk.addMethod(
  2283. smalltalk.method({
  2284. selector: "isNode",
  2285. protocol: '*Compiler-AST',
  2286. fn: function (){
  2287. var self=this;
  2288. return false;
  2289. },
  2290. args: [],
  2291. source: "isNode\x0a\x09^ false",
  2292. messageSends: [],
  2293. referencedClasses: []
  2294. }),
  2295. globals.Object);
  2296. smalltalk.addMethod(
  2297. smalltalk.method({
  2298. selector: "ast",
  2299. protocol: '*Compiler-AST',
  2300. fn: function (){
  2301. var self=this;
  2302. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2303. return smalltalk.withContext(function($ctx1) {
  2304. var $1,$2;
  2305. $1=self._source();
  2306. $ctx1.sendIdx["source"]=1;
  2307. _st($1)._ifEmpty_((function(){
  2308. return smalltalk.withContext(function($ctx2) {
  2309. return self._error_("Method source is empty");
  2310. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2311. $2=_st($Smalltalk())._parse_(self._source());
  2312. return $2;
  2313. }, function($ctx1) {$ctx1.fill(self,"ast",{},globals.CompiledMethod)})},
  2314. args: [],
  2315. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  2316. messageSends: ["ifEmpty:", "source", "error:", "parse:"],
  2317. referencedClasses: ["Smalltalk"]
  2318. }),
  2319. globals.CompiledMethod);
  2320. });