Compiler-Semantic.deploy.js 43 KB

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