Compiler-Semantic.js 47 KB

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