Compiler-Semantic.deploy.js 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281
  1. smalltalk.addPackage('Compiler-Semantic', {});
  2. smalltalk.addClass('LexicalScope', smalltalk.Object, ['node', 'instruction', 'temps', 'args', 'outerScope'], 'Compiler-Semantic');
  3. smalltalk.addMethod(
  4. "_addArg_",
  5. smalltalk.method({
  6. selector: "addArg:",
  7. fn: function (aString){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) { _st(_st(self)._args())._at_put_(aString,_st((smalltalk.ArgVar || ArgVar))._on_(aString));
  10. _st(_st(_st(self)._args())._at_(aString))._scope_(self);
  11. return self}, self, "addArg:", [aString], smalltalk.LexicalScope)}
  12. }),
  13. smalltalk.LexicalScope);
  14. smalltalk.addMethod(
  15. "_addTemp_",
  16. smalltalk.method({
  17. selector: "addTemp:",
  18. fn: function (aString){
  19. var self=this;
  20. return smalltalk.withContext(function($ctx1) { _st(_st(self)._temps())._at_put_(aString,_st((smalltalk.TempVar || TempVar))._on_(aString));
  21. _st(_st(_st(self)._temps())._at_(aString))._scope_(self);
  22. return self}, self, "addTemp:", [aString], smalltalk.LexicalScope)}
  23. }),
  24. smalltalk.LexicalScope);
  25. smalltalk.addMethod(
  26. "_alias",
  27. smalltalk.method({
  28. selector: "alias",
  29. fn: function (){
  30. var self=this;
  31. return smalltalk.withContext(function($ctx1) { var $1;
  32. $1=_st("$ctx").__comma(_st(_st(self)._scopeLevel())._asString());
  33. return $1;
  34. }, self, "alias", [], smalltalk.LexicalScope)}
  35. }),
  36. smalltalk.LexicalScope);
  37. smalltalk.addMethod(
  38. "_allVariableNames",
  39. smalltalk.method({
  40. selector: "allVariableNames",
  41. fn: function (){
  42. var self=this;
  43. return smalltalk.withContext(function($ctx1) { var $1;
  44. $1=_st(_st(_st(self)._args())._keys()).__comma(_st(_st(self)._temps())._keys());
  45. return $1;
  46. }, self, "allVariableNames", [], smalltalk.LexicalScope)}
  47. }),
  48. smalltalk.LexicalScope);
  49. smalltalk.addMethod(
  50. "_args",
  51. smalltalk.method({
  52. selector: "args",
  53. fn: function (){
  54. var self=this;
  55. return smalltalk.withContext(function($ctx1) { var $1;
  56. if(($receiver = self["@args"]) == nil || $receiver == undefined){
  57. self["@args"]=_st((smalltalk.Dictionary || Dictionary))._new();
  58. $1=self["@args"];
  59. } else {
  60. $1=self["@args"];
  61. };
  62. return $1;
  63. }, self, "args", [], smalltalk.LexicalScope)}
  64. }),
  65. smalltalk.LexicalScope);
  66. smalltalk.addMethod(
  67. "_bindingFor_",
  68. smalltalk.method({
  69. selector: "bindingFor:",
  70. fn: function (aStringOrNode){
  71. var self=this;
  72. return smalltalk.withContext(function($ctx1) { var $1;
  73. $1=_st(_st(self)._pseudoVars())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
  74. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._args())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
  75. return smalltalk.withContext(function($ctx3) { return _st(_st(self)._temps())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
  76. return smalltalk.withContext(function($ctx4) { return nil;
  77. })}));
  78. })}));
  79. })}));
  80. return $1;
  81. }, self, "bindingFor:", [aStringOrNode], smalltalk.LexicalScope)}
  82. }),
  83. smalltalk.LexicalScope);
  84. smalltalk.addMethod(
  85. "_canInlineNonLocalReturns",
  86. smalltalk.method({
  87. selector: "canInlineNonLocalReturns",
  88. fn: function (){
  89. var self=this;
  90. return smalltalk.withContext(function($ctx1) { var $1;
  91. $1=_st(_st(self)._isInlined())._and_((function(){
  92. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._outerScope())._canInlineNonLocalReturns();
  93. })}));
  94. return $1;
  95. }, self, "canInlineNonLocalReturns", [], smalltalk.LexicalScope)}
  96. }),
  97. smalltalk.LexicalScope);
  98. smalltalk.addMethod(
  99. "_instruction",
  100. smalltalk.method({
  101. selector: "instruction",
  102. fn: function (){
  103. var self=this;
  104. return smalltalk.withContext(function($ctx1) { return self["@instruction"];
  105. }, self, "instruction", [], smalltalk.LexicalScope)}
  106. }),
  107. smalltalk.LexicalScope);
  108. smalltalk.addMethod(
  109. "_instruction_",
  110. smalltalk.method({
  111. selector: "instruction:",
  112. fn: function (anIRInstruction){
  113. var self=this;
  114. return smalltalk.withContext(function($ctx1) { self["@instruction"]=anIRInstruction;
  115. return self}, self, "instruction:", [anIRInstruction], smalltalk.LexicalScope)}
  116. }),
  117. smalltalk.LexicalScope);
  118. smalltalk.addMethod(
  119. "_isBlockScope",
  120. smalltalk.method({
  121. selector: "isBlockScope",
  122. fn: function (){
  123. var self=this;
  124. return smalltalk.withContext(function($ctx1) { var $1;
  125. $1=_st(_st(self)._isMethodScope())._not();
  126. return $1;
  127. }, self, "isBlockScope", [], smalltalk.LexicalScope)}
  128. }),
  129. smalltalk.LexicalScope);
  130. smalltalk.addMethod(
  131. "_isInlined",
  132. smalltalk.method({
  133. selector: "isInlined",
  134. fn: function (){
  135. var self=this;
  136. return smalltalk.withContext(function($ctx1) { var $1;
  137. $1=_st(_st(_st(self)._instruction())._notNil())._and_((function(){
  138. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._instruction())._isInlined();
  139. })}));
  140. return $1;
  141. }, self, "isInlined", [], smalltalk.LexicalScope)}
  142. }),
  143. smalltalk.LexicalScope);
  144. smalltalk.addMethod(
  145. "_isMethodScope",
  146. smalltalk.method({
  147. selector: "isMethodScope",
  148. fn: function (){
  149. var self=this;
  150. return smalltalk.withContext(function($ctx1) { return false;
  151. }, self, "isMethodScope", [], smalltalk.LexicalScope)}
  152. }),
  153. smalltalk.LexicalScope);
  154. smalltalk.addMethod(
  155. "_lookupVariable_",
  156. smalltalk.method({
  157. selector: "lookupVariable:",
  158. fn: function (aNode){
  159. var self=this;
  160. return smalltalk.withContext(function($ctx1) { var $1;
  161. $ctx1.lookup=nil;
  162. $ctx1.locals.lookup=_st(self)._bindingFor_(aNode);
  163. if(($receiver = $ctx1.locals.lookup) == nil || $receiver == undefined){
  164. $1=_st(self)._outerScope();
  165. if(($receiver = $1) == nil || $receiver == undefined){
  166. $ctx1.locals.lookup=$1;
  167. } else {
  168. $ctx1.locals.lookup=_st(_st(self)._outerScope())._lookupVariable_(aNode);
  169. };
  170. $ctx1.locals.lookup;
  171. } else {
  172. $ctx1.locals.lookup;
  173. };
  174. return $ctx1.locals.lookup;
  175. }, self, "lookupVariable:", [aNode], smalltalk.LexicalScope)}
  176. }),
  177. smalltalk.LexicalScope);
  178. smalltalk.addMethod(
  179. "_methodScope",
  180. smalltalk.method({
  181. selector: "methodScope",
  182. fn: function (){
  183. var self=this;
  184. return smalltalk.withContext(function($ctx1) { var $2,$1;
  185. $2=_st(self)._outerScope();
  186. if(($receiver = $2) == nil || $receiver == undefined){
  187. $1=$2;
  188. } else {
  189. $1=_st(_st(self)._outerScope())._methodScope();
  190. };
  191. return $1;
  192. }, self, "methodScope", [], smalltalk.LexicalScope)}
  193. }),
  194. smalltalk.LexicalScope);
  195. smalltalk.addMethod(
  196. "_node",
  197. smalltalk.method({
  198. selector: "node",
  199. fn: function (){
  200. var self=this;
  201. return smalltalk.withContext(function($ctx1) { return self["@node"];
  202. }, self, "node", [], smalltalk.LexicalScope)}
  203. }),
  204. smalltalk.LexicalScope);
  205. smalltalk.addMethod(
  206. "_node_",
  207. smalltalk.method({
  208. selector: "node:",
  209. fn: function (aNode){
  210. var self=this;
  211. return smalltalk.withContext(function($ctx1) { self["@node"]=aNode;
  212. return self}, self, "node:", [aNode], smalltalk.LexicalScope)}
  213. }),
  214. smalltalk.LexicalScope);
  215. smalltalk.addMethod(
  216. "_outerScope",
  217. smalltalk.method({
  218. selector: "outerScope",
  219. fn: function (){
  220. var self=this;
  221. return smalltalk.withContext(function($ctx1) { return self["@outerScope"];
  222. }, self, "outerScope", [], smalltalk.LexicalScope)}
  223. }),
  224. smalltalk.LexicalScope);
  225. smalltalk.addMethod(
  226. "_outerScope_",
  227. smalltalk.method({
  228. selector: "outerScope:",
  229. fn: function (aLexicalScope){
  230. var self=this;
  231. return smalltalk.withContext(function($ctx1) { self["@outerScope"]=aLexicalScope;
  232. return self}, self, "outerScope:", [aLexicalScope], smalltalk.LexicalScope)}
  233. }),
  234. smalltalk.LexicalScope);
  235. smalltalk.addMethod(
  236. "_pseudoVars",
  237. smalltalk.method({
  238. selector: "pseudoVars",
  239. fn: function (){
  240. var self=this;
  241. return smalltalk.withContext(function($ctx1) { var $1;
  242. $1=_st(_st(self)._methodScope())._pseudoVars();
  243. return $1;
  244. }, self, "pseudoVars", [], smalltalk.LexicalScope)}
  245. }),
  246. smalltalk.LexicalScope);
  247. smalltalk.addMethod(
  248. "_scopeLevel",
  249. smalltalk.method({
  250. selector: "scopeLevel",
  251. fn: function (){
  252. var self=this;
  253. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  254. $1=_st(self)._outerScope();
  255. if(($receiver = $1) == nil || $receiver == undefined){
  256. return (1);
  257. } else {
  258. $1;
  259. };
  260. $2=_st(self)._isInlined();
  261. if(smalltalk.assert($2)){
  262. $3=_st(_st(self)._outerScope())._scopeLevel();
  263. return $3;
  264. };
  265. $4=_st(_st(_st(self)._outerScope())._scopeLevel()).__plus((1));
  266. return $4;
  267. }, self, "scopeLevel", [], smalltalk.LexicalScope)}
  268. }),
  269. smalltalk.LexicalScope);
  270. smalltalk.addMethod(
  271. "_temps",
  272. smalltalk.method({
  273. selector: "temps",
  274. fn: function (){
  275. var self=this;
  276. return smalltalk.withContext(function($ctx1) { var $1;
  277. if(($receiver = self["@temps"]) == nil || $receiver == undefined){
  278. self["@temps"]=_st((smalltalk.Dictionary || Dictionary))._new();
  279. $1=self["@temps"];
  280. } else {
  281. $1=self["@temps"];
  282. };
  283. return $1;
  284. }, self, "temps", [], smalltalk.LexicalScope)}
  285. }),
  286. smalltalk.LexicalScope);
  287. smalltalk.addClass('MethodLexicalScope', smalltalk.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  288. smalltalk.addMethod(
  289. "_addIVar_",
  290. smalltalk.method({
  291. selector: "addIVar:",
  292. fn: function (aString){
  293. var self=this;
  294. return smalltalk.withContext(function($ctx1) { _st(_st(self)._iVars())._at_put_(aString,_st((smalltalk.InstanceVar || InstanceVar))._on_(aString));
  295. _st(_st(_st(self)._iVars())._at_(aString))._scope_(self);
  296. return self}, self, "addIVar:", [aString], smalltalk.MethodLexicalScope)}
  297. }),
  298. smalltalk.MethodLexicalScope);
  299. smalltalk.addMethod(
  300. "_addNonLocalReturn_",
  301. smalltalk.method({
  302. selector: "addNonLocalReturn:",
  303. fn: function (aScope){
  304. var self=this;
  305. return smalltalk.withContext(function($ctx1) { _st(_st(self)._nonLocalReturns())._add_(aScope);
  306. return self}, self, "addNonLocalReturn:", [aScope], smalltalk.MethodLexicalScope)}
  307. }),
  308. smalltalk.MethodLexicalScope);
  309. smalltalk.addMethod(
  310. "_allVariableNames",
  311. smalltalk.method({
  312. selector: "allVariableNames",
  313. fn: function (){
  314. var self=this;
  315. return smalltalk.withContext(function($ctx1) { var $1;
  316. $1=_st(smalltalk.LexicalScope.fn.prototype._allVariableNames.apply(_st(self), [])).__comma(_st(_st(self)._iVars())._keys());
  317. return $1;
  318. }, self, "allVariableNames", [], smalltalk.MethodLexicalScope)}
  319. }),
  320. smalltalk.MethodLexicalScope);
  321. smalltalk.addMethod(
  322. "_bindingFor_",
  323. smalltalk.method({
  324. selector: "bindingFor:",
  325. fn: function (aNode){
  326. var self=this;
  327. return smalltalk.withContext(function($ctx1) { var $2,$1;
  328. $2=smalltalk.LexicalScope.fn.prototype._bindingFor_.apply(_st(self), [aNode]);
  329. if(($receiver = $2) == nil || $receiver == undefined){
  330. $1=_st(_st(self)._iVars())._at_ifAbsent_(_st(aNode)._value(),(function(){
  331. return smalltalk.withContext(function($ctx2) { return nil;
  332. })}));
  333. } else {
  334. $1=$2;
  335. };
  336. return $1;
  337. }, self, "bindingFor:", [aNode], smalltalk.MethodLexicalScope)}
  338. }),
  339. smalltalk.MethodLexicalScope);
  340. smalltalk.addMethod(
  341. "_canInlineNonLocalReturns",
  342. smalltalk.method({
  343. selector: "canInlineNonLocalReturns",
  344. fn: function (){
  345. var self=this;
  346. return smalltalk.withContext(function($ctx1) { return true;
  347. }, self, "canInlineNonLocalReturns", [], smalltalk.MethodLexicalScope)}
  348. }),
  349. smalltalk.MethodLexicalScope);
  350. smalltalk.addMethod(
  351. "_hasLocalReturn",
  352. smalltalk.method({
  353. selector: "hasLocalReturn",
  354. fn: function (){
  355. var self=this;
  356. return smalltalk.withContext(function($ctx1) { var $1;
  357. $1=_st(self)._localReturn();
  358. return $1;
  359. }, self, "hasLocalReturn", [], smalltalk.MethodLexicalScope)}
  360. }),
  361. smalltalk.MethodLexicalScope);
  362. smalltalk.addMethod(
  363. "_hasNonLocalReturn",
  364. smalltalk.method({
  365. selector: "hasNonLocalReturn",
  366. fn: function (){
  367. var self=this;
  368. return smalltalk.withContext(function($ctx1) { var $1;
  369. $1=_st(_st(self)._nonLocalReturns())._notEmpty();
  370. return $1;
  371. }, self, "hasNonLocalReturn", [], smalltalk.MethodLexicalScope)}
  372. }),
  373. smalltalk.MethodLexicalScope);
  374. smalltalk.addMethod(
  375. "_iVars",
  376. smalltalk.method({
  377. selector: "iVars",
  378. fn: function (){
  379. var self=this;
  380. return smalltalk.withContext(function($ctx1) { var $1;
  381. if(($receiver = self["@iVars"]) == nil || $receiver == undefined){
  382. self["@iVars"]=_st((smalltalk.Dictionary || Dictionary))._new();
  383. $1=self["@iVars"];
  384. } else {
  385. $1=self["@iVars"];
  386. };
  387. return $1;
  388. }, self, "iVars", [], smalltalk.MethodLexicalScope)}
  389. }),
  390. smalltalk.MethodLexicalScope);
  391. smalltalk.addMethod(
  392. "_isMethodScope",
  393. smalltalk.method({
  394. selector: "isMethodScope",
  395. fn: function (){
  396. var self=this;
  397. return smalltalk.withContext(function($ctx1) { return true;
  398. }, self, "isMethodScope", [], smalltalk.MethodLexicalScope)}
  399. }),
  400. smalltalk.MethodLexicalScope);
  401. smalltalk.addMethod(
  402. "_localReturn",
  403. smalltalk.method({
  404. selector: "localReturn",
  405. fn: function (){
  406. var self=this;
  407. return smalltalk.withContext(function($ctx1) { var $1;
  408. if(($receiver = self["@localReturn"]) == nil || $receiver == undefined){
  409. $1=false;
  410. } else {
  411. $1=self["@localReturn"];
  412. };
  413. return $1;
  414. }, self, "localReturn", [], smalltalk.MethodLexicalScope)}
  415. }),
  416. smalltalk.MethodLexicalScope);
  417. smalltalk.addMethod(
  418. "_localReturn_",
  419. smalltalk.method({
  420. selector: "localReturn:",
  421. fn: function (aBoolean){
  422. var self=this;
  423. return smalltalk.withContext(function($ctx1) { self["@localReturn"]=aBoolean;
  424. return self}, self, "localReturn:", [aBoolean], smalltalk.MethodLexicalScope)}
  425. }),
  426. smalltalk.MethodLexicalScope);
  427. smalltalk.addMethod(
  428. "_methodScope",
  429. smalltalk.method({
  430. selector: "methodScope",
  431. fn: function (){
  432. var self=this;
  433. return smalltalk.withContext(function($ctx1) { return self;
  434. }, self, "methodScope", [], smalltalk.MethodLexicalScope)}
  435. }),
  436. smalltalk.MethodLexicalScope);
  437. smalltalk.addMethod(
  438. "_nonLocalReturns",
  439. smalltalk.method({
  440. selector: "nonLocalReturns",
  441. fn: function (){
  442. var self=this;
  443. return smalltalk.withContext(function($ctx1) { var $1;
  444. if(($receiver = self["@nonLocalReturns"]) == nil || $receiver == undefined){
  445. self["@nonLocalReturns"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  446. $1=self["@nonLocalReturns"];
  447. } else {
  448. $1=self["@nonLocalReturns"];
  449. };
  450. return $1;
  451. }, self, "nonLocalReturns", [], smalltalk.MethodLexicalScope)}
  452. }),
  453. smalltalk.MethodLexicalScope);
  454. smalltalk.addMethod(
  455. "_pseudoVars",
  456. smalltalk.method({
  457. selector: "pseudoVars",
  458. fn: function (){
  459. var self=this;
  460. return smalltalk.withContext(function($ctx1) { var $1,$2;
  461. if(($receiver = self["@pseudoVars"]) == nil || $receiver == undefined){
  462. self["@pseudoVars"]=_st((smalltalk.Dictionary || Dictionary))._new();
  463. self["@pseudoVars"];
  464. _st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._pseudoVariableNames())._do_((function(each){
  465. return smalltalk.withContext(function($ctx2) { $1=_st((smalltalk.PseudoVar || PseudoVar))._on_(each);
  466. _st($1)._scope_(_st(self)._methodScope());
  467. $2=_st($1)._yourself();
  468. return _st(self["@pseudoVars"])._at_put_(each,$2);
  469. })}));
  470. } else {
  471. self["@pseudoVars"];
  472. };
  473. return self["@pseudoVars"];
  474. }, self, "pseudoVars", [], smalltalk.MethodLexicalScope)}
  475. }),
  476. smalltalk.MethodLexicalScope);
  477. smalltalk.addMethod(
  478. "_removeNonLocalReturn_",
  479. smalltalk.method({
  480. selector: "removeNonLocalReturn:",
  481. fn: function (aScope){
  482. var self=this;
  483. return smalltalk.withContext(function($ctx1) { _st(_st(self)._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  484. return smalltalk.withContext(function($ctx2) { })}));
  485. return self}, self, "removeNonLocalReturn:", [aScope], smalltalk.MethodLexicalScope)}
  486. }),
  487. smalltalk.MethodLexicalScope);
  488. smalltalk.addMethod(
  489. "_unknownVariables",
  490. smalltalk.method({
  491. selector: "unknownVariables",
  492. fn: function (){
  493. var self=this;
  494. return smalltalk.withContext(function($ctx1) { var $1;
  495. if(($receiver = self["@unknownVariables"]) == nil || $receiver == undefined){
  496. self["@unknownVariables"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  497. $1=self["@unknownVariables"];
  498. } else {
  499. $1=self["@unknownVariables"];
  500. };
  501. return $1;
  502. }, self, "unknownVariables", [], smalltalk.MethodLexicalScope)}
  503. }),
  504. smalltalk.MethodLexicalScope);
  505. smalltalk.addClass('ScopeVar', smalltalk.Object, ['scope', 'name'], 'Compiler-Semantic');
  506. smalltalk.addMethod(
  507. "_alias",
  508. smalltalk.method({
  509. selector: "alias",
  510. fn: function (){
  511. var self=this;
  512. return smalltalk.withContext(function($ctx1) { var $1;
  513. $1=_st(_st(self)._name())._asVariableName();
  514. return $1;
  515. }, self, "alias", [], smalltalk.ScopeVar)}
  516. }),
  517. smalltalk.ScopeVar);
  518. smalltalk.addMethod(
  519. "_isArgVar",
  520. smalltalk.method({
  521. selector: "isArgVar",
  522. fn: function (){
  523. var self=this;
  524. return smalltalk.withContext(function($ctx1) { return false;
  525. }, self, "isArgVar", [], smalltalk.ScopeVar)}
  526. }),
  527. smalltalk.ScopeVar);
  528. smalltalk.addMethod(
  529. "_isClassRefVar",
  530. smalltalk.method({
  531. selector: "isClassRefVar",
  532. fn: function (){
  533. var self=this;
  534. return smalltalk.withContext(function($ctx1) { return false;
  535. }, self, "isClassRefVar", [], smalltalk.ScopeVar)}
  536. }),
  537. smalltalk.ScopeVar);
  538. smalltalk.addMethod(
  539. "_isInstanceVar",
  540. smalltalk.method({
  541. selector: "isInstanceVar",
  542. fn: function (){
  543. var self=this;
  544. return smalltalk.withContext(function($ctx1) { return false;
  545. }, self, "isInstanceVar", [], smalltalk.ScopeVar)}
  546. }),
  547. smalltalk.ScopeVar);
  548. smalltalk.addMethod(
  549. "_isPseudoVar",
  550. smalltalk.method({
  551. selector: "isPseudoVar",
  552. fn: function (){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) { return false;
  555. }, self, "isPseudoVar", [], smalltalk.ScopeVar)}
  556. }),
  557. smalltalk.ScopeVar);
  558. smalltalk.addMethod(
  559. "_isTempVar",
  560. smalltalk.method({
  561. selector: "isTempVar",
  562. fn: function (){
  563. var self=this;
  564. return smalltalk.withContext(function($ctx1) { return false;
  565. }, self, "isTempVar", [], smalltalk.ScopeVar)}
  566. }),
  567. smalltalk.ScopeVar);
  568. smalltalk.addMethod(
  569. "_isUnknownVar",
  570. smalltalk.method({
  571. selector: "isUnknownVar",
  572. fn: function (){
  573. var self=this;
  574. return smalltalk.withContext(function($ctx1) { return false;
  575. }, self, "isUnknownVar", [], smalltalk.ScopeVar)}
  576. }),
  577. smalltalk.ScopeVar);
  578. smalltalk.addMethod(
  579. "_name",
  580. smalltalk.method({
  581. selector: "name",
  582. fn: function (){
  583. var self=this;
  584. return smalltalk.withContext(function($ctx1) { return self["@name"];
  585. }, self, "name", [], smalltalk.ScopeVar)}
  586. }),
  587. smalltalk.ScopeVar);
  588. smalltalk.addMethod(
  589. "_name_",
  590. smalltalk.method({
  591. selector: "name:",
  592. fn: function (aString){
  593. var self=this;
  594. return smalltalk.withContext(function($ctx1) { self["@name"]=aString;
  595. return self}, self, "name:", [aString], smalltalk.ScopeVar)}
  596. }),
  597. smalltalk.ScopeVar);
  598. smalltalk.addMethod(
  599. "_scope",
  600. smalltalk.method({
  601. selector: "scope",
  602. fn: function (){
  603. var self=this;
  604. return smalltalk.withContext(function($ctx1) { return self["@scope"];
  605. }, self, "scope", [], smalltalk.ScopeVar)}
  606. }),
  607. smalltalk.ScopeVar);
  608. smalltalk.addMethod(
  609. "_scope_",
  610. smalltalk.method({
  611. selector: "scope:",
  612. fn: function (aScope){
  613. var self=this;
  614. return smalltalk.withContext(function($ctx1) { self["@scope"]=aScope;
  615. return self}, self, "scope:", [aScope], smalltalk.ScopeVar)}
  616. }),
  617. smalltalk.ScopeVar);
  618. smalltalk.addMethod(
  619. "_validateAssignment",
  620. smalltalk.method({
  621. selector: "validateAssignment",
  622. fn: function (){
  623. var self=this;
  624. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  625. $1=_st(_st(self)._isArgVar())._or_((function(){
  626. return smalltalk.withContext(function($ctx2) { return _st(self)._isPseudoVar();
  627. })}));
  628. if(smalltalk.assert($1)){
  629. $2=_st((smalltalk.InvalidAssignmentError || InvalidAssignmentError))._new();
  630. _st($2)._variableName_(_st(self)._name());
  631. $3=_st($2)._signal();
  632. $3;
  633. };
  634. return self}, self, "validateAssignment", [], smalltalk.ScopeVar)}
  635. }),
  636. smalltalk.ScopeVar);
  637. smalltalk.addMethod(
  638. "_on_",
  639. smalltalk.method({
  640. selector: "on:",
  641. fn: function (aString){
  642. var self=this;
  643. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  644. $2=_st(self)._new();
  645. _st($2)._name_(aString);
  646. $3=_st($2)._yourself();
  647. $1=$3;
  648. return $1;
  649. }, self, "on:", [aString], smalltalk.ScopeVar.klass)}
  650. }),
  651. smalltalk.ScopeVar.klass);
  652. smalltalk.addClass('AliasVar', smalltalk.ScopeVar, ['node'], 'Compiler-Semantic');
  653. smalltalk.addMethod(
  654. "_node",
  655. smalltalk.method({
  656. selector: "node",
  657. fn: function (){
  658. var self=this;
  659. return smalltalk.withContext(function($ctx1) { return self["@node"];
  660. }, self, "node", [], smalltalk.AliasVar)}
  661. }),
  662. smalltalk.AliasVar);
  663. smalltalk.addMethod(
  664. "_node_",
  665. smalltalk.method({
  666. selector: "node:",
  667. fn: function (aNode){
  668. var self=this;
  669. return smalltalk.withContext(function($ctx1) { self["@node"]=aNode;
  670. return self}, self, "node:", [aNode], smalltalk.AliasVar)}
  671. }),
  672. smalltalk.AliasVar);
  673. smalltalk.addClass('ArgVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  674. smalltalk.addMethod(
  675. "_isArgVar",
  676. smalltalk.method({
  677. selector: "isArgVar",
  678. fn: function (){
  679. var self=this;
  680. return smalltalk.withContext(function($ctx1) { return true;
  681. }, self, "isArgVar", [], smalltalk.ArgVar)}
  682. }),
  683. smalltalk.ArgVar);
  684. smalltalk.addClass('ClassRefVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  685. smalltalk.addMethod(
  686. "_alias",
  687. smalltalk.method({
  688. selector: "alias",
  689. fn: function (){
  690. var self=this;
  691. return smalltalk.withContext(function($ctx1) { var $1;
  692. $1=_st(_st(_st(_st("(smalltalk.").__comma(_st(self)._name())).__comma(" || ")).__comma(_st(self)._name())).__comma(")");
  693. return $1;
  694. }, self, "alias", [], smalltalk.ClassRefVar)}
  695. }),
  696. smalltalk.ClassRefVar);
  697. smalltalk.addMethod(
  698. "_isClassRefVar",
  699. smalltalk.method({
  700. selector: "isClassRefVar",
  701. fn: function (){
  702. var self=this;
  703. return smalltalk.withContext(function($ctx1) { return true;
  704. }, self, "isClassRefVar", [], smalltalk.ClassRefVar)}
  705. }),
  706. smalltalk.ClassRefVar);
  707. smalltalk.addClass('InstanceVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  708. smalltalk.addMethod(
  709. "_alias",
  710. smalltalk.method({
  711. selector: "alias",
  712. fn: function (){
  713. var self=this;
  714. return smalltalk.withContext(function($ctx1) { var $1;
  715. $1=_st(_st("self[\x22@").__comma(_st(self)._name())).__comma("\x22]");
  716. return $1;
  717. }, self, "alias", [], smalltalk.InstanceVar)}
  718. }),
  719. smalltalk.InstanceVar);
  720. smalltalk.addMethod(
  721. "_isInstanceVar",
  722. smalltalk.method({
  723. selector: "isInstanceVar",
  724. fn: function (){
  725. var self=this;
  726. return smalltalk.withContext(function($ctx1) { return true;
  727. }, self, "isInstanceVar", [], smalltalk.InstanceVar)}
  728. }),
  729. smalltalk.InstanceVar);
  730. smalltalk.addClass('PseudoVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  731. smalltalk.addMethod(
  732. "_alias",
  733. smalltalk.method({
  734. selector: "alias",
  735. fn: function (){
  736. var self=this;
  737. return smalltalk.withContext(function($ctx1) { var $1;
  738. $1=_st(self)._name();
  739. return $1;
  740. }, self, "alias", [], smalltalk.PseudoVar)}
  741. }),
  742. smalltalk.PseudoVar);
  743. smalltalk.addMethod(
  744. "_isPseudoVar",
  745. smalltalk.method({
  746. selector: "isPseudoVar",
  747. fn: function (){
  748. var self=this;
  749. return smalltalk.withContext(function($ctx1) { return true;
  750. }, self, "isPseudoVar", [], smalltalk.PseudoVar)}
  751. }),
  752. smalltalk.PseudoVar);
  753. smalltalk.addClass('TempVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  754. smalltalk.addMethod(
  755. "_alias",
  756. smalltalk.method({
  757. selector: "alias",
  758. fn: function (){
  759. var self=this;
  760. return smalltalk.withContext(function($ctx1) { var $1;
  761. $1=_st(_st(_st(_st(self)._scope())._alias()).__comma(".locals.")).__comma(smalltalk.ScopeVar.fn.prototype._alias.apply(_st(self), []));
  762. return $1;
  763. }, self, "alias", [], smalltalk.TempVar)}
  764. }),
  765. smalltalk.TempVar);
  766. smalltalk.addMethod(
  767. "_isTempVar",
  768. smalltalk.method({
  769. selector: "isTempVar",
  770. fn: function (){
  771. var self=this;
  772. return smalltalk.withContext(function($ctx1) { return true;
  773. }, self, "isTempVar", [], smalltalk.TempVar)}
  774. }),
  775. smalltalk.TempVar);
  776. smalltalk.addClass('UnknownVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  777. smalltalk.addMethod(
  778. "_isUnknownVar",
  779. smalltalk.method({
  780. selector: "isUnknownVar",
  781. fn: function (){
  782. var self=this;
  783. return smalltalk.withContext(function($ctx1) { return true;
  784. }, self, "isUnknownVar", [], smalltalk.UnknownVar)}
  785. }),
  786. smalltalk.UnknownVar);
  787. smalltalk.addClass('SemanticAnalyzer', smalltalk.NodeVisitor, ['currentScope', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
  788. smalltalk.addMethod(
  789. "_classReferences",
  790. smalltalk.method({
  791. selector: "classReferences",
  792. fn: function (){
  793. var self=this;
  794. return smalltalk.withContext(function($ctx1) { var $1;
  795. if(($receiver = self["@classReferences"]) == nil || $receiver == undefined){
  796. self["@classReferences"]=_st((smalltalk.Set || Set))._new();
  797. $1=self["@classReferences"];
  798. } else {
  799. $1=self["@classReferences"];
  800. };
  801. return $1;
  802. }, self, "classReferences", [], smalltalk.SemanticAnalyzer)}
  803. }),
  804. smalltalk.SemanticAnalyzer);
  805. smalltalk.addMethod(
  806. "_errorShadowingVariable_",
  807. smalltalk.method({
  808. selector: "errorShadowingVariable:",
  809. fn: function (aString){
  810. var self=this;
  811. return smalltalk.withContext(function($ctx1) { var $1,$2;
  812. $1=_st((smalltalk.ShadowingVariableError || ShadowingVariableError))._new();
  813. _st($1)._variableName_(aString);
  814. $2=_st($1)._signal();
  815. return self}, self, "errorShadowingVariable:", [aString], smalltalk.SemanticAnalyzer)}
  816. }),
  817. smalltalk.SemanticAnalyzer);
  818. smalltalk.addMethod(
  819. "_errorUnknownVariable_",
  820. smalltalk.method({
  821. selector: "errorUnknownVariable:",
  822. fn: function (aNode){
  823. var self=this;
  824. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  825. $1=_st(self)._isVariableGloballyUndefined_(_st(aNode)._value());
  826. if(smalltalk.assert($1)){
  827. $2=_st((smalltalk.UnknownVariableError || UnknownVariableError))._new();
  828. _st($2)._variableName_(_st(aNode)._value());
  829. $3=_st($2)._signal();
  830. $3;
  831. } else {
  832. _st(_st(_st(self["@currentScope"])._methodScope())._unknownVariables())._add_(_st(aNode)._value());
  833. };
  834. return self}, self, "errorUnknownVariable:", [aNode], smalltalk.SemanticAnalyzer)}
  835. }),
  836. smalltalk.SemanticAnalyzer);
  837. smalltalk.addMethod(
  838. "_isVariableGloballyUndefined_",
  839. smalltalk.method({
  840. selector: "isVariableGloballyUndefined:",
  841. fn: function (aString){
  842. var self=this;
  843. return smalltalk.withContext(function($ctx1) { return eval('typeof ' + aString + ' == "undefined"');
  844. ;
  845. return self}, self, "isVariableGloballyUndefined:", [aString], smalltalk.SemanticAnalyzer)}
  846. }),
  847. smalltalk.SemanticAnalyzer);
  848. smalltalk.addMethod(
  849. "_messageSends",
  850. smalltalk.method({
  851. selector: "messageSends",
  852. fn: function (){
  853. var self=this;
  854. return smalltalk.withContext(function($ctx1) { var $1;
  855. if(($receiver = self["@messageSends"]) == nil || $receiver == undefined){
  856. self["@messageSends"]=_st((smalltalk.Dictionary || Dictionary))._new();
  857. $1=self["@messageSends"];
  858. } else {
  859. $1=self["@messageSends"];
  860. };
  861. return $1;
  862. }, self, "messageSends", [], smalltalk.SemanticAnalyzer)}
  863. }),
  864. smalltalk.SemanticAnalyzer);
  865. smalltalk.addMethod(
  866. "_newBlockScope",
  867. smalltalk.method({
  868. selector: "newBlockScope",
  869. fn: function (){
  870. var self=this;
  871. return smalltalk.withContext(function($ctx1) { var $1;
  872. $1=_st(self)._newScopeOfClass_((smalltalk.LexicalScope || LexicalScope));
  873. return $1;
  874. }, self, "newBlockScope", [], smalltalk.SemanticAnalyzer)}
  875. }),
  876. smalltalk.SemanticAnalyzer);
  877. smalltalk.addMethod(
  878. "_newMethodScope",
  879. smalltalk.method({
  880. selector: "newMethodScope",
  881. fn: function (){
  882. var self=this;
  883. return smalltalk.withContext(function($ctx1) { var $1;
  884. $1=_st(self)._newScopeOfClass_((smalltalk.MethodLexicalScope || MethodLexicalScope));
  885. return $1;
  886. }, self, "newMethodScope", [], smalltalk.SemanticAnalyzer)}
  887. }),
  888. smalltalk.SemanticAnalyzer);
  889. smalltalk.addMethod(
  890. "_newScopeOfClass_",
  891. smalltalk.method({
  892. selector: "newScopeOfClass:",
  893. fn: function (aLexicalScopeClass){
  894. var self=this;
  895. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  896. $2=_st(aLexicalScopeClass)._new();
  897. _st($2)._outerScope_(self["@currentScope"]);
  898. $3=_st($2)._yourself();
  899. $1=$3;
  900. return $1;
  901. }, self, "newScopeOfClass:", [aLexicalScopeClass], smalltalk.SemanticAnalyzer)}
  902. }),
  903. smalltalk.SemanticAnalyzer);
  904. smalltalk.addMethod(
  905. "_popScope",
  906. smalltalk.method({
  907. selector: "popScope",
  908. fn: function (){
  909. var self=this;
  910. return smalltalk.withContext(function($ctx1) { if(($receiver = self["@currentScope"]) == nil || $receiver == undefined){
  911. self["@currentScope"];
  912. } else {
  913. self["@currentScope"]=_st(self["@currentScope"])._outerScope();
  914. self["@currentScope"];
  915. };
  916. return self}, self, "popScope", [], smalltalk.SemanticAnalyzer)}
  917. }),
  918. smalltalk.SemanticAnalyzer);
  919. smalltalk.addMethod(
  920. "_pushScope_",
  921. smalltalk.method({
  922. selector: "pushScope:",
  923. fn: function (aScope){
  924. var self=this;
  925. return smalltalk.withContext(function($ctx1) { _st(aScope)._outerScope_(self["@currentScope"]);
  926. self["@currentScope"]=aScope;
  927. return self}, self, "pushScope:", [aScope], smalltalk.SemanticAnalyzer)}
  928. }),
  929. smalltalk.SemanticAnalyzer);
  930. smalltalk.addMethod(
  931. "_superSends",
  932. smalltalk.method({
  933. selector: "superSends",
  934. fn: function (){
  935. var self=this;
  936. return smalltalk.withContext(function($ctx1) { var $1;
  937. if(($receiver = self["@superSends"]) == nil || $receiver == undefined){
  938. self["@superSends"]=_st((smalltalk.Dictionary || Dictionary))._new();
  939. $1=self["@superSends"];
  940. } else {
  941. $1=self["@superSends"];
  942. };
  943. return $1;
  944. }, self, "superSends", [], smalltalk.SemanticAnalyzer)}
  945. }),
  946. smalltalk.SemanticAnalyzer);
  947. smalltalk.addMethod(
  948. "_theClass",
  949. smalltalk.method({
  950. selector: "theClass",
  951. fn: function (){
  952. var self=this;
  953. return smalltalk.withContext(function($ctx1) { return self["@theClass"];
  954. }, self, "theClass", [], smalltalk.SemanticAnalyzer)}
  955. }),
  956. smalltalk.SemanticAnalyzer);
  957. smalltalk.addMethod(
  958. "_theClass_",
  959. smalltalk.method({
  960. selector: "theClass:",
  961. fn: function (aClass){
  962. var self=this;
  963. return smalltalk.withContext(function($ctx1) { self["@theClass"]=aClass;
  964. return self}, self, "theClass:", [aClass], smalltalk.SemanticAnalyzer)}
  965. }),
  966. smalltalk.SemanticAnalyzer);
  967. smalltalk.addMethod(
  968. "_validateVariableScope_",
  969. smalltalk.method({
  970. selector: "validateVariableScope:",
  971. fn: function (aString){
  972. var self=this;
  973. return smalltalk.withContext(function($ctx1) { var $1;
  974. $1=_st(self["@currentScope"])._lookupVariable_(aString);
  975. if(($receiver = $1) == nil || $receiver == undefined){
  976. $1;
  977. } else {
  978. _st(self)._errorShadowingVariable_(aString);
  979. };
  980. return self}, self, "validateVariableScope:", [aString], smalltalk.SemanticAnalyzer)}
  981. }),
  982. smalltalk.SemanticAnalyzer);
  983. smalltalk.addMethod(
  984. "_visitAssignmentNode_",
  985. smalltalk.method({
  986. selector: "visitAssignmentNode:",
  987. fn: function (aNode){
  988. var self=this;
  989. return smalltalk.withContext(function($ctx1) { smalltalk.NodeVisitor.fn.prototype._visitAssignmentNode_.apply(_st(self), [aNode]);
  990. _st(_st(aNode)._left())._beAssigned();
  991. return self}, self, "visitAssignmentNode:", [aNode], smalltalk.SemanticAnalyzer)}
  992. }),
  993. smalltalk.SemanticAnalyzer);
  994. smalltalk.addMethod(
  995. "_visitBlockNode_",
  996. smalltalk.method({
  997. selector: "visitBlockNode:",
  998. fn: function (aNode){
  999. var self=this;
  1000. return smalltalk.withContext(function($ctx1) { _st(self)._pushScope_(_st(self)._newBlockScope());
  1001. _st(aNode)._scope_(self["@currentScope"]);
  1002. _st(self["@currentScope"])._node_(aNode);
  1003. _st(_st(aNode)._parameters())._do_((function(each){
  1004. return smalltalk.withContext(function($ctx2) { _st(self)._validateVariableScope_(each);
  1005. return _st(self["@currentScope"])._addArg_(each);
  1006. })}));
  1007. smalltalk.NodeVisitor.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]);
  1008. _st(self)._popScope();
  1009. return self}, self, "visitBlockNode:", [aNode], smalltalk.SemanticAnalyzer)}
  1010. }),
  1011. smalltalk.SemanticAnalyzer);
  1012. smalltalk.addMethod(
  1013. "_visitCascadeNode_",
  1014. smalltalk.method({
  1015. selector: "visitCascadeNode:",
  1016. fn: function (aNode){
  1017. var self=this;
  1018. return smalltalk.withContext(function($ctx1) { var $1;
  1019. _st(_st(aNode)._nodes())._do_((function(each){
  1020. return smalltalk.withContext(function($ctx2) { return _st(each)._receiver_(_st(aNode)._receiver());
  1021. })}));
  1022. smalltalk.NodeVisitor.fn.prototype._visitCascadeNode_.apply(_st(self), [aNode]);
  1023. $1=_st(_st(_st(aNode)._nodes())._first())._superSend();
  1024. if(smalltalk.assert($1)){
  1025. _st(_st(aNode)._nodes())._do_((function(each){
  1026. return smalltalk.withContext(function($ctx2) { return _st(each)._superSend_(true);
  1027. })}));
  1028. };
  1029. return self}, self, "visitCascadeNode:", [aNode], smalltalk.SemanticAnalyzer)}
  1030. }),
  1031. smalltalk.SemanticAnalyzer);
  1032. smalltalk.addMethod(
  1033. "_visitClassReferenceNode_",
  1034. smalltalk.method({
  1035. selector: "visitClassReferenceNode:",
  1036. fn: function (aNode){
  1037. var self=this;
  1038. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1039. _st(_st(self)._classReferences())._add_(_st(aNode)._value());
  1040. $1=_st((smalltalk.ClassRefVar || ClassRefVar))._new();
  1041. _st($1)._name_(_st(aNode)._value());
  1042. $2=_st($1)._yourself();
  1043. _st(aNode)._binding_($2);
  1044. return self}, self, "visitClassReferenceNode:", [aNode], smalltalk.SemanticAnalyzer)}
  1045. }),
  1046. smalltalk.SemanticAnalyzer);
  1047. smalltalk.addMethod(
  1048. "_visitMethodNode_",
  1049. smalltalk.method({
  1050. selector: "visitMethodNode:",
  1051. fn: function (aNode){
  1052. var self=this;
  1053. return smalltalk.withContext(function($ctx1) { var $1;
  1054. _st(self)._pushScope_(_st(self)._newMethodScope());
  1055. _st(aNode)._scope_(self["@currentScope"]);
  1056. _st(self["@currentScope"])._node_(aNode);
  1057. _st(_st(_st(self)._theClass())._allInstanceVariableNames())._do_((function(each){
  1058. return smalltalk.withContext(function($ctx2) { return _st(self["@currentScope"])._addIVar_(each);
  1059. })}));
  1060. _st(_st(aNode)._arguments())._do_((function(each){
  1061. return smalltalk.withContext(function($ctx2) { _st(self)._validateVariableScope_(each);
  1062. return _st(self["@currentScope"])._addArg_(each);
  1063. })}));
  1064. smalltalk.NodeVisitor.fn.prototype._visitMethodNode_.apply(_st(self), [aNode]);
  1065. _st(aNode)._classReferences_(_st(self)._classReferences());
  1066. _st(aNode)._messageSends_(_st(_st(self)._messageSends())._keys());
  1067. $1=_st(aNode)._superSends_(_st(_st(self)._superSends())._keys());
  1068. _st(self)._popScope();
  1069. return self}, self, "visitMethodNode:", [aNode], smalltalk.SemanticAnalyzer)}
  1070. }),
  1071. smalltalk.SemanticAnalyzer);
  1072. smalltalk.addMethod(
  1073. "_visitReturnNode_",
  1074. smalltalk.method({
  1075. selector: "visitReturnNode:",
  1076. fn: function (aNode){
  1077. var self=this;
  1078. return smalltalk.withContext(function($ctx1) { var $1;
  1079. _st(aNode)._scope_(self["@currentScope"]);
  1080. $1=_st(self["@currentScope"])._isMethodScope();
  1081. if(smalltalk.assert($1)){
  1082. _st(self["@currentScope"])._localReturn_(true);
  1083. } else {
  1084. _st(_st(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  1085. };
  1086. smalltalk.NodeVisitor.fn.prototype._visitReturnNode_.apply(_st(self), [aNode]);
  1087. return self}, self, "visitReturnNode:", [aNode], smalltalk.SemanticAnalyzer)}
  1088. }),
  1089. smalltalk.SemanticAnalyzer);
  1090. smalltalk.addMethod(
  1091. "_visitSendNode_",
  1092. smalltalk.method({
  1093. selector: "visitSendNode:",
  1094. fn: function (aNode){
  1095. var self=this;
  1096. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  1097. $1=_st(_st(_st(aNode)._receiver())._value()).__eq("super");
  1098. if(smalltalk.assert($1)){
  1099. _st(aNode)._superSend_(true);
  1100. _st(_st(aNode)._receiver())._value_("self");
  1101. _st(_st(self)._superSends())._at_ifAbsentPut_(_st(aNode)._selector(),(function(){
  1102. return smalltalk.withContext(function($ctx2) { return _st((smalltalk.Set || Set))._new();
  1103. })}));
  1104. _st(_st(_st(self)._superSends())._at_(_st(aNode)._selector()))._add_(aNode);
  1105. } else {
  1106. $2=_st(_st((smalltalk.IRSendInliner || IRSendInliner))._inlinedSelectors())._includes_(_st(aNode)._selector());
  1107. if(smalltalk.assert($2)){
  1108. _st(aNode)._shouldBeInlined_(true);
  1109. $3=_st(_st(aNode)._receiver())._isValueNode();
  1110. if(! smalltalk.assert($3)){
  1111. _st(_st(aNode)._receiver())._shouldBeAliased_(true);
  1112. };
  1113. };
  1114. };
  1115. _st(_st(self)._messageSends())._at_ifAbsentPut_(_st(aNode)._selector(),(function(){
  1116. return smalltalk.withContext(function($ctx2) { return _st((smalltalk.Set || Set))._new();
  1117. })}));
  1118. _st(_st(_st(self)._messageSends())._at_(_st(aNode)._selector()))._add_(aNode);
  1119. _st(aNode)._index_(_st(_st(_st(self)._messageSends())._at_(_st(aNode)._selector()))._size());
  1120. smalltalk.NodeVisitor.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
  1121. return self}, self, "visitSendNode:", [aNode], smalltalk.SemanticAnalyzer)}
  1122. }),
  1123. smalltalk.SemanticAnalyzer);
  1124. smalltalk.addMethod(
  1125. "_visitSequenceNode_",
  1126. smalltalk.method({
  1127. selector: "visitSequenceNode:",
  1128. fn: function (aNode){
  1129. var self=this;
  1130. return smalltalk.withContext(function($ctx1) { _st(_st(aNode)._temps())._do_((function(each){
  1131. return smalltalk.withContext(function($ctx2) { _st(self)._validateVariableScope_(each);
  1132. return _st(self["@currentScope"])._addTemp_(each);
  1133. })}));
  1134. smalltalk.NodeVisitor.fn.prototype._visitSequenceNode_.apply(_st(self), [aNode]);
  1135. return self}, self, "visitSequenceNode:", [aNode], smalltalk.SemanticAnalyzer)}
  1136. }),
  1137. smalltalk.SemanticAnalyzer);
  1138. smalltalk.addMethod(
  1139. "_visitVariableNode_",
  1140. smalltalk.method({
  1141. selector: "visitVariableNode:",
  1142. fn: function (aNode){
  1143. var self=this;
  1144. return smalltalk.withContext(function($ctx1) { var $2,$3,$4,$1;
  1145. $2=_st(self["@currentScope"])._lookupVariable_(aNode);
  1146. if(($receiver = $2) == nil || $receiver == undefined){
  1147. _st(self)._errorUnknownVariable_(aNode);
  1148. $3=_st((smalltalk.UnknownVar || UnknownVar))._new();
  1149. _st($3)._name_(_st(aNode)._value());
  1150. $4=_st($3)._yourself();
  1151. $1=$4;
  1152. } else {
  1153. $1=$2;
  1154. };
  1155. _st(aNode)._binding_($1);
  1156. return self}, self, "visitVariableNode:", [aNode], smalltalk.SemanticAnalyzer)}
  1157. }),
  1158. smalltalk.SemanticAnalyzer);
  1159. smalltalk.addMethod(
  1160. "_on_",
  1161. smalltalk.method({
  1162. selector: "on:",
  1163. fn: function (aClass){
  1164. var self=this;
  1165. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1166. $2=_st(self)._new();
  1167. _st($2)._theClass_(aClass);
  1168. $3=_st($2)._yourself();
  1169. $1=$3;
  1170. return $1;
  1171. }, self, "on:", [aClass], smalltalk.SemanticAnalyzer.klass)}
  1172. }),
  1173. smalltalk.SemanticAnalyzer.klass);