Compiler-AST.js 67 KB

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