Compiler-Semantic.js 63 KB

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