2
0

Compiler-Semantic.deploy.js 43 KB

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