Compiler-Semantic.deploy.js 44 KB

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