Compiler-Semantic.js 52 KB

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