Compiler-Semantic.deploy.js 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005
  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. 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, "_pseudoVars", []), "_at_ifAbsent_", [smalltalk.send(aStringOrNode, "_value", []), (function(){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. "_canInlineNonLocalReturns",
  57. smalltalk.method({
  58. selector: "canInlineNonLocalReturns",
  59. fn: function () {
  60. var self=this;
  61. return smalltalk.send(smalltalk.send(self, "_isInlined", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(self, "_outerScope", []), "_canInlineNonLocalReturns", []);})]);
  62. return self;}
  63. }),
  64. smalltalk.LexicalScope);
  65. smalltalk.addMethod(
  66. "_instruction",
  67. smalltalk.method({
  68. selector: "instruction",
  69. fn: function () {
  70. var self=this;
  71. return self['@instruction'];
  72. return self;}
  73. }),
  74. smalltalk.LexicalScope);
  75. smalltalk.addMethod(
  76. "_instruction_",
  77. smalltalk.method({
  78. selector: "instruction:",
  79. fn: function (anIRInstruction) {
  80. var self=this;
  81. (self['@instruction']=anIRInstruction);
  82. return self;}
  83. }),
  84. smalltalk.LexicalScope);
  85. smalltalk.addMethod(
  86. "_isBlockScope",
  87. smalltalk.method({
  88. selector: "isBlockScope",
  89. fn: function (){
  90. var self=this;
  91. return smalltalk.send(smalltalk.send(self, "_isMethodScope", []), "_not", []);
  92. return self;}
  93. }),
  94. smalltalk.LexicalScope);
  95. smalltalk.addMethod(
  96. "_isInlined",
  97. smalltalk.method({
  98. selector: "isInlined",
  99. fn: function () {
  100. var self=this;
  101. return smalltalk.send(smalltalk.send(self, "_instruction", []), "_isInlined", []);
  102. return self;}
  103. }),
  104. smalltalk.LexicalScope);
  105. smalltalk.addMethod(
  106. "_isMethodScope",
  107. smalltalk.method({
  108. selector: "isMethodScope",
  109. fn: function () {
  110. var self=this;
  111. return false;
  112. return self;}
  113. }),
  114. smalltalk.LexicalScope);
  115. smalltalk.addMethod(
  116. "_lookupVariable_",
  117. smalltalk.method({
  118. selector: "lookupVariable:",
  119. fn: function (aNode) {
  120. var self=this;
  121. var lookup=nil;
  122. (lookup=smalltalk.send(self, "_bindingFor_", [aNode]));
  123. (($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;
  124. return lookup;
  125. return self;}
  126. }),
  127. smalltalk.LexicalScope);
  128. smalltalk.addMethod(
  129. "_methodScope",
  130. smalltalk.method({
  131. selector: "methodScope",
  132. fn: function () {
  133. var self=this;
  134. return (($receiver = smalltalk.send(self, "_outerScope", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(smalltalk.send(self, "_outerScope", []), "_methodScope", []);})() : nil;
  135. return self;}
  136. }),
  137. smalltalk.LexicalScope);
  138. smalltalk.addMethod(
  139. "_node",
  140. smalltalk.method({
  141. selector: "node",
  142. fn: function () {
  143. var self=this;
  144. return self['@node'];
  145. return self;}
  146. }),
  147. smalltalk.LexicalScope);
  148. smalltalk.addMethod(
  149. "_node_",
  150. smalltalk.method({
  151. selector: "node:",
  152. fn: function (aNode) {
  153. var self=this;
  154. (self['@node']=aNode);
  155. return self;}
  156. }),
  157. smalltalk.LexicalScope);
  158. smalltalk.addMethod(
  159. "_outerScope",
  160. smalltalk.method({
  161. selector: "outerScope",
  162. fn: function () {
  163. var self=this;
  164. return self['@outerScope'];
  165. return self;}
  166. }),
  167. smalltalk.LexicalScope);
  168. smalltalk.addMethod(
  169. "_outerScope_",
  170. smalltalk.method({
  171. selector: "outerScope:",
  172. fn: function (aLexicalScope) {
  173. var self=this;
  174. (self['@outerScope']=aLexicalScope);
  175. return self;}
  176. }),
  177. smalltalk.LexicalScope);
  178. smalltalk.addMethod(
  179. "_pseudoVars",
  180. smalltalk.method({
  181. selector: "pseudoVars",
  182. fn: function () {
  183. var self=this;
  184. return smalltalk.send(smalltalk.send(self, "_methodScope", []), "_pseudoVars", []);
  185. return self;}
  186. }),
  187. smalltalk.LexicalScope);
  188. smalltalk.addMethod(
  189. "_scopeLevel",
  190. smalltalk.method({
  191. selector: "scopeLevel",
  192. fn: function () {
  193. var self=this;
  194. 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)]));
  195. return self;}
  196. }),
  197. smalltalk.LexicalScope);
  198. smalltalk.addMethod(
  199. "_temps",
  200. smalltalk.method({
  201. selector: "temps",
  202. fn: function () {
  203. var self=this;
  204. return (($receiver = self['@temps']) == nil || $receiver == undefined) ? (function(){return (self['@temps']=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));})() : $receiver;
  205. return self;}
  206. }),
  207. smalltalk.LexicalScope);
  208. smalltalk.addClass('MethodLexicalScope', smalltalk.LexicalScope, ['iVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  209. smalltalk.addMethod(
  210. "_addIVar_",
  211. smalltalk.method({
  212. selector: "addIVar:",
  213. fn: function (aString) {
  214. var self=this;
  215. smalltalk.send(smalltalk.send(self, "_iVars", []), "_at_put_", [aString, smalltalk.send((smalltalk.InstanceVar || InstanceVar), "_on_", [aString])]);
  216. smalltalk.send(smalltalk.send(smalltalk.send(self, "_iVars", []), "_at_", [aString]), "_scope_", [self]);
  217. return self;}
  218. }),
  219. smalltalk.MethodLexicalScope);
  220. smalltalk.addMethod(
  221. "_addNonLocalReturn_",
  222. smalltalk.method({
  223. selector: "addNonLocalReturn:",
  224. fn: function (aScope) {
  225. var self=this;
  226. smalltalk.send(smalltalk.send(self, "_nonLocalReturns", []), "_add_", [aScope]);
  227. return self;}
  228. }),
  229. smalltalk.MethodLexicalScope);
  230. smalltalk.addMethod(
  231. "_allVariableNames",
  232. smalltalk.method({
  233. selector: "allVariableNames",
  234. fn: function () {
  235. var self=this;
  236. return smalltalk.send(smalltalk.send(self, "_allVariableNames", [], smalltalk.MethodLexicalScope.superclass || nil), "__comma", [smalltalk.send(smalltalk.send(self, "_iVars", []), "_keys", [])]);
  237. return self;}
  238. }),
  239. smalltalk.MethodLexicalScope);
  240. smalltalk.addMethod(
  241. "_bindingFor_",
  242. smalltalk.method({
  243. selector: "bindingFor:",
  244. fn: function (aNode) {
  245. var self=this;
  246. 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;
  247. return self;}
  248. }),
  249. smalltalk.MethodLexicalScope);
  250. smalltalk.addMethod(
  251. "_canInlineNonLocalReturns",
  252. smalltalk.method({
  253. selector: "canInlineNonLocalReturns",
  254. fn: function () {
  255. var self=this;
  256. return true;
  257. return self;}
  258. }),
  259. smalltalk.MethodLexicalScope);
  260. smalltalk.addMethod(
  261. "_hasLocalReturn",
  262. smalltalk.method({
  263. selector: "hasLocalReturn",
  264. fn: function () {
  265. var self=this;
  266. return smalltalk.send(self, "_localReturn", []);
  267. return self;}
  268. }),
  269. smalltalk.MethodLexicalScope);
  270. smalltalk.addMethod(
  271. "_hasNonLocalReturn",
  272. smalltalk.method({
  273. selector: "hasNonLocalReturn",
  274. fn: function () {
  275. var self=this;
  276. return smalltalk.send(smalltalk.send(self, "_nonLocalReturns", []), "_notEmpty", []);
  277. return self;}
  278. }),
  279. smalltalk.MethodLexicalScope);
  280. smalltalk.addMethod(
  281. "_iVars",
  282. smalltalk.method({
  283. selector: "iVars",
  284. fn: function () {
  285. var self=this;
  286. return (($receiver = self['@iVars']) == nil || $receiver == undefined) ? (function(){return (self['@iVars']=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));})() : $receiver;
  287. return self;}
  288. }),
  289. smalltalk.MethodLexicalScope);
  290. smalltalk.addMethod(
  291. "_isMethodScope",
  292. smalltalk.method({
  293. selector: "isMethodScope",
  294. fn: function () {
  295. var self=this;
  296. return true;
  297. return self;}
  298. }),
  299. smalltalk.MethodLexicalScope);
  300. smalltalk.addMethod(
  301. "_localReturn",
  302. smalltalk.method({
  303. selector: "localReturn",
  304. fn: function () {
  305. var self=this;
  306. return (($receiver = self['@localReturn']) == nil || $receiver == undefined) ? (function(){return false;})() : $receiver;
  307. return self;}
  308. }),
  309. smalltalk.MethodLexicalScope);
  310. smalltalk.addMethod(
  311. "_localReturn_",
  312. smalltalk.method({
  313. selector: "localReturn:",
  314. fn: function (aBoolean) {
  315. var self=this;
  316. (self['@localReturn']=aBoolean);
  317. return self;}
  318. }),
  319. smalltalk.MethodLexicalScope);
  320. smalltalk.addMethod(
  321. "_methodScope",
  322. smalltalk.method({
  323. selector: "methodScope",
  324. fn: function () {
  325. var self=this;
  326. return self;
  327. return self;}
  328. }),
  329. smalltalk.MethodLexicalScope);
  330. smalltalk.addMethod(
  331. "_nonLocalReturns",
  332. smalltalk.method({
  333. selector: "nonLocalReturns",
  334. fn: function () {
  335. var self=this;
  336. return (($receiver = self['@nonLocalReturns']) == nil || $receiver == undefined) ? (function(){return (self['@nonLocalReturns']=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection), "_new", []));})() : $receiver;
  337. return self;}
  338. }),
  339. smalltalk.MethodLexicalScope);
  340. smalltalk.addMethod(
  341. "_pseudoVars",
  342. smalltalk.method({
  343. selector: "pseudoVars",
  344. fn: function () {
  345. var self=this;
  346. (($receiver = (typeof pseudoVars == 'undefined' ? nil : pseudoVars)) == nil || $receiver == undefined) ? (function(){(pseudoVars=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));return smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_pseudoVariableNames", []), "_do_", [(function(each){return smalltalk.send((typeof pseudoVars == 'undefined' ? nil : pseudoVars), "_at_put_", [each, (function($rec){smalltalk.send($rec, "_scope_", [smalltalk.send(self, "_methodScope", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.PseudoVar || PseudoVar), "_on_", [each]))]);})]);})() : $receiver;
  347. return (typeof pseudoVars == 'undefined' ? nil : pseudoVars);
  348. return self;}
  349. }),
  350. smalltalk.MethodLexicalScope);
  351. smalltalk.addMethod(
  352. "_removeNonLocalReturn_",
  353. smalltalk.method({
  354. selector: "removeNonLocalReturn:",
  355. fn: function (aScope) {
  356. var self=this;
  357. smalltalk.send(smalltalk.send(self, "_nonLocalReturns", []), "_remove_ifAbsent_", [aScope, (function(){return nil;})]);
  358. return self;}
  359. }),
  360. smalltalk.MethodLexicalScope);
  361. smalltalk.addMethod(
  362. "_unknownVariables",
  363. smalltalk.method({
  364. selector: "unknownVariables",
  365. fn: function () {
  366. var self=this;
  367. return (($receiver = self['@unknownVariables']) == nil || $receiver == undefined) ? (function(){return (self['@unknownVariables']=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection), "_new", []));})() : $receiver;
  368. return self;}
  369. }),
  370. smalltalk.MethodLexicalScope);
  371. smalltalk.addClass('ScopeVar', smalltalk.Object, ['scope', 'name'], 'Compiler-Semantic');
  372. smalltalk.addMethod(
  373. "_alias",
  374. smalltalk.method({
  375. selector: "alias",
  376. fn: function () {
  377. var self=this;
  378. return smalltalk.send(smalltalk.send(self, "_name", []), "_asVariableName", []);
  379. return self;}
  380. }),
  381. smalltalk.ScopeVar);
  382. smalltalk.addMethod(
  383. "_isArgVar",
  384. smalltalk.method({
  385. selector: "isArgVar",
  386. fn: function () {
  387. var self=this;
  388. return false;
  389. return self;}
  390. }),
  391. smalltalk.ScopeVar);
  392. smalltalk.addMethod(
  393. "_isClassRefVar",
  394. smalltalk.method({
  395. selector: "isClassRefVar",
  396. fn: function () {
  397. var self=this;
  398. return false;
  399. return self;}
  400. }),
  401. smalltalk.ScopeVar);
  402. smalltalk.addMethod(
  403. "_isInstanceVar",
  404. smalltalk.method({
  405. selector: "isInstanceVar",
  406. fn: function () {
  407. var self=this;
  408. return false;
  409. return self;}
  410. }),
  411. smalltalk.ScopeVar);
  412. smalltalk.addMethod(
  413. "_isPseudoVar",
  414. smalltalk.method({
  415. selector: "isPseudoVar",
  416. fn: function () {
  417. var self=this;
  418. return false;
  419. return self;}
  420. }),
  421. smalltalk.ScopeVar);
  422. smalltalk.addMethod(
  423. "_isTempVar",
  424. smalltalk.method({
  425. selector: "isTempVar",
  426. fn: function () {
  427. var self=this;
  428. return false;
  429. return self;}
  430. }),
  431. smalltalk.ScopeVar);
  432. smalltalk.addMethod(
  433. "_isUnknownVar",
  434. smalltalk.method({
  435. selector: "isUnknownVar",
  436. fn: function () {
  437. var self=this;
  438. return false;
  439. return self;}
  440. }),
  441. smalltalk.ScopeVar);
  442. smalltalk.addMethod(
  443. "_name",
  444. smalltalk.method({
  445. selector: "name",
  446. fn: function () {
  447. var self=this;
  448. return self['@name'];
  449. return self;}
  450. }),
  451. smalltalk.ScopeVar);
  452. smalltalk.addMethod(
  453. "_name_",
  454. smalltalk.method({
  455. selector: "name:",
  456. fn: function (aString) {
  457. var self=this;
  458. (self['@name']=aString);
  459. return self;}
  460. }),
  461. smalltalk.ScopeVar);
  462. smalltalk.addMethod(
  463. "_scope",
  464. smalltalk.method({
  465. selector: "scope",
  466. fn: function () {
  467. var self=this;
  468. return self['@scope'];
  469. return self;}
  470. }),
  471. smalltalk.ScopeVar);
  472. smalltalk.addMethod(
  473. "_scope_",
  474. smalltalk.method({
  475. selector: "scope:",
  476. fn: function (aScope) {
  477. var self=this;
  478. (self['@scope']=aScope);
  479. return self;}
  480. }),
  481. smalltalk.ScopeVar);
  482. smalltalk.addMethod(
  483. "_validateAssignment",
  484. smalltalk.method({
  485. selector: "validateAssignment",
  486. fn: function () {
  487. var self=this;
  488. ((($receiver = smalltalk.send(smalltalk.send(self, "_isArgVar", []), "_or_", [(function(){return smalltalk.send(self, "_isPseudoVar", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function($rec){smalltalk.send($rec, "_variableName_", [smalltalk.send(self, "_name", [])]);return smalltalk.send($rec, "_signal", []);})(smalltalk.send((smalltalk.InvalidAssignmentError || InvalidAssignmentError), "_new", []));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function($rec){smalltalk.send($rec, "_variableName_", [smalltalk.send(self, "_name", [])]);return smalltalk.send($rec, "_signal", []);})(smalltalk.send((smalltalk.InvalidAssignmentError || InvalidAssignmentError), "_new", []));})]));
  489. return self;}
  490. }),
  491. smalltalk.ScopeVar);
  492. smalltalk.addMethod(
  493. "_on_",
  494. smalltalk.method({
  495. selector: "on:",
  496. fn: function (aString) {
  497. var self=this;
  498. return (function($rec){smalltalk.send($rec, "_name_", [aString]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  499. return self;}
  500. }),
  501. smalltalk.ScopeVar.klass);
  502. smalltalk.addClass('AliasVar', smalltalk.ScopeVar, ['node'], 'Compiler-Semantic');
  503. smalltalk.addMethod(
  504. "_node",
  505. smalltalk.method({
  506. selector: "node",
  507. fn: function () {
  508. var self=this;
  509. return self['@node'];
  510. return self;}
  511. }),
  512. smalltalk.AliasVar);
  513. smalltalk.addMethod(
  514. "_node_",
  515. smalltalk.method({
  516. selector: "node:",
  517. fn: function (aNode) {
  518. var self=this;
  519. (self['@node']=aNode);
  520. return self;}
  521. }),
  522. smalltalk.AliasVar);
  523. smalltalk.addClass('ArgVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  524. smalltalk.addMethod(
  525. "_isArgVar",
  526. smalltalk.method({
  527. selector: "isArgVar",
  528. fn: function () {
  529. var self=this;
  530. return true;
  531. return self;}
  532. }),
  533. smalltalk.ArgVar);
  534. smalltalk.addClass('ClassRefVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  535. smalltalk.addMethod(
  536. "_alias",
  537. smalltalk.method({
  538. selector: "alias",
  539. fn: function () {
  540. var self=this;
  541. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(smalltalk.", "__comma", [smalltalk.send(self, "_name", [])]), "__comma", [" || "]), "__comma", [smalltalk.send(self, "_name", [])]), "__comma", [")"]);
  542. return self;}
  543. }),
  544. smalltalk.ClassRefVar);
  545. smalltalk.addMethod(
  546. "_isClassRefVar",
  547. smalltalk.method({
  548. selector: "isClassRefVar",
  549. fn: function () {
  550. var self=this;
  551. return true;
  552. return self;}
  553. }),
  554. smalltalk.ClassRefVar);
  555. smalltalk.addClass('InstanceVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  556. smalltalk.addMethod(
  557. "_alias",
  558. smalltalk.method({
  559. selector: "alias",
  560. fn: function () {
  561. var self=this;
  562. return smalltalk.send(smalltalk.send("self[\x22@", "__comma", [smalltalk.send(self, "_name", [])]), "__comma", ["\x22]"]);
  563. return self;}
  564. }),
  565. smalltalk.InstanceVar);
  566. smalltalk.addMethod(
  567. "_isInstanceVar",
  568. smalltalk.method({
  569. selector: "isInstanceVar",
  570. fn: function () {
  571. var self=this;
  572. return true;
  573. return self;}
  574. }),
  575. smalltalk.InstanceVar);
  576. smalltalk.addClass('PseudoVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  577. smalltalk.addMethod(
  578. "_alias",
  579. smalltalk.method({
  580. selector: "alias",
  581. fn: function () {
  582. var self=this;
  583. return smalltalk.send(self, "_name", []);
  584. return self;}
  585. }),
  586. smalltalk.PseudoVar);
  587. smalltalk.addMethod(
  588. "_isPseudoVar",
  589. smalltalk.method({
  590. selector: "isPseudoVar",
  591. fn: function () {
  592. var self=this;
  593. return true;
  594. return self;}
  595. }),
  596. smalltalk.PseudoVar);
  597. smalltalk.addClass('TempVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  598. smalltalk.addMethod(
  599. "_isTempVar",
  600. smalltalk.method({
  601. selector: "isTempVar",
  602. fn: function () {
  603. var self=this;
  604. return true;
  605. return self;}
  606. }),
  607. smalltalk.TempVar);
  608. smalltalk.addClass('UnknownVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
  609. smalltalk.addMethod(
  610. "_isUnknownVar",
  611. smalltalk.method({
  612. selector: "isUnknownVar",
  613. fn: function () {
  614. var self=this;
  615. return true;
  616. return self;}
  617. }),
  618. smalltalk.UnknownVar);
  619. smalltalk.addClass('SemanticAnalyzer', smalltalk.NodeVisitor, ['currentScope', 'theClass', 'classReferences', 'messageSends'], 'Compiler-Semantic');
  620. smalltalk.addMethod(
  621. "_allowUnknownVariables",
  622. smalltalk.method({
  623. selector: "allowUnknownVariables",
  624. fn: function () {
  625. var self=this;
  626. return true;
  627. return self;}
  628. }),
  629. smalltalk.SemanticAnalyzer);
  630. smalltalk.addMethod(
  631. "_classReferences",
  632. smalltalk.method({
  633. selector: "classReferences",
  634. fn: function () {
  635. var self=this;
  636. return (($receiver = self['@classReferences']) == nil || $receiver == undefined) ? (function(){return (self['@classReferences']=smalltalk.send((smalltalk.Set || Set), "_new", []));})() : $receiver;
  637. return self;}
  638. }),
  639. smalltalk.SemanticAnalyzer);
  640. smalltalk.addMethod(
  641. "_errorShadowingVariable_",
  642. smalltalk.method({
  643. selector: "errorShadowingVariable:",
  644. fn: function (aString) {
  645. var self=this;
  646. (function($rec){smalltalk.send($rec, "_variableName_", [aString]);return smalltalk.send($rec, "_signal", []);})(smalltalk.send((smalltalk.ShadowingVariableError || ShadowingVariableError), "_new", []));
  647. return self;}
  648. }),
  649. smalltalk.SemanticAnalyzer);
  650. smalltalk.addMethod(
  651. "_errorUnknownVariable_",
  652. smalltalk.method({
  653. selector: "errorUnknownVariable:",
  654. fn: function (aNode) {
  655. var self=this;
  656. ((($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", []));})]));
  657. return self;}
  658. }),
  659. smalltalk.SemanticAnalyzer);
  660. smalltalk.addMethod(
  661. "_messageSends",
  662. smalltalk.method({
  663. selector: "messageSends",
  664. fn: function () {
  665. var self=this;
  666. return (($receiver = self['@messageSends']) == nil || $receiver == undefined) ? (function(){return (self['@messageSends']=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));})() : $receiver;
  667. return self;}
  668. }),
  669. smalltalk.SemanticAnalyzer);
  670. smalltalk.addMethod(
  671. "_newBlockScope",
  672. smalltalk.method({
  673. selector: "newBlockScope",
  674. fn: function () {
  675. var self=this;
  676. return smalltalk.send(self, "_newScopeOfClass_", [(smalltalk.LexicalScope || LexicalScope)]);
  677. return self;}
  678. }),
  679. smalltalk.SemanticAnalyzer);
  680. smalltalk.addMethod(
  681. "_newMethodScope",
  682. smalltalk.method({
  683. selector: "newMethodScope",
  684. fn: function () {
  685. var self=this;
  686. return smalltalk.send(self, "_newScopeOfClass_", [(smalltalk.MethodLexicalScope || MethodLexicalScope)]);
  687. return self;}
  688. }),
  689. smalltalk.SemanticAnalyzer);
  690. smalltalk.addMethod(
  691. "_newScopeOfClass_",
  692. smalltalk.method({
  693. selector: "newScopeOfClass:",
  694. fn: function (aLexicalScopeClass) {
  695. var self=this;
  696. return (function($rec){smalltalk.send($rec, "_outerScope_", [self['@currentScope']]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(aLexicalScopeClass, "_new", []));
  697. return self;}
  698. }),
  699. smalltalk.SemanticAnalyzer);
  700. smalltalk.addMethod(
  701. "_popScope",
  702. smalltalk.method({
  703. selector: "popScope",
  704. fn: function () {
  705. var self=this;
  706. (($receiver = self['@currentScope']) != nil && $receiver != undefined) ? (function(){return (self['@currentScope']=smalltalk.send(self['@currentScope'], "_outerScope", []));})() : nil;
  707. return self;}
  708. }),
  709. smalltalk.SemanticAnalyzer);
  710. smalltalk.addMethod(
  711. "_pseudoVariables",
  712. smalltalk.method({
  713. selector: "pseudoVariables",
  714. fn: function () {
  715. var self=this;
  716. return ["self", "super", "true", "false", "nil", "thisContext"];
  717. return self;}
  718. }),
  719. smalltalk.SemanticAnalyzer);
  720. smalltalk.addMethod(
  721. "_pushScope_",
  722. smalltalk.method({
  723. selector: "pushScope:",
  724. fn: function (aScope) {
  725. var self=this;
  726. smalltalk.send(aScope, "_outerScope_", [self['@currentScope']]);
  727. (self['@currentScope']=aScope);
  728. return self;}
  729. }),
  730. smalltalk.SemanticAnalyzer);
  731. smalltalk.addMethod(
  732. "_theClass",
  733. smalltalk.method({
  734. selector: "theClass",
  735. fn: function () {
  736. var self=this;
  737. return self['@theClass'];
  738. return self;}
  739. }),
  740. smalltalk.SemanticAnalyzer);
  741. smalltalk.addMethod(
  742. "_theClass_",
  743. smalltalk.method({
  744. selector: "theClass:",
  745. fn: function (aClass) {
  746. var self=this;
  747. (self['@theClass']=aClass);
  748. return self;}
  749. }),
  750. smalltalk.SemanticAnalyzer);
  751. smalltalk.addMethod(
  752. "_validateVariableScope_",
  753. smalltalk.method({
  754. selector: "validateVariableScope:",
  755. fn: function (aString) {
  756. var self=this;
  757. (($receiver = smalltalk.send(self['@currentScope'], "_lookupVariable_", [aString])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self, "_errorShadowingVariable_", [aString]);})() : nil;
  758. return self;}
  759. }),
  760. smalltalk.SemanticAnalyzer);
  761. smalltalk.addMethod(
  762. "_visitAssignmentNode_",
  763. smalltalk.method({
  764. selector: "visitAssignmentNode:",
  765. fn: function (aNode) {
  766. var self=this;
  767. smalltalk.send(self, "_visitAssignmentNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
  768. smalltalk.send(smalltalk.send(aNode, "_left", []), "_beAssigned", []);
  769. return self;}
  770. }),
  771. smalltalk.SemanticAnalyzer);
  772. smalltalk.addMethod(
  773. "_visitBlockNode_",
  774. smalltalk.method({
  775. selector: "visitBlockNode:",
  776. fn: function (aNode) {
  777. var self=this;
  778. smalltalk.send(self, "_pushScope_", [smalltalk.send(self, "_newBlockScope", [])]);
  779. smalltalk.send(aNode, "_scope_", [self['@currentScope']]);
  780. smalltalk.send(self['@currentScope'], "_node_", [aNode]);
  781. smalltalk.send(smalltalk.send(aNode, "_parameters", []), "_do_", [(function(each){smalltalk.send(self, "_validateVariableScope_", [each]);return smalltalk.send(self['@currentScope'], "_addArg_", [each]);})]);
  782. smalltalk.send(self, "_visitBlockNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
  783. smalltalk.send(self, "_popScope", []);
  784. return self;}
  785. }),
  786. smalltalk.SemanticAnalyzer);
  787. smalltalk.addMethod(
  788. "_visitCascadeNode_",
  789. smalltalk.method({
  790. selector: "visitCascadeNode:",
  791. fn: function (aNode) {
  792. var self=this;
  793. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  794. $1=(function(each){
  795. $2=smalltalk.send(aNode,"_receiver",[]);
  796. return smalltalk.send(each,"_receiver_",[$2]);
  797. });
  798. $3=smalltalk.send(aNode,"_nodes",[]);
  799. smalltalk.send($3,"_do_",[$1]);
  800. smalltalk.send(self,"_visitCascadeNode_",[aNode],smalltalk.NodeVisitor);
  801. $4=(function(){
  802. $5=(function(each){
  803. return smalltalk.send(each,"_superSend_",[true]);
  804. });
  805. $6=smalltalk.send(aNode,"_nodes",[]);
  806. return smalltalk.send($6,"_do_",[$5]);
  807. });
  808. $7=smalltalk.send(aNode,"_nodes",[]);
  809. $8=smalltalk.send($7,"_first",[]);
  810. $9=smalltalk.send($8,"_superSend",[]);
  811. smalltalk.send($9,"_ifTrue_",[$4]);
  812. return self;}
  813. }),
  814. smalltalk.SemanticAnalyzer);
  815. smalltalk.addMethod(
  816. "_visitClassReferenceNode_",
  817. smalltalk.method({
  818. selector: "visitClassReferenceNode:",
  819. fn: function (aNode) {
  820. var self=this;
  821. smalltalk.send(smalltalk.send(self, "_classReferences", []), "_add_", [smalltalk.send(aNode, "_value", [])]);
  822. 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", []))]);
  823. return self;}
  824. }),
  825. smalltalk.SemanticAnalyzer);
  826. smalltalk.addMethod(
  827. "_visitMethodNode_",
  828. smalltalk.method({
  829. selector: "visitMethodNode:",
  830. fn: function (aNode) {
  831. var self=this;
  832. smalltalk.send(self, "_pushScope_", [smalltalk.send(self, "_newMethodScope", [])]);
  833. smalltalk.send(aNode, "_scope_", [self['@currentScope']]);
  834. smalltalk.send(self['@currentScope'], "_node_", [aNode]);
  835. smalltalk.send(smalltalk.send(smalltalk.send(self, "_theClass", []), "_allInstanceVariableNames", []), "_do_", [(function(each){return smalltalk.send(self['@currentScope'], "_addIVar_", [each]);})]);
  836. smalltalk.send(smalltalk.send(aNode, "_arguments", []), "_do_", [(function(each){smalltalk.send(self, "_validateVariableScope_", [each]);return smalltalk.send(self['@currentScope'], "_addArg_", [each]);})]);
  837. smalltalk.send(self, "_visitMethodNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
  838. (function($rec){smalltalk.send($rec, "_classReferences_", [smalltalk.send(self, "_classReferences", [])]);return smalltalk.send($rec, "_messageSends_", [smalltalk.send(smalltalk.send(self, "_messageSends", []), "_keys", [])]);})(aNode);
  839. smalltalk.send(self, "_popScope", []);
  840. return self;}
  841. }),
  842. smalltalk.SemanticAnalyzer);
  843. smalltalk.addMethod(
  844. "_visitReturnNode_",
  845. smalltalk.method({
  846. selector: "visitReturnNode:",
  847. fn: function (aNode) {
  848. var self=this;
  849. smalltalk.send(aNode, "_scope_", [self['@currentScope']]);
  850. ((($receiver = smalltalk.send(self['@currentScope'], "_isMethodScope", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@currentScope'], "_localReturn_", [true]);})() : (function(){return smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_addNonLocalReturn_", [self['@currentScope']]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@currentScope'], "_localReturn_", [true]);}), (function(){return smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_addNonLocalReturn_", [self['@currentScope']]);})]));
  851. smalltalk.send(self, "_visitReturnNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
  852. return self;}
  853. }),
  854. smalltalk.SemanticAnalyzer);
  855. smalltalk.addMethod(
  856. "_visitSendNode_",
  857. smalltalk.method({
  858. selector: "visitSendNode:",
  859. fn: function (aNode){
  860. var self=this;
  861. ((($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"]);})() : (function(){return ((($receiver = smalltalk.send(smalltalk.send((smalltalk.IRSendInliner || IRSendInliner), "_inlinedSelectors", []), "_includes_", [smalltalk.send(aNode, "_selector", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(aNode, "_shouldBeInlined_", [true]);return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_isValueNode", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_shouldBeAliased_", [true]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_shouldBeAliased_", [true]);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(aNode, "_shouldBeInlined_", [true]);return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_isValueNode", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_shouldBeAliased_", [true]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_shouldBeAliased_", [true]);})]));})]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){smalltalk.send(aNode, "_superSend_", [true]);return smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_value_", ["self"]);}), (function(){return ((($receiver = smalltalk.send(smalltalk.send((smalltalk.IRSendInliner || IRSendInliner), "_inlinedSelectors", []), "_includes_", [smalltalk.send(aNode, "_selector", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(aNode, "_shouldBeInlined_", [true]);return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_isValueNode", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_shouldBeAliased_", [true]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_shouldBeAliased_", [true]);})]));})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(aNode, "_shouldBeInlined_", [true]);return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_isValueNode", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_shouldBeAliased_", [true]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_shouldBeAliased_", [true]);})]));})]));})]));
  862. smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_ifAbsentPut_", [smalltalk.send(aNode, "_selector", []), (function(){return smalltalk.send((smalltalk.Set || Set), "_new", []);})]);
  863. smalltalk.send(smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_", [smalltalk.send(aNode, "_selector", [])]), "_add_", [aNode]);
  864. smalltalk.send(aNode, "_index_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_", [smalltalk.send(aNode, "_selector", [])]), "_size", [])]);
  865. smalltalk.send(self, "_visitSendNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
  866. return self;}
  867. }),
  868. smalltalk.SemanticAnalyzer);
  869. smalltalk.addMethod(
  870. "_visitSequenceNode_",
  871. smalltalk.method({
  872. selector: "visitSequenceNode:",
  873. fn: function (aNode) {
  874. var self=this;
  875. smalltalk.send(smalltalk.send(aNode, "_temps", []), "_do_", [(function(each){smalltalk.send(self, "_validateVariableScope_", [each]);return smalltalk.send(self['@currentScope'], "_addTemp_", [each]);})]);
  876. smalltalk.send(self, "_visitSequenceNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
  877. return self;}
  878. }),
  879. smalltalk.SemanticAnalyzer);
  880. smalltalk.addMethod(
  881. "_visitVariableNode_",
  882. smalltalk.method({
  883. selector: "visitVariableNode:",
  884. fn: function (aNode) {
  885. var self=this;
  886. 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]);
  887. return self;}
  888. }),
  889. smalltalk.SemanticAnalyzer);
  890. smalltalk.addMethod(
  891. "_on_",
  892. smalltalk.method({
  893. selector: "on:",
  894. fn: function (aClass) {
  895. var self=this;
  896. return (function($rec){smalltalk.send($rec, "_theClass_", [aClass]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  897. return self;}
  898. }),
  899. smalltalk.SemanticAnalyzer.klass);