Compiler-Semantic.deploy.js 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298
  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. $1=_st(self)._isVariableGloballyUndefined_(_st(aNode)._value());
  842. if(smalltalk.assert($1)){
  843. $2=_st((smalltalk.UnknownVariableError || UnknownVariableError))._new();
  844. _st($2)._variableName_(_st(aNode)._value());
  845. $3=_st($2)._signal();
  846. $3;
  847. } else {
  848. _st(_st(_st(self["@currentScope"])._methodScope())._unknownVariables())._add_(_st(aNode)._value());
  849. };
  850. return self}, self, "errorUnknownVariable:", [aNode], smalltalk.SemanticAnalyzer)}
  851. }),
  852. smalltalk.SemanticAnalyzer);
  853. smalltalk.addMethod(
  854. "_isVariableGloballyUndefined_",
  855. smalltalk.method({
  856. selector: "isVariableGloballyUndefined:",
  857. fn: function (aString){
  858. var self=this;
  859. return smalltalk.withContext(function($ctx1) { return eval('typeof ' + aString + ' == "undefined"');
  860. ;
  861. return self}, self, "isVariableGloballyUndefined:", [aString], smalltalk.SemanticAnalyzer)}
  862. }),
  863. smalltalk.SemanticAnalyzer);
  864. smalltalk.addMethod(
  865. "_messageSends",
  866. smalltalk.method({
  867. selector: "messageSends",
  868. fn: function (){
  869. var self=this;
  870. return smalltalk.withContext(function($ctx1) { var $1;
  871. if(($receiver = self["@messageSends"]) == nil || $receiver == undefined){
  872. self["@messageSends"]=_st((smalltalk.Dictionary || Dictionary))._new();
  873. $1=self["@messageSends"];
  874. } else {
  875. $1=self["@messageSends"];
  876. };
  877. return $1;
  878. }, self, "messageSends", [], smalltalk.SemanticAnalyzer)}
  879. }),
  880. smalltalk.SemanticAnalyzer);
  881. smalltalk.addMethod(
  882. "_newBlockScope",
  883. smalltalk.method({
  884. selector: "newBlockScope",
  885. fn: function (){
  886. var self=this;
  887. return smalltalk.withContext(function($ctx1) { var $1;
  888. $1=_st(self)._newScopeOfClass_((smalltalk.LexicalScope || LexicalScope));
  889. return $1;
  890. }, self, "newBlockScope", [], smalltalk.SemanticAnalyzer)}
  891. }),
  892. smalltalk.SemanticAnalyzer);
  893. smalltalk.addMethod(
  894. "_newMethodScope",
  895. smalltalk.method({
  896. selector: "newMethodScope",
  897. fn: function (){
  898. var self=this;
  899. return smalltalk.withContext(function($ctx1) { var $1;
  900. $1=_st(self)._newScopeOfClass_((smalltalk.MethodLexicalScope || MethodLexicalScope));
  901. return $1;
  902. }, self, "newMethodScope", [], smalltalk.SemanticAnalyzer)}
  903. }),
  904. smalltalk.SemanticAnalyzer);
  905. smalltalk.addMethod(
  906. "_newScopeOfClass_",
  907. smalltalk.method({
  908. selector: "newScopeOfClass:",
  909. fn: function (aLexicalScopeClass){
  910. var self=this;
  911. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  912. $2=_st(aLexicalScopeClass)._new();
  913. _st($2)._outerScope_(self["@currentScope"]);
  914. $3=_st($2)._yourself();
  915. $1=$3;
  916. return $1;
  917. }, self, "newScopeOfClass:", [aLexicalScopeClass], smalltalk.SemanticAnalyzer)}
  918. }),
  919. smalltalk.SemanticAnalyzer);
  920. smalltalk.addMethod(
  921. "_popScope",
  922. smalltalk.method({
  923. selector: "popScope",
  924. fn: function (){
  925. var self=this;
  926. return smalltalk.withContext(function($ctx1) { if(($receiver = self["@currentScope"]) == nil || $receiver == undefined){
  927. self["@currentScope"];
  928. } else {
  929. self["@currentScope"]=_st(self["@currentScope"])._outerScope();
  930. self["@currentScope"];
  931. };
  932. return self}, self, "popScope", [], smalltalk.SemanticAnalyzer)}
  933. }),
  934. smalltalk.SemanticAnalyzer);
  935. smalltalk.addMethod(
  936. "_pushScope_",
  937. smalltalk.method({
  938. selector: "pushScope:",
  939. fn: function (aScope){
  940. var self=this;
  941. return smalltalk.withContext(function($ctx1) { _st(aScope)._outerScope_(self["@currentScope"]);
  942. self["@currentScope"]=aScope;
  943. return self}, self, "pushScope:", [aScope], smalltalk.SemanticAnalyzer)}
  944. }),
  945. smalltalk.SemanticAnalyzer);
  946. smalltalk.addMethod(
  947. "_superSends",
  948. smalltalk.method({
  949. selector: "superSends",
  950. fn: function (){
  951. var self=this;
  952. return smalltalk.withContext(function($ctx1) { var $1;
  953. if(($receiver = self["@superSends"]) == nil || $receiver == undefined){
  954. self["@superSends"]=_st((smalltalk.Dictionary || Dictionary))._new();
  955. $1=self["@superSends"];
  956. } else {
  957. $1=self["@superSends"];
  958. };
  959. return $1;
  960. }, self, "superSends", [], smalltalk.SemanticAnalyzer)}
  961. }),
  962. smalltalk.SemanticAnalyzer);
  963. smalltalk.addMethod(
  964. "_theClass",
  965. smalltalk.method({
  966. selector: "theClass",
  967. fn: function (){
  968. var self=this;
  969. return smalltalk.withContext(function($ctx1) { var $1;
  970. $1=self["@theClass"];
  971. return $1;
  972. }, self, "theClass", [], smalltalk.SemanticAnalyzer)}
  973. }),
  974. smalltalk.SemanticAnalyzer);
  975. smalltalk.addMethod(
  976. "_theClass_",
  977. smalltalk.method({
  978. selector: "theClass:",
  979. fn: function (aClass){
  980. var self=this;
  981. return smalltalk.withContext(function($ctx1) { self["@theClass"]=aClass;
  982. return self}, self, "theClass:", [aClass], smalltalk.SemanticAnalyzer)}
  983. }),
  984. smalltalk.SemanticAnalyzer);
  985. smalltalk.addMethod(
  986. "_validateVariableScope_",
  987. smalltalk.method({
  988. selector: "validateVariableScope:",
  989. fn: function (aString){
  990. var self=this;
  991. return smalltalk.withContext(function($ctx1) { var $1;
  992. $1=_st(self["@currentScope"])._lookupVariable_(aString);
  993. if(($receiver = $1) == nil || $receiver == undefined){
  994. $1;
  995. } else {
  996. _st(self)._errorShadowingVariable_(aString);
  997. };
  998. return self}, self, "validateVariableScope:", [aString], smalltalk.SemanticAnalyzer)}
  999. }),
  1000. smalltalk.SemanticAnalyzer);
  1001. smalltalk.addMethod(
  1002. "_visitAssignmentNode_",
  1003. smalltalk.method({
  1004. selector: "visitAssignmentNode:",
  1005. fn: function (aNode){
  1006. var self=this;
  1007. return smalltalk.withContext(function($ctx1) { smalltalk.NodeVisitor.fn.prototype._visitAssignmentNode_.apply(_st(self), [aNode]);
  1008. _st(_st(aNode)._left())._beAssigned();
  1009. return self}, self, "visitAssignmentNode:", [aNode], smalltalk.SemanticAnalyzer)}
  1010. }),
  1011. smalltalk.SemanticAnalyzer);
  1012. smalltalk.addMethod(
  1013. "_visitBlockNode_",
  1014. smalltalk.method({
  1015. selector: "visitBlockNode:",
  1016. fn: function (aNode){
  1017. var self=this;
  1018. return smalltalk.withContext(function($ctx1) { _st(self)._pushScope_(_st(self)._newBlockScope());
  1019. _st(aNode)._scope_(self["@currentScope"]);
  1020. _st(self["@currentScope"])._node_(aNode);
  1021. _st(_st(aNode)._parameters())._do_((function(each){
  1022. return smalltalk.withContext(function($ctx2) { _st(self)._validateVariableScope_(each);
  1023. return _st(self["@currentScope"])._addArg_(each);
  1024. })}));
  1025. smalltalk.NodeVisitor.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]);
  1026. _st(self)._popScope();
  1027. return self}, self, "visitBlockNode:", [aNode], smalltalk.SemanticAnalyzer)}
  1028. }),
  1029. smalltalk.SemanticAnalyzer);
  1030. smalltalk.addMethod(
  1031. "_visitCascadeNode_",
  1032. smalltalk.method({
  1033. selector: "visitCascadeNode:",
  1034. fn: function (aNode){
  1035. var self=this;
  1036. return smalltalk.withContext(function($ctx1) { var $1;
  1037. _st(_st(aNode)._nodes())._do_((function(each){
  1038. return smalltalk.withContext(function($ctx2) { return _st(each)._receiver_(_st(aNode)._receiver());
  1039. })}));
  1040. smalltalk.NodeVisitor.fn.prototype._visitCascadeNode_.apply(_st(self), [aNode]);
  1041. $1=_st(_st(_st(aNode)._nodes())._first())._superSend();
  1042. if(smalltalk.assert($1)){
  1043. _st(_st(aNode)._nodes())._do_((function(each){
  1044. return smalltalk.withContext(function($ctx2) { return _st(each)._superSend_(true);
  1045. })}));
  1046. };
  1047. return self}, self, "visitCascadeNode:", [aNode], smalltalk.SemanticAnalyzer)}
  1048. }),
  1049. smalltalk.SemanticAnalyzer);
  1050. smalltalk.addMethod(
  1051. "_visitClassReferenceNode_",
  1052. smalltalk.method({
  1053. selector: "visitClassReferenceNode:",
  1054. fn: function (aNode){
  1055. var self=this;
  1056. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1057. _st(_st(self)._classReferences())._add_(_st(aNode)._value());
  1058. $1=_st((smalltalk.ClassRefVar || ClassRefVar))._new();
  1059. _st($1)._name_(_st(aNode)._value());
  1060. $2=_st($1)._yourself();
  1061. _st(aNode)._binding_($2);
  1062. return self}, self, "visitClassReferenceNode:", [aNode], smalltalk.SemanticAnalyzer)}
  1063. }),
  1064. smalltalk.SemanticAnalyzer);
  1065. smalltalk.addMethod(
  1066. "_visitMethodNode_",
  1067. smalltalk.method({
  1068. selector: "visitMethodNode:",
  1069. fn: function (aNode){
  1070. var self=this;
  1071. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1072. _st(self)._pushScope_(_st(self)._newMethodScope());
  1073. _st(aNode)._scope_(self["@currentScope"]);
  1074. _st(self["@currentScope"])._node_(aNode);
  1075. _st(_st(_st(self)._theClass())._allInstanceVariableNames())._do_((function(each){
  1076. return smalltalk.withContext(function($ctx2) { return _st(self["@currentScope"])._addIVar_(each);
  1077. })}));
  1078. _st(_st(aNode)._arguments())._do_((function(each){
  1079. return smalltalk.withContext(function($ctx2) { _st(self)._validateVariableScope_(each);
  1080. return _st(self["@currentScope"])._addArg_(each);
  1081. })}));
  1082. smalltalk.NodeVisitor.fn.prototype._visitMethodNode_.apply(_st(self), [aNode]);
  1083. $1=aNode;
  1084. _st($1)._classReferences_(_st(self)._classReferences());
  1085. _st($1)._messageSends_(_st(_st(self)._messageSends())._keys());
  1086. $2=_st($1)._superSends_(_st(_st(self)._superSends())._keys());
  1087. _st(self)._popScope();
  1088. return self}, self, "visitMethodNode:", [aNode], smalltalk.SemanticAnalyzer)}
  1089. }),
  1090. smalltalk.SemanticAnalyzer);
  1091. smalltalk.addMethod(
  1092. "_visitReturnNode_",
  1093. smalltalk.method({
  1094. selector: "visitReturnNode:",
  1095. fn: function (aNode){
  1096. var self=this;
  1097. return smalltalk.withContext(function($ctx1) { var $1;
  1098. _st(aNode)._scope_(self["@currentScope"]);
  1099. $1=_st(self["@currentScope"])._isMethodScope();
  1100. if(smalltalk.assert($1)){
  1101. _st(self["@currentScope"])._localReturn_(true);
  1102. } else {
  1103. _st(_st(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  1104. };
  1105. smalltalk.NodeVisitor.fn.prototype._visitReturnNode_.apply(_st(self), [aNode]);
  1106. return self}, self, "visitReturnNode:", [aNode], smalltalk.SemanticAnalyzer)}
  1107. }),
  1108. smalltalk.SemanticAnalyzer);
  1109. smalltalk.addMethod(
  1110. "_visitSendNode_",
  1111. smalltalk.method({
  1112. selector: "visitSendNode:",
  1113. fn: function (aNode){
  1114. var self=this;
  1115. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1116. $1=_st(_st(_st(aNode)._receiver())._value()).__eq("super");
  1117. if(smalltalk.assert($1)){
  1118. _st(aNode)._superSend_(true);
  1119. _st(_st(aNode)._receiver())._value_("self");
  1120. _st(_st(self)._superSends())._at_ifAbsentPut_(_st(aNode)._selector(),(function(){
  1121. return smalltalk.withContext(function($ctx2) { return _st((smalltalk.Set || Set))._new();
  1122. })}));
  1123. _st(_st(_st(self)._superSends())._at_(_st(aNode)._selector()))._add_(aNode);
  1124. } else {
  1125. $2=_st(_st((smalltalk.IRSendInliner || IRSendInliner))._inlinedSelectors())._includes_(_st(aNode)._selector());
  1126. if(smalltalk.assert($2)){
  1127. _st(aNode)._shouldBeInlined_(true);
  1128. _st(_st(aNode)._receiver())._shouldBeAliased_(true);
  1129. };
  1130. };
  1131. _st(_st(self)._messageSends())._at_ifAbsentPut_(_st(aNode)._selector(),(function(){
  1132. return smalltalk.withContext(function($ctx2) { return _st((smalltalk.Set || Set))._new();
  1133. })}));
  1134. _st(_st(_st(self)._messageSends())._at_(_st(aNode)._selector()))._add_(aNode);
  1135. _st(aNode)._index_(_st(_st(_st(self)._messageSends())._at_(_st(aNode)._selector()))._size());
  1136. smalltalk.NodeVisitor.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
  1137. return self}, self, "visitSendNode:", [aNode], smalltalk.SemanticAnalyzer)}
  1138. }),
  1139. smalltalk.SemanticAnalyzer);
  1140. smalltalk.addMethod(
  1141. "_visitSequenceNode_",
  1142. smalltalk.method({
  1143. selector: "visitSequenceNode:",
  1144. fn: function (aNode){
  1145. var self=this;
  1146. return smalltalk.withContext(function($ctx1) { _st(_st(aNode)._temps())._do_((function(each){
  1147. return smalltalk.withContext(function($ctx2) { _st(self)._validateVariableScope_(each);
  1148. return _st(self["@currentScope"])._addTemp_(each);
  1149. })}));
  1150. smalltalk.NodeVisitor.fn.prototype._visitSequenceNode_.apply(_st(self), [aNode]);
  1151. return self}, self, "visitSequenceNode:", [aNode], smalltalk.SemanticAnalyzer)}
  1152. }),
  1153. smalltalk.SemanticAnalyzer);
  1154. smalltalk.addMethod(
  1155. "_visitVariableNode_",
  1156. smalltalk.method({
  1157. selector: "visitVariableNode:",
  1158. fn: function (aNode){
  1159. var self=this;
  1160. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$5,$2;
  1161. $1=aNode;
  1162. $3=_st(self["@currentScope"])._lookupVariable_(aNode);
  1163. if(($receiver = $3) == nil || $receiver == undefined){
  1164. _st(self)._errorUnknownVariable_(aNode);
  1165. $4=_st((smalltalk.UnknownVar || UnknownVar))._new();
  1166. _st($4)._name_(_st(aNode)._value());
  1167. $5=_st($4)._yourself();
  1168. $2=$5;
  1169. } else {
  1170. $2=$3;
  1171. };
  1172. _st($1)._binding_($2);
  1173. return self}, self, "visitVariableNode:", [aNode], smalltalk.SemanticAnalyzer)}
  1174. }),
  1175. smalltalk.SemanticAnalyzer);
  1176. smalltalk.addMethod(
  1177. "_on_",
  1178. smalltalk.method({
  1179. selector: "on:",
  1180. fn: function (aClass){
  1181. var self=this;
  1182. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1183. $2=_st(self)._new();
  1184. _st($2)._theClass_(aClass);
  1185. $3=_st($2)._yourself();
  1186. $1=$3;
  1187. return $1;
  1188. }, self, "on:", [aClass], smalltalk.SemanticAnalyzer.klass)}
  1189. }),
  1190. smalltalk.SemanticAnalyzer.klass);