Compiler-Semantic.deploy.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798
  1. smalltalk.addPackage('Compiler-Semantic', {});
  2. smalltalk.addClass('LexicalScope', smalltalk.Object, ['node', '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. smalltalk.send(smalltalk.send(self, "_args", []), "_at_put_", [aString, smalltalk.send((smalltalk.ArgVar || ArgVar), "_on_", [aString])]);
  10. smalltalk.send(smalltalk.send(smalltalk.send(self, "_args", []), "_at_", [aString]), "_scope_", [self]);
  11. return self;}
  12. }),
  13. smalltalk.LexicalScope);
  14. smalltalk.addMethod(
  15. "_addTemp_",
  16. smalltalk.method({
  17. selector: "addTemp:",
  18. fn: function (aString) {
  19. var self=this;
  20. smalltalk.send(smalltalk.send(self, "_temps", []), "_at_put_", [aString, smalltalk.send((smalltalk.TempVar || TempVar), "_on_", [aString])]);
  21. smalltalk.send(smalltalk.send(smalltalk.send(self, "_temps", []), "_at_", [aString]), "_scope_", [self]);
  22. return self;}
  23. }),
  24. smalltalk.LexicalScope);
  25. smalltalk.addMethod(
  26. "_allVariableNames",
  27. smalltalk.method({
  28. selector: "allVariableNames",
  29. fn: function () {
  30. var self=this;
  31. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_args", []), "_keys", []), "__comma", [smalltalk.send(smalltalk.send(self, "_temps", []), "_keys", [])]);
  32. return self;}
  33. }),
  34. smalltalk.LexicalScope);
  35. smalltalk.addMethod(
  36. "_args",
  37. smalltalk.method({
  38. selector: "args",
  39. fn: function () {
  40. var self=this;
  41. return (($receiver = self['@args']) == nil || $receiver == undefined) ? (function(){return (self['@args']=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));})() : $receiver;
  42. return self;}
  43. }),
  44. smalltalk.LexicalScope);
  45. smalltalk.addMethod(
  46. "_bindingFor_",
  47. smalltalk.method({
  48. selector: "bindingFor:",
  49. fn: function (aStringOrNode) {
  50. var self=this;
  51. return smalltalk.send(smalltalk.send(self, "_args", []), "_at_ifAbsent_", [smalltalk.send(aStringOrNode, "_value", []), (function(){return smalltalk.send(smalltalk.send(self, "_temps", []), "_at_ifAbsent_", [smalltalk.send(aStringOrNode, "_value", []), (function(){return nil;})]);})]);
  52. return self;}
  53. }),
  54. smalltalk.LexicalScope);
  55. smalltalk.addMethod(
  56. "_isMethodScope",
  57. smalltalk.method({
  58. selector: "isMethodScope",
  59. fn: function () {
  60. var self=this;
  61. return false;
  62. return self;}
  63. }),
  64. smalltalk.LexicalScope);
  65. smalltalk.addMethod(
  66. "_lookupVariable_",
  67. smalltalk.method({
  68. selector: "lookupVariable:",
  69. fn: function (aNode) {
  70. var self=this;
  71. var lookup=nil;
  72. (lookup=smalltalk.send(self, "_bindingFor_", [aNode]));
  73. (($receiver = lookup) == nil || $receiver == undefined) ? (function(){return (lookup=(($receiver = smalltalk.send(self, "_outerScope", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(smalltalk.send(self, "_outerScope", []), "_lookupVariable_", [aNode]);})() : nil);})() : $receiver;
  74. return lookup;
  75. return self;}
  76. }),
  77. smalltalk.LexicalScope);
  78. smalltalk.addMethod(
  79. "_methodScope",
  80. smalltalk.method({
  81. selector: "methodScope",
  82. fn: function () {
  83. var self=this;
  84. return (($receiver = smalltalk.send(self, "_outerScope", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(smalltalk.send(self, "_outerScope", []), "_methodScope", []);})() : nil;
  85. return self;}
  86. }),
  87. smalltalk.LexicalScope);
  88. smalltalk.addMethod(
  89. "_node",
  90. smalltalk.method({
  91. selector: "node",
  92. fn: function () {
  93. var self=this;
  94. return self['@node'];
  95. return self;}
  96. }),
  97. smalltalk.LexicalScope);
  98. smalltalk.addMethod(
  99. "_node_",
  100. smalltalk.method({
  101. selector: "node:",
  102. fn: function (aNode) {
  103. var self=this;
  104. (self['@node']=aNode);
  105. return self;}
  106. }),
  107. smalltalk.LexicalScope);
  108. smalltalk.addMethod(
  109. "_outerScope",
  110. smalltalk.method({
  111. selector: "outerScope",
  112. fn: function () {
  113. var self=this;
  114. return self['@outerScope'];
  115. return self;}
  116. }),
  117. smalltalk.LexicalScope);
  118. smalltalk.addMethod(
  119. "_outerScope_",
  120. smalltalk.method({
  121. selector: "outerScope:",
  122. fn: function (aLexicalScope) {
  123. var self=this;
  124. (self['@outerScope']=aLexicalScope);
  125. return self;}
  126. }),
  127. smalltalk.LexicalScope);
  128. smalltalk.addMethod(
  129. "_scopeLevel",
  130. smalltalk.method({
  131. selector: "scopeLevel",
  132. fn: function () {
  133. var self=this;
  134. return ((($receiver = (($receiver = smalltalk.send(self, "_outerScope", [])) == nil || $receiver == undefined) ? (function(){return (0);})() : (function(){return smalltalk.send(smalltalk.send(self, "_outerScope", []), "_scopeLevel", []);})()).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));
  135. return self;}
  136. }),
  137. smalltalk.LexicalScope);
  138. smalltalk.addMethod(
  139. "_temps",
  140. smalltalk.method({
  141. selector: "temps",
  142. fn: function () {
  143. var self=this;
  144. return (($receiver = self['@temps']) == nil || $receiver == undefined) ? (function(){return (self['@temps']=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));})() : $receiver;
  145. return self;}
  146. }),
  147. smalltalk.LexicalScope);
  148. smalltalk.addClass('MethodLexicalScope', smalltalk.LexicalScope, ['iVars', 'unknownVariables', 'nonLocalReturn'], 'Compiler-Semantic');
  149. smalltalk.addMethod(
  150. "_addIvar_",
  151. smalltalk.method({
  152. selector: "addIvar:",
  153. fn: function (aString) {
  154. var self=this;
  155. smalltalk.send(smalltalk.send(self, "_iVars", []), "_at_put_", [aString, smalltalk.send((smalltalk.InstanceVar || InstanceVar), "_on_", [aString])]);
  156. smalltalk.send(smalltalk.send(smalltalk.send(self, "_iVars", []), "_at_", [aString]), "_scope_", [self]);
  157. return self;}
  158. }),
  159. smalltalk.MethodLexicalScope);
  160. smalltalk.addMethod(
  161. "_allVariableNames",
  162. smalltalk.method({
  163. selector: "allVariableNames",
  164. fn: function () {
  165. var self=this;
  166. return smalltalk.send(smalltalk.send(self, "_allVariableNames", [], smalltalk.MethodLexicalScope.superclass || nil), "__comma", [smalltalk.send(smalltalk.send(self, "_iVars", []), "_keys", [])]);
  167. return self;}
  168. }),
  169. smalltalk.MethodLexicalScope);
  170. smalltalk.addMethod(
  171. "_bindingFor_",
  172. smalltalk.method({
  173. selector: "bindingFor:",
  174. fn: function (aNode) {
  175. var self=this;
  176. return (($receiver = smalltalk.send(self, "_bindingFor_", [aNode], smalltalk.MethodLexicalScope.superclass || nil)) == nil || $receiver == undefined) ? (function(){return smalltalk.send(smalltalk.send(self, "_iVars", []), "_at_ifAbsent_", [smalltalk.send(aNode, "_value", []), (function(){return nil;})]);})() : $receiver;
  177. return self;}
  178. }),
  179. smalltalk.MethodLexicalScope);
  180. smalltalk.addMethod(
  181. "_hasNonLocalReturn",
  182. smalltalk.method({
  183. selector: "hasNonLocalReturn",
  184. fn: function () {
  185. var self=this;
  186. return smalltalk.send(self, "_nonLocalReturn", []);
  187. return self;}
  188. }),
  189. smalltalk.MethodLexicalScope);
  190. smalltalk.addMethod(
  191. "_iVars",
  192. smalltalk.method({
  193. selector: "iVars",
  194. fn: function () {
  195. var self=this;
  196. return (($receiver = self['@iVars']) == nil || $receiver == undefined) ? (function(){return (self['@iVars']=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));})() : $receiver;
  197. return self;}
  198. }),
  199. smalltalk.MethodLexicalScope);
  200. smalltalk.addMethod(
  201. "_isMethodScope",
  202. smalltalk.method({
  203. selector: "isMethodScope",
  204. fn: function () {
  205. var self=this;
  206. return true;
  207. return self;}
  208. }),
  209. smalltalk.MethodLexicalScope);
  210. smalltalk.addMethod(
  211. "_methodScope",
  212. smalltalk.method({
  213. selector: "methodScope",
  214. fn: function () {
  215. var self=this;
  216. return self;
  217. return self;}
  218. }),
  219. smalltalk.MethodLexicalScope);
  220. smalltalk.addMethod(
  221. "_nonLocalReturn",
  222. smalltalk.method({
  223. selector: "nonLocalReturn",
  224. fn: function () {
  225. var self=this;
  226. return (($receiver = self['@nonLocalReturn']) == nil || $receiver == undefined) ? (function(){return false;})() : $receiver;
  227. return self;}
  228. }),
  229. smalltalk.MethodLexicalScope);
  230. smalltalk.addMethod(
  231. "_nonLocalReturn_",
  232. smalltalk.method({
  233. selector: "nonLocalReturn:",
  234. fn: function (aBoolean) {
  235. var self=this;
  236. (self['@nonLocalReturn']=aBoolean);
  237. return self;}
  238. }),
  239. smalltalk.MethodLexicalScope);
  240. smalltalk.addMethod(
  241. "_unknownVariables",
  242. smalltalk.method({
  243. selector: "unknownVariables",
  244. fn: function () {
  245. var self=this;
  246. return (($receiver = self['@unknownVariables']) == nil || $receiver == undefined) ? (function(){return (self['@unknownVariables']=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection), "_new", []));})() : $receiver;
  247. return self;}
  248. }),
  249. smalltalk.MethodLexicalScope);
  250. smalltalk.addClass('ScopeVar', smalltalk.Object, ['scope', 'name'], 'Compiler-Semantic');
  251. smalltalk.addMethod(
  252. "_alias",
  253. smalltalk.method({
  254. selector: "alias",
  255. fn: function () {
  256. var self=this;
  257. return smalltalk.send(smalltalk.send(self, "_name", []), "_asVariableName", []);
  258. return self;}
  259. }),
  260. smalltalk.ScopeVar);
  261. smalltalk.addMethod(
  262. "_isArgVar",
  263. smalltalk.method({
  264. selector: "isArgVar",
  265. fn: function () {
  266. var self=this;
  267. return false;
  268. return self;}
  269. }),
  270. smalltalk.ScopeVar);
  271. smalltalk.addMethod(
  272. "_isInstanceVar",
  273. smalltalk.method({
  274. selector: "isInstanceVar",
  275. fn: function () {
  276. var self=this;
  277. return false;
  278. return self;}
  279. }),
  280. smalltalk.ScopeVar);
  281. smalltalk.addMethod(
  282. "_isTempVar",
  283. smalltalk.method({
  284. selector: "isTempVar",
  285. fn: function () {
  286. var self=this;
  287. return false;
  288. return self;}
  289. }),
  290. smalltalk.ScopeVar);
  291. smalltalk.addMethod(
  292. "_isUnknownVar",
  293. smalltalk.method({
  294. selector: "isUnknownVar",
  295. fn: function () {
  296. var self=this;
  297. return false;
  298. return self;}
  299. }),
  300. smalltalk.ScopeVar);
  301. smalltalk.addMethod(
  302. "_name",
  303. smalltalk.method({
  304. selector: "name",
  305. fn: function () {
  306. var self=this;
  307. return self['@name'];
  308. return self;}
  309. }),
  310. smalltalk.ScopeVar);
  311. smalltalk.addMethod(
  312. "_name_",
  313. smalltalk.method({
  314. selector: "name:",
  315. fn: function (aString) {
  316. var self=this;
  317. (self['@name']=aString);
  318. return self;}
  319. }),
  320. smalltalk.ScopeVar);
  321. smalltalk.addMethod(
  322. "_scope",
  323. smalltalk.method({
  324. selector: "scope",
  325. fn: function () {
  326. var self=this;
  327. return self['@scope'];
  328. return self;}
  329. }),
  330. smalltalk.ScopeVar);
  331. smalltalk.addMethod(
  332. "_scope_",
  333. smalltalk.method({
  334. selector: "scope:",
  335. fn: function (aScope) {
  336. var self=this;
  337. (self['@scope']=aScope);
  338. return self;}
  339. }),
  340. smalltalk.ScopeVar);
  341. smalltalk.addMethod(
  342. "_on_",
  343. smalltalk.method({
  344. selector: "on:",
  345. fn: function (aString) {
  346. var self=this;
  347. return (function($rec){smalltalk.send($rec, "_name_", [aString]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  348. return self;}
  349. }),
  350. smalltalk.ScopeVar.klass);
  351. smalltalk.addClass('AliasVar', smalltalk.ScopeVar, ['node'], 'Compiler-Semantic');
  352. smalltalk.addMethod(
  353. "_node",
  354. smalltalk.method({
  355. selector: "node",
  356. fn: function () {
  357. var self=this;
  358. return self['@node'];
  359. return self;}
  360. }),
  361. smalltalk.AliasVar);
  362. smalltalk.addMethod(
  363. "_node_",
  364. smalltalk.method({
  365. selector: "node:",
  366. fn: function (aNode) {
  367. var self=this;
  368. (self['@node']=aNode);
  369. return self;}
  370. }),
  371. smalltalk.AliasVar);
  372. smalltalk.addClass('ArgVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  373. smalltalk.addMethod(
  374. "_isArgVar",
  375. smalltalk.method({
  376. selector: "isArgVar",
  377. fn: function () {
  378. var self=this;
  379. return true;
  380. return self;}
  381. }),
  382. smalltalk.ArgVar);
  383. smalltalk.addClass('ClassRefVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  384. smalltalk.addMethod(
  385. "_alias",
  386. smalltalk.method({
  387. selector: "alias",
  388. fn: function () {
  389. var self=this;
  390. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(Smalltalk.", "__comma", [smalltalk.send(self, "_name", [])]), "__comma", [" || "]), "__comma", [smalltalk.send(self, "_name", [])]), "__comma", [")"]);
  391. return self;}
  392. }),
  393. smalltalk.ClassRefVar);
  394. smalltalk.addClass('InstanceVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  395. smalltalk.addMethod(
  396. "_alias",
  397. smalltalk.method({
  398. selector: "alias",
  399. fn: function () {
  400. var self=this;
  401. return smalltalk.send(smalltalk.send("self[\x22@", "__comma", [smalltalk.send(self, "_name", [])]), "__comma", ["]"]);
  402. return self;}
  403. }),
  404. smalltalk.InstanceVar);
  405. smalltalk.addMethod(
  406. "_isInstanceVar",
  407. smalltalk.method({
  408. selector: "isInstanceVar",
  409. fn: function () {
  410. var self=this;
  411. return true;
  412. return self;}
  413. }),
  414. smalltalk.InstanceVar);
  415. smalltalk.addClass('TempVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  416. smalltalk.addMethod(
  417. "_isTempVar",
  418. smalltalk.method({
  419. selector: "isTempVar",
  420. fn: function () {
  421. var self=this;
  422. return true;
  423. return self;}
  424. }),
  425. smalltalk.TempVar);
  426. smalltalk.addClass('UnknownVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  427. smalltalk.addMethod(
  428. "_isUnknownVar",
  429. smalltalk.method({
  430. selector: "isUnknownVar",
  431. fn: function () {
  432. var self=this;
  433. return true;
  434. return self;}
  435. }),
  436. smalltalk.UnknownVar);
  437. smalltalk.addClass('SemanticAnalyzer', smalltalk.NodeVisitor, ['currentScope', 'theClass', 'classReferences', 'messageSends'], 'Compiler-Semantic');
  438. smalltalk.addMethod(
  439. "_allowUnknownVariables",
  440. smalltalk.method({
  441. selector: "allowUnknownVariables",
  442. fn: function () {
  443. var self=this;
  444. return true;
  445. return self;}
  446. }),
  447. smalltalk.SemanticAnalyzer);
  448. smalltalk.addMethod(
  449. "_classReferences",
  450. smalltalk.method({
  451. selector: "classReferences",
  452. fn: function () {
  453. var self=this;
  454. return (($receiver = self['@classReferences']) == nil || $receiver == undefined) ? (function(){return (self['@classReferences']=smalltalk.send((smalltalk.Set || Set), "_new", []));})() : $receiver;
  455. return self;}
  456. }),
  457. smalltalk.SemanticAnalyzer);
  458. smalltalk.addMethod(
  459. "_errorInvalidAssignment_",
  460. smalltalk.method({
  461. selector: "errorInvalidAssignment:",
  462. fn: function (aString) {
  463. var self=this;
  464. (function($rec){smalltalk.send($rec, "_variableName_", [aString]);return smalltalk.send($rec, "_signal", []);})(smalltalk.send((smalltalk.InvalidAssignmentError || InvalidAssignmentError), "_new", []));
  465. return self;}
  466. }),
  467. smalltalk.SemanticAnalyzer);
  468. smalltalk.addMethod(
  469. "_errorShadowingVariable_",
  470. smalltalk.method({
  471. selector: "errorShadowingVariable:",
  472. fn: function (aString) {
  473. var self=this;
  474. (function($rec){smalltalk.send($rec, "_variableName_", [aString]);return smalltalk.send($rec, "_signal", []);})(smalltalk.send((smalltalk.ShadowingVariableError || ShadowingVariableError), "_new", []));
  475. return self;}
  476. }),
  477. smalltalk.SemanticAnalyzer);
  478. smalltalk.addMethod(
  479. "_errorUnknownVariable_",
  480. smalltalk.method({
  481. selector: "errorUnknownVariable:",
  482. fn: function (aNode) {
  483. var self=this;
  484. ((($receiver = smalltalk.send(self, "_allowUnknownVariables", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_unknownVariables", []), "_add_", [smalltalk.send(aNode, "_value", [])]);})() : (function(){return (function($rec){smalltalk.send($rec, "_variableName_", [smalltalk.send(aNode, "_value", [])]);return smalltalk.send($rec, "_signal", []);})(smalltalk.send((smalltalk.UnknownVariableError || UnknownVariableError), "_new", []));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_unknownVariables", []), "_add_", [smalltalk.send(aNode, "_value", [])]);}), (function(){return (function($rec){smalltalk.send($rec, "_variableName_", [smalltalk.send(aNode, "_value", [])]);return smalltalk.send($rec, "_signal", []);})(smalltalk.send((smalltalk.UnknownVariableError || UnknownVariableError), "_new", []));})]));
  485. return self;}
  486. }),
  487. smalltalk.SemanticAnalyzer);
  488. smalltalk.addMethod(
  489. "_messageSends",
  490. smalltalk.method({
  491. selector: "messageSends",
  492. fn: function () {
  493. var self=this;
  494. return (($receiver = self['@messageSends']) == nil || $receiver == undefined) ? (function(){return (self['@messageSends']=smalltalk.send((smalltalk.Set || Set), "_new", []));})() : $receiver;
  495. return self;}
  496. }),
  497. smalltalk.SemanticAnalyzer);
  498. smalltalk.addMethod(
  499. "_newBlockScope",
  500. smalltalk.method({
  501. selector: "newBlockScope",
  502. fn: function () {
  503. var self=this;
  504. return smalltalk.send(self, "_newScopeOfClass_", [(smalltalk.LexicalScope || LexicalScope)]);
  505. return self;}
  506. }),
  507. smalltalk.SemanticAnalyzer);
  508. smalltalk.addMethod(
  509. "_newMethodScope",
  510. smalltalk.method({
  511. selector: "newMethodScope",
  512. fn: function () {
  513. var self=this;
  514. return smalltalk.send(self, "_newScopeOfClass_", [(smalltalk.MethodLexicalScope || MethodLexicalScope)]);
  515. return self;}
  516. }),
  517. smalltalk.SemanticAnalyzer);
  518. smalltalk.addMethod(
  519. "_newScopeOfClass_",
  520. smalltalk.method({
  521. selector: "newScopeOfClass:",
  522. fn: function (aLexicalScopeClass) {
  523. var self=this;
  524. return (function($rec){smalltalk.send($rec, "_outerScope_", [self['@currentScope']]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(aLexicalScopeClass, "_new", []));
  525. return self;}
  526. }),
  527. smalltalk.SemanticAnalyzer);
  528. smalltalk.addMethod(
  529. "_popScope",
  530. smalltalk.method({
  531. selector: "popScope",
  532. fn: function () {
  533. var self=this;
  534. (($receiver = self['@currentScope']) != nil && $receiver != undefined) ? (function(){return (self['@currentScope']=smalltalk.send(self['@currentScope'], "_outerScope", []));})() : nil;
  535. return self;}
  536. }),
  537. smalltalk.SemanticAnalyzer);
  538. smalltalk.addMethod(
  539. "_pseudoVariables",
  540. smalltalk.method({
  541. selector: "pseudoVariables",
  542. fn: function () {
  543. var self=this;
  544. return ["self", "super", "true", "false", "nil", "thisContext"];
  545. return self;}
  546. }),
  547. smalltalk.SemanticAnalyzer);
  548. smalltalk.addMethod(
  549. "_pushScope_",
  550. smalltalk.method({
  551. selector: "pushScope:",
  552. fn: function (aScope) {
  553. var self=this;
  554. smalltalk.send(aScope, "_outerScope_", [self['@currentScope']]);
  555. (self['@currentScope']=aScope);
  556. return self;}
  557. }),
  558. smalltalk.SemanticAnalyzer);
  559. smalltalk.addMethod(
  560. "_theClass",
  561. smalltalk.method({
  562. selector: "theClass",
  563. fn: function () {
  564. var self=this;
  565. return self['@theClass'];
  566. return self;}
  567. }),
  568. smalltalk.SemanticAnalyzer);
  569. smalltalk.addMethod(
  570. "_theClass_",
  571. smalltalk.method({
  572. selector: "theClass:",
  573. fn: function (aClass) {
  574. var self=this;
  575. (self['@theClass']=aClass);
  576. return self;}
  577. }),
  578. smalltalk.SemanticAnalyzer);
  579. smalltalk.addMethod(
  580. "_validateVariableScope_",
  581. smalltalk.method({
  582. selector: "validateVariableScope:",
  583. fn: function (aString) {
  584. var self=this;
  585. (($receiver = smalltalk.send(self['@currentScope'], "_lookupVariable_", [aString])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self, "_errorShadowingVariable_", [aString]);})() : nil;
  586. return self;}
  587. }),
  588. smalltalk.SemanticAnalyzer);
  589. smalltalk.addMethod(
  590. "_visitAssignmentNode_",
  591. smalltalk.method({
  592. selector: "visitAssignmentNode:",
  593. fn: function (aNode) {
  594. var self=this;
  595. smalltalk.send(self, "_visitAssignmentNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
  596. ((($receiver = smalltalk.send(smalltalk.send(self, "_pseudoVariables", []), "_includes_", [smalltalk.send(smalltalk.send(aNode, "_left", []), "_value", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_errorInvalidAssignment_", [smalltalk.send(smalltalk.send(aNode, "_left", []), "_value", [])]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self, "_errorInvalidAssignment_", [smalltalk.send(smalltalk.send(aNode, "_left", []), "_value", [])]);})]));
  597. ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_left", []), "_binding", []), "_isArgVar", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_errorInvalidAssignment_", [smalltalk.send(smalltalk.send(aNode, "_left", []), "_value", [])]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self, "_errorInvalidAssignment_", [smalltalk.send(smalltalk.send(aNode, "_left", []), "_value", [])]);})]));
  598. smalltalk.send(smalltalk.send(aNode, "_left", []), "_beAssigned", []);
  599. smalltalk.send(smalltalk.send(aNode, "_right", []), "_beUsed", []);
  600. return self;}
  601. }),
  602. smalltalk.SemanticAnalyzer);
  603. smalltalk.addMethod(
  604. "_visitBlockNode_",
  605. smalltalk.method({
  606. selector: "visitBlockNode:",
  607. fn: function (aNode) {
  608. var self=this;
  609. smalltalk.send(self, "_pushScope_", [smalltalk.send(self, "_newBlockScope", [])]);
  610. smalltalk.send(aNode, "_scope_", [self['@currentScope']]);
  611. smalltalk.send(smalltalk.send(aNode, "_parameters", []), "_do_", [(function(each){smalltalk.send(self, "_validateVariableScope_", [each]);return smalltalk.send(self['@currentScope'], "_addArg_", [each]);})]);
  612. smalltalk.send(self, "_visitBlockNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
  613. smalltalk.send(self, "_popScope", []);
  614. return self;}
  615. }),
  616. smalltalk.SemanticAnalyzer);
  617. smalltalk.addMethod(
  618. "_visitCascadeNode_",
  619. smalltalk.method({
  620. selector: "visitCascadeNode:",
  621. fn: function (aNode) {
  622. var self=this;
  623. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(each, "_receiver_", [smalltalk.send(aNode, "_receiver", [])]);})]);
  624. smalltalk.send(self, "_visitCascadeNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
  625. return self;}
  626. }),
  627. smalltalk.SemanticAnalyzer);
  628. smalltalk.addMethod(
  629. "_visitClassReferenceNode_",
  630. smalltalk.method({
  631. selector: "visitClassReferenceNode:",
  632. fn: function (aNode) {
  633. var self=this;
  634. smalltalk.send(smalltalk.send(self, "_classReferences", []), "_add_", [smalltalk.send(aNode, "_value", [])]);
  635. smalltalk.send(aNode, "_binding_", [(function($rec){smalltalk.send($rec, "_name_", [smalltalk.send(aNode, "_value", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.ClassRefVar || ClassRefVar), "_new", []))]);
  636. return self;}
  637. }),
  638. smalltalk.SemanticAnalyzer);
  639. smalltalk.addMethod(
  640. "_visitMethodNode_",
  641. smalltalk.method({
  642. selector: "visitMethodNode:",
  643. fn: function (aNode) {
  644. var self=this;
  645. smalltalk.send(self, "_pushScope_", [smalltalk.send(self, "_newMethodScope", [])]);
  646. smalltalk.send(aNode, "_scope_", [self['@currentScope']]);
  647. smalltalk.send(smalltalk.send(smalltalk.send(self, "_theClass", []), "_allInstanceVariableNames", []), "_do_", [(function(each){return smalltalk.send(self['@currentScope'], "_addIVar_", [each]);})]);
  648. smalltalk.send(smalltalk.send(aNode, "_arguments", []), "_do_", [(function(each){smalltalk.send(self, "_validateVariableScope_", [each]);return smalltalk.send(self['@currentScope'], "_addArg_", [each]);})]);
  649. smalltalk.send(self, "_visitMethodNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
  650. (function($rec){smalltalk.send($rec, "_classReferences_", [smalltalk.send(self, "_classReferences", [])]);return smalltalk.send($rec, "_messageSends_", [smalltalk.send(self, "_messageSends", [])]);})(aNode);
  651. smalltalk.send(self, "_popScope", []);
  652. return self;}
  653. }),
  654. smalltalk.SemanticAnalyzer);
  655. smalltalk.addMethod(
  656. "_visitReturnNode_",
  657. smalltalk.method({
  658. selector: "visitReturnNode:",
  659. fn: function (aNode) {
  660. var self=this;
  661. ((($receiver = smalltalk.send(self['@currentScope'], "_isMethodScope", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_nonLocalReturn_", [true]);return smalltalk.send(aNode, "_nonLocalReturn_", [true]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_nonLocalReturn_", [true]);return smalltalk.send(aNode, "_nonLocalReturn_", [true]);})]));
  662. smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_first", []), "_beUsed", []);
  663. smalltalk.send(self, "_visitReturnNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
  664. return self;}
  665. }),
  666. smalltalk.SemanticAnalyzer);
  667. smalltalk.addMethod(
  668. "_visitSendNode_",
  669. smalltalk.method({
  670. selector: "visitSendNode:",
  671. fn: function (aNode) {
  672. var self=this;
  673. ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_value", []), "__eq", ["super"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(aNode, "_superSend_", [true]);return smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_value_", ["self"]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(aNode, "_superSend_", [true]);return smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_value_", ["self"]);})]));
  674. smalltalk.send(smalltalk.send(self, "_messageSends", []), "_add_", [smalltalk.send(aNode, "_selector", [])]);
  675. (($receiver = smalltalk.send(aNode, "_receiver", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_beUsed", []);})() : nil;
  676. smalltalk.send(smalltalk.send(aNode, "_arguments", []), "_do_", [(function(each){return smalltalk.send(each, "_beUsed", []);})]);
  677. smalltalk.send(self, "_visitSendNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
  678. return self;}
  679. }),
  680. smalltalk.SemanticAnalyzer);
  681. smalltalk.addMethod(
  682. "_visitSequenceNode_",
  683. smalltalk.method({
  684. selector: "visitSequenceNode:",
  685. fn: function (aNode) {
  686. var self=this;
  687. smalltalk.send(smalltalk.send(aNode, "_temps", []), "_do_", [(function(each){smalltalk.send(self, "_validateVariableScope_", [each]);return smalltalk.send(self['@currentScope'], "_addTemp_", [each]);})]);
  688. smalltalk.send(self, "_visitSequenceNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
  689. return self;}
  690. }),
  691. smalltalk.SemanticAnalyzer);
  692. smalltalk.addMethod(
  693. "_visitVariableNode_",
  694. smalltalk.method({
  695. selector: "visitVariableNode:",
  696. fn: function (aNode) {
  697. var self=this;
  698. smalltalk.send(aNode, "_binding_", [(($receiver = smalltalk.send(self['@currentScope'], "_lookupVariable_", [aNode])) == nil || $receiver == undefined) ? (function(){smalltalk.send(self, "_errorUnknownVariable_", [aNode]);return (function($rec){smalltalk.send($rec, "_name_", [smalltalk.send(aNode, "_value", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.UnknownVar || UnknownVar), "_new", []));})() : $receiver]);
  699. return self;}
  700. }),
  701. smalltalk.SemanticAnalyzer);
  702. smalltalk.addMethod(
  703. "_on_",
  704. smalltalk.method({
  705. selector: "on:",
  706. fn: function (aClass) {
  707. var self=this;
  708. return (function($rec){smalltalk.send($rec, "_theClass_", [aClass]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  709. return self;}
  710. }),
  711. smalltalk.SemanticAnalyzer.klass);