1
0

Compiler-AST.js 68 KB

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