Compiler-Semantic.deploy.js 43 KB

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