1
0

Compiler-Semantic.deploy.js 30 KB

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