2
0

Compiler-Semantic.deploy.js 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346
  1. define("amber/Compiler-Semantic", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber/Kernel-Objects", "amber/Compiler-Core"], 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. });