Compiler-Semantic.deploy.js 43 KB

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