Compiler-AST.js 66 KB

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