Compiler-Semantic.deploy.js 45 KB

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