Compiler-Semantic.deploy.js 36 KB

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