Compiler-Semantic.deploy.js 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390
  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,3)})}));
  85. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  86. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  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,1)})}));
  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,1)})}));
  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.MethodLexicalScope.superclass.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.MethodLexicalScope.superclass.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,2)})}));
  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,2)})}));
  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,1)})}));
  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,1)})}));
  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 $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  888. function $UnknownVariableError(){return smalltalk.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  889. return smalltalk.withContext(function($ctx1) {
  890. var $1,$2,$3;
  891. identifier=_st(aNode)._value();
  892. $1=_st(_st(_st(_st(_st($Smalltalk())._current())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  893. return smalltalk.withContext(function($ctx2) {
  894. return self._isVariableGloballyUndefined_(identifier);
  895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  896. if(smalltalk.assert($1)){
  897. $2=_st($UnknownVariableError())._new();
  898. _st($2)._variableName_(_st(aNode)._value());
  899. $3=_st($2)._signal();
  900. $3;
  901. } else {
  902. _st(_st(_st(self["@currentScope"])._methodScope())._unknownVariables())._add_(_st(aNode)._value());
  903. };
  904. return self}, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},smalltalk.SemanticAnalyzer)})},
  905. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "current", "isVariableGloballyUndefined:", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]}),
  906. smalltalk.SemanticAnalyzer);
  907. smalltalk.addMethod(
  908. smalltalk.method({
  909. selector: "isVariableGloballyUndefined:",
  910. fn: function (aString){
  911. var self=this;
  912. return smalltalk.withContext(function($ctx1) {
  913. return eval('typeof ' + aString + ' == "undefined"');
  914. return self}, function($ctx1) {$ctx1.fill(self,"isVariableGloballyUndefined:",{aString:aString},smalltalk.SemanticAnalyzer)})},
  915. messageSends: []}),
  916. smalltalk.SemanticAnalyzer);
  917. smalltalk.addMethod(
  918. smalltalk.method({
  919. selector: "messageSends",
  920. fn: function (){
  921. var self=this;
  922. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  923. return smalltalk.withContext(function($ctx1) {
  924. var $2,$1;
  925. $2=self["@messageSends"];
  926. if(($receiver = $2) == nil || $receiver == undefined){
  927. self["@messageSends"]=_st($Dictionary())._new();
  928. $1=self["@messageSends"];
  929. } else {
  930. $1=$2;
  931. };
  932. return $1;
  933. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.SemanticAnalyzer)})},
  934. messageSends: ["ifNil:", "new"]}),
  935. smalltalk.SemanticAnalyzer);
  936. smalltalk.addMethod(
  937. smalltalk.method({
  938. selector: "newBlockScope",
  939. fn: function (){
  940. var self=this;
  941. function $LexicalScope(){return smalltalk.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
  942. return smalltalk.withContext(function($ctx1) {
  943. var $1;
  944. $1=self._newScopeOfClass_($LexicalScope());
  945. return $1;
  946. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},smalltalk.SemanticAnalyzer)})},
  947. messageSends: ["newScopeOfClass:"]}),
  948. smalltalk.SemanticAnalyzer);
  949. smalltalk.addMethod(
  950. smalltalk.method({
  951. selector: "newMethodScope",
  952. fn: function (){
  953. var self=this;
  954. function $MethodLexicalScope(){return smalltalk.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  955. return smalltalk.withContext(function($ctx1) {
  956. var $1;
  957. $1=self._newScopeOfClass_($MethodLexicalScope());
  958. return $1;
  959. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},smalltalk.SemanticAnalyzer)})},
  960. messageSends: ["newScopeOfClass:"]}),
  961. smalltalk.SemanticAnalyzer);
  962. smalltalk.addMethod(
  963. smalltalk.method({
  964. selector: "newScopeOfClass:",
  965. fn: function (aLexicalScopeClass){
  966. var self=this;
  967. return smalltalk.withContext(function($ctx1) {
  968. var $2,$3,$1;
  969. $2=_st(aLexicalScopeClass)._new();
  970. _st($2)._outerScope_(self["@currentScope"]);
  971. $3=_st($2)._yourself();
  972. $1=$3;
  973. return $1;
  974. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},smalltalk.SemanticAnalyzer)})},
  975. messageSends: ["outerScope:", "new", "yourself"]}),
  976. smalltalk.SemanticAnalyzer);
  977. smalltalk.addMethod(
  978. smalltalk.method({
  979. selector: "nextBlockIndex",
  980. fn: function (){
  981. var self=this;
  982. return smalltalk.withContext(function($ctx1) {
  983. var $1,$2;
  984. $1=self["@blockIndex"];
  985. if(($receiver = $1) == nil || $receiver == undefined){
  986. self["@blockIndex"]=(0);
  987. self["@blockIndex"];
  988. } else {
  989. $1;
  990. };
  991. self["@blockIndex"]=_st(self["@blockIndex"]).__plus((1));
  992. $2=self["@blockIndex"];
  993. return $2;
  994. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},smalltalk.SemanticAnalyzer)})},
  995. messageSends: ["ifNil:", "+"]}),
  996. smalltalk.SemanticAnalyzer);
  997. smalltalk.addMethod(
  998. smalltalk.method({
  999. selector: "popScope",
  1000. fn: function (){
  1001. var self=this;
  1002. return smalltalk.withContext(function($ctx1) {
  1003. var $1;
  1004. $1=self["@currentScope"];
  1005. if(($receiver = $1) == nil || $receiver == undefined){
  1006. $1;
  1007. } else {
  1008. self["@currentScope"]=_st(self["@currentScope"])._outerScope();
  1009. self["@currentScope"];
  1010. };
  1011. return self}, function($ctx1) {$ctx1.fill(self,"popScope",{},smalltalk.SemanticAnalyzer)})},
  1012. messageSends: ["ifNotNil:", "outerScope"]}),
  1013. smalltalk.SemanticAnalyzer);
  1014. smalltalk.addMethod(
  1015. smalltalk.method({
  1016. selector: "pushScope:",
  1017. fn: function (aScope){
  1018. var self=this;
  1019. return smalltalk.withContext(function($ctx1) {
  1020. _st(aScope)._outerScope_(self["@currentScope"]);
  1021. self["@currentScope"]=aScope;
  1022. return self}, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},smalltalk.SemanticAnalyzer)})},
  1023. messageSends: ["outerScope:"]}),
  1024. smalltalk.SemanticAnalyzer);
  1025. smalltalk.addMethod(
  1026. smalltalk.method({
  1027. selector: "superSends",
  1028. fn: function (){
  1029. var self=this;
  1030. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1031. return smalltalk.withContext(function($ctx1) {
  1032. var $2,$1;
  1033. $2=self["@superSends"];
  1034. if(($receiver = $2) == nil || $receiver == undefined){
  1035. self["@superSends"]=_st($Dictionary())._new();
  1036. $1=self["@superSends"];
  1037. } else {
  1038. $1=$2;
  1039. };
  1040. return $1;
  1041. }, function($ctx1) {$ctx1.fill(self,"superSends",{},smalltalk.SemanticAnalyzer)})},
  1042. messageSends: ["ifNil:", "new"]}),
  1043. smalltalk.SemanticAnalyzer);
  1044. smalltalk.addMethod(
  1045. smalltalk.method({
  1046. selector: "theClass",
  1047. fn: function (){
  1048. var self=this;
  1049. return smalltalk.withContext(function($ctx1) {
  1050. var $1;
  1051. $1=self["@theClass"];
  1052. return $1;
  1053. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.SemanticAnalyzer)})},
  1054. messageSends: []}),
  1055. smalltalk.SemanticAnalyzer);
  1056. smalltalk.addMethod(
  1057. smalltalk.method({
  1058. selector: "theClass:",
  1059. fn: function (aClass){
  1060. var self=this;
  1061. return smalltalk.withContext(function($ctx1) {
  1062. self["@theClass"]=aClass;
  1063. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.SemanticAnalyzer)})},
  1064. messageSends: []}),
  1065. smalltalk.SemanticAnalyzer);
  1066. smalltalk.addMethod(
  1067. smalltalk.method({
  1068. selector: "validateVariableScope:",
  1069. fn: function (aString){
  1070. var self=this;
  1071. return smalltalk.withContext(function($ctx1) {
  1072. var $1;
  1073. $1=_st(self["@currentScope"])._lookupVariable_(aString);
  1074. if(($receiver = $1) == nil || $receiver == undefined){
  1075. $1;
  1076. } else {
  1077. self._errorShadowingVariable_(aString);
  1078. };
  1079. return self}, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},smalltalk.SemanticAnalyzer)})},
  1080. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]}),
  1081. smalltalk.SemanticAnalyzer);
  1082. smalltalk.addMethod(
  1083. smalltalk.method({
  1084. selector: "visitAssignmentNode:",
  1085. fn: function (aNode){
  1086. var self=this;
  1087. return smalltalk.withContext(function($ctx1) {
  1088. smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply(_st(self), [aNode]);
  1089. _st(_st(aNode)._left())._beAssigned();
  1090. return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  1091. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]}),
  1092. smalltalk.SemanticAnalyzer);
  1093. smalltalk.addMethod(
  1094. smalltalk.method({
  1095. selector: "visitBlockNode:",
  1096. fn: function (aNode){
  1097. var self=this;
  1098. return smalltalk.withContext(function($ctx1) {
  1099. self._pushScope_(self._newBlockScope());
  1100. _st(aNode)._scope_(self["@currentScope"]);
  1101. _st(self["@currentScope"])._node_(aNode);
  1102. _st(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  1103. _st(_st(aNode)._parameters())._do_((function(each){
  1104. return smalltalk.withContext(function($ctx2) {
  1105. self._validateVariableScope_(each);
  1106. return _st(self["@currentScope"])._addArg_(each);
  1107. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1108. smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]);
  1109. self._popScope();
  1110. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  1111. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]}),
  1112. smalltalk.SemanticAnalyzer);
  1113. smalltalk.addMethod(
  1114. smalltalk.method({
  1115. selector: "visitCascadeNode:",
  1116. fn: function (aNode){
  1117. var self=this;
  1118. return smalltalk.withContext(function($ctx1) {
  1119. var $1;
  1120. smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply(_st(self), [aNode]);
  1121. $1=_st(_st(_st(aNode)._nodes())._first())._superSend();
  1122. if(smalltalk.assert($1)){
  1123. _st(_st(aNode)._nodes())._do_((function(each){
  1124. return smalltalk.withContext(function($ctx2) {
  1125. return _st(each)._superSend_(true);
  1126. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1127. };
  1128. return self}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  1129. messageSends: ["visitCascadeNode:", "ifTrue:", "superSend", "first", "nodes", "do:", "superSend:"]}),
  1130. smalltalk.SemanticAnalyzer);
  1131. smalltalk.addMethod(
  1132. smalltalk.method({
  1133. selector: "visitClassReferenceNode:",
  1134. fn: function (aNode){
  1135. var self=this;
  1136. function $ClassRefVar(){return smalltalk.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
  1137. return smalltalk.withContext(function($ctx1) {
  1138. var $1,$2;
  1139. _st(self._classReferences())._add_(_st(aNode)._value());
  1140. $1=_st($ClassRefVar())._new();
  1141. _st($1)._name_(_st(aNode)._value());
  1142. $2=_st($1)._yourself();
  1143. _st(aNode)._binding_($2);
  1144. return self}, function($ctx1) {$ctx1.fill(self,"visitClassReferenceNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  1145. messageSends: ["add:", "classReferences", "value", "binding:", "name:", "new", "yourself"]}),
  1146. smalltalk.SemanticAnalyzer);
  1147. smalltalk.addMethod(
  1148. smalltalk.method({
  1149. selector: "visitMethodNode:",
  1150. fn: function (aNode){
  1151. var self=this;
  1152. return smalltalk.withContext(function($ctx1) {
  1153. var $1,$2;
  1154. self._pushScope_(self._newMethodScope());
  1155. _st(aNode)._scope_(self["@currentScope"]);
  1156. _st(self["@currentScope"])._node_(aNode);
  1157. _st(_st(self._theClass())._allInstanceVariableNames())._do_((function(each){
  1158. return smalltalk.withContext(function($ctx2) {
  1159. return _st(self["@currentScope"])._addIVar_(each);
  1160. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1161. _st(_st(aNode)._arguments())._do_((function(each){
  1162. return smalltalk.withContext(function($ctx2) {
  1163. self._validateVariableScope_(each);
  1164. return _st(self["@currentScope"])._addArg_(each);
  1165. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1166. smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply(_st(self), [aNode]);
  1167. $1=aNode;
  1168. _st($1)._classReferences_(self._classReferences());
  1169. _st($1)._messageSends_(_st(self._messageSends())._keys());
  1170. $2=_st($1)._superSends_(_st(self._superSends())._keys());
  1171. self._popScope();
  1172. return self}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  1173. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "messageSends:", "keys", "messageSends", "superSends:", "superSends", "popScope"]}),
  1174. smalltalk.SemanticAnalyzer);
  1175. smalltalk.addMethod(
  1176. smalltalk.method({
  1177. selector: "visitReturnNode:",
  1178. fn: function (aNode){
  1179. var self=this;
  1180. return smalltalk.withContext(function($ctx1) {
  1181. var $1;
  1182. _st(aNode)._scope_(self["@currentScope"]);
  1183. $1=_st(self["@currentScope"])._isMethodScope();
  1184. if(smalltalk.assert($1)){
  1185. _st(self["@currentScope"])._localReturn_(true);
  1186. } else {
  1187. _st(_st(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  1188. };
  1189. smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply(_st(self), [aNode]);
  1190. return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  1191. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]}),
  1192. smalltalk.SemanticAnalyzer);
  1193. smalltalk.addMethod(
  1194. smalltalk.method({
  1195. selector: "visitSendNode:",
  1196. fn: function (aNode){
  1197. var self=this;
  1198. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  1199. function $IRSendInliner(){return smalltalk.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  1200. return smalltalk.withContext(function($ctx1) {
  1201. var $1,$2;
  1202. $1=_st(_st(_st(aNode)._receiver())._value()).__eq("super");
  1203. if(smalltalk.assert($1)){
  1204. _st(aNode)._superSend_(true);
  1205. _st(_st(aNode)._receiver())._value_("self");
  1206. _st(self._superSends())._at_ifAbsentPut_(_st(aNode)._selector(),(function(){
  1207. return smalltalk.withContext(function($ctx2) {
  1208. return _st($Set())._new();
  1209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1210. _st(_st(self._superSends())._at_(_st(aNode)._selector()))._add_(aNode);
  1211. } else {
  1212. $2=_st(_st($IRSendInliner())._inlinedSelectors())._includes_(_st(aNode)._selector());
  1213. if(smalltalk.assert($2)){
  1214. _st(aNode)._shouldBeInlined_(true);
  1215. _st(_st(aNode)._receiver())._shouldBeAliased_(true);
  1216. };
  1217. };
  1218. _st(self._messageSends())._at_ifAbsentPut_(_st(aNode)._selector(),(function(){
  1219. return smalltalk.withContext(function($ctx2) {
  1220. return _st($Set())._new();
  1221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1222. _st(_st(self._messageSends())._at_(_st(aNode)._selector()))._add_(aNode);
  1223. _st(aNode)._index_(_st(_st(self._messageSends())._at_(_st(aNode)._selector()))._size());
  1224. smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
  1225. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  1226. messageSends: ["ifTrue:ifFalse:", "=", "value", "receiver", "superSend:", "value:", "at:ifAbsentPut:", "superSends", "selector", "new", "add:", "at:", "ifTrue:", "includes:", "inlinedSelectors", "shouldBeInlined:", "shouldBeAliased:", "messageSends", "index:", "size", "visitSendNode:"]}),
  1227. smalltalk.SemanticAnalyzer);
  1228. smalltalk.addMethod(
  1229. smalltalk.method({
  1230. selector: "visitSequenceNode:",
  1231. fn: function (aNode){
  1232. var self=this;
  1233. return smalltalk.withContext(function($ctx1) {
  1234. _st(_st(aNode)._temps())._do_((function(each){
  1235. return smalltalk.withContext(function($ctx2) {
  1236. self._validateVariableScope_(each);
  1237. return _st(self["@currentScope"])._addTemp_(each);
  1238. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1239. smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply(_st(self), [aNode]);
  1240. return self}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  1241. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]}),
  1242. smalltalk.SemanticAnalyzer);
  1243. smalltalk.addMethod(
  1244. smalltalk.method({
  1245. selector: "visitVariableNode:",
  1246. fn: function (aNode){
  1247. var self=this;
  1248. function $UnknownVar(){return smalltalk.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
  1249. return smalltalk.withContext(function($ctx1) {
  1250. var $1,$3,$4,$5,$2;
  1251. $1=aNode;
  1252. $3=_st(self["@currentScope"])._lookupVariable_(aNode);
  1253. if(($receiver = $3) == nil || $receiver == undefined){
  1254. self._errorUnknownVariable_(aNode);
  1255. $4=_st($UnknownVar())._new();
  1256. _st($4)._name_(_st(aNode)._value());
  1257. $5=_st($4)._yourself();
  1258. $2=$5;
  1259. } else {
  1260. $2=$3;
  1261. };
  1262. _st($1)._binding_($2);
  1263. return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
  1264. messageSends: ["binding:", "ifNil:", "lookupVariable:", "errorUnknownVariable:", "name:", "new", "value", "yourself"]}),
  1265. smalltalk.SemanticAnalyzer);
  1266. smalltalk.addMethod(
  1267. smalltalk.method({
  1268. selector: "on:",
  1269. fn: function (aClass){
  1270. var self=this;
  1271. return smalltalk.withContext(function($ctx1) {
  1272. var $2,$3,$1;
  1273. $2=self._new();
  1274. _st($2)._theClass_(aClass);
  1275. $3=_st($2)._yourself();
  1276. $1=$3;
  1277. return $1;
  1278. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},smalltalk.SemanticAnalyzer.klass)})},
  1279. messageSends: ["theClass:", "new", "yourself"]}),
  1280. smalltalk.SemanticAnalyzer.klass);