123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347 |
- define("amber/Compiler-Semantic", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
- smalltalk.addPackage('Compiler-Semantic');
- smalltalk.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber"};
- smalltalk.addClass('LexicalScope', smalltalk.Object, ['node', 'instruction', 'temps', 'args', 'outerScope'], 'Compiler-Semantic');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "addArg:",
- fn: function (aString){
- var self=this;
- function $ArgVar(){return smalltalk.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)}
- return smalltalk.withContext(function($ctx1) {
- _st(self._args())._at_put_(aString,_st($ArgVar())._on_(aString));
- _st(_st(self._args())._at_(aString))._scope_(self);
- return self}, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},smalltalk.LexicalScope)})},
- messageSends: ["at:put:", "on:", "args", "scope:", "at:"]}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "addTemp:",
- fn: function (aString){
- var self=this;
- function $TempVar(){return smalltalk.TempVar||(typeof TempVar=="undefined"?nil:TempVar)}
- return smalltalk.withContext(function($ctx1) {
- _st(self._temps())._at_put_(aString,_st($TempVar())._on_(aString));
- _st(_st(self._temps())._at_(aString))._scope_(self);
- return self}, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},smalltalk.LexicalScope)})},
- messageSends: ["at:put:", "on:", "temps", "scope:", "at:"]}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "alias",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1="$ctx".__comma(_st(self._scopeLevel())._asString());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.LexicalScope)})},
- messageSends: [",", "asString", "scopeLevel"]}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "allVariableNames",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self._args())._keys()).__comma(_st(self._temps())._keys());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},smalltalk.LexicalScope)})},
- messageSends: [",", "keys", "temps", "args"]}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "args",
- fn: function (){
- var self=this;
- function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@args"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@args"]=_st($Dictionary())._new();
- $1=self["@args"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"args",{},smalltalk.LexicalScope)})},
- messageSends: ["ifNil:", "new"]}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "bindingFor:",
- fn: function (aStringOrNode){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self._pseudoVars())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self._args())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
- return smalltalk.withContext(function($ctx3) {
- return _st(self._temps())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
- return smalltalk.withContext(function($ctx4) {
- return nil;
- }, function($ctx4) {$ctx4.fillBlock({},$ctx3)})}));
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},smalltalk.LexicalScope)})},
- messageSends: ["at:ifAbsent:", "value", "temps", "args", "pseudoVars"]}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "canInlineNonLocalReturns",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self._isInlined())._and_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self._outerScope())._canInlineNonLocalReturns();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},smalltalk.LexicalScope)})},
- messageSends: ["and:", "canInlineNonLocalReturns", "outerScope", "isInlined"]}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "instruction",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@instruction"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"instruction",{},smalltalk.LexicalScope)})},
- messageSends: []}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "instruction:",
- fn: function (anIRInstruction){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@instruction"]=anIRInstruction;
- return self}, function($ctx1) {$ctx1.fill(self,"instruction:",{anIRInstruction:anIRInstruction},smalltalk.LexicalScope)})},
- messageSends: []}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isBlockScope",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self._isMethodScope())._not();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},smalltalk.LexicalScope)})},
- messageSends: ["not", "isMethodScope"]}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isInlined",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(_st(self._instruction())._notNil())._and_((function(){
- return smalltalk.withContext(function($ctx2) {
- return _st(self._instruction())._isInlined();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.LexicalScope)})},
- messageSends: ["and:", "isInlined", "instruction", "notNil"]}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isMethodScope",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isMethodScope",{},smalltalk.LexicalScope)})},
- messageSends: []}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "lookupVariable:",
- fn: function (aNode){
- var self=this;
- var lookup;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3;
- lookup=self._bindingFor_(aNode);
- $1=lookup;
- if(($receiver = $1) == nil || $receiver == undefined){
- $2=self._outerScope();
- if(($receiver = $2) == nil || $receiver == undefined){
- lookup=$2;
- } else {
- lookup=_st(self._outerScope())._lookupVariable_(aNode);
- };
- lookup;
- } else {
- $1;
- };
- $3=lookup;
- return $3;
- }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},smalltalk.LexicalScope)})},
- messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "lookupVariable:", "outerScope"]}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "methodScope",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self._outerScope();
- if(($receiver = $2) == nil || $receiver == undefined){
- $1=$2;
- } else {
- $1=_st(self._outerScope())._methodScope();
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methodScope",{},smalltalk.LexicalScope)})},
- messageSends: ["ifNotNil:", "methodScope", "outerScope"]}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "node",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@node"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"node",{},smalltalk.LexicalScope)})},
- messageSends: []}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "node:",
- fn: function (aNode){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@node"]=aNode;
- return self}, function($ctx1) {$ctx1.fill(self,"node:",{aNode:aNode},smalltalk.LexicalScope)})},
- messageSends: []}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "outerScope",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@outerScope"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"outerScope",{},smalltalk.LexicalScope)})},
- messageSends: []}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "outerScope:",
- fn: function (aLexicalScope){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@outerScope"]=aLexicalScope;
- return self}, function($ctx1) {$ctx1.fill(self,"outerScope:",{aLexicalScope:aLexicalScope},smalltalk.LexicalScope)})},
- messageSends: []}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "pseudoVars",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self._methodScope())._pseudoVars();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},smalltalk.LexicalScope)})},
- messageSends: ["pseudoVars", "methodScope"]}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "scopeLevel",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- $1=self._outerScope();
- if(($receiver = $1) == nil || $receiver == undefined){
- return (1);
- } else {
- $1;
- };
- $2=self._isInlined();
- if(smalltalk.assert($2)){
- $3=_st(self._outerScope())._scopeLevel();
- return $3;
- };
- $4=_st(_st(self._outerScope())._scopeLevel()).__plus((1));
- return $4;
- }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},smalltalk.LexicalScope)})},
- messageSends: ["ifNil:", "outerScope", "ifTrue:", "scopeLevel", "isInlined", "+"]}),
- smalltalk.LexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "temps",
- fn: function (){
- var self=this;
- function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@temps"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@temps"]=_st($Dictionary())._new();
- $1=self["@temps"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"temps",{},smalltalk.LexicalScope)})},
- messageSends: ["ifNil:", "new"]}),
- smalltalk.LexicalScope);
- smalltalk.addClass('MethodLexicalScope', smalltalk.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "addIVar:",
- fn: function (aString){
- var self=this;
- function $InstanceVar(){return smalltalk.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)}
- return smalltalk.withContext(function($ctx1) {
- _st(self._iVars())._at_put_(aString,_st($InstanceVar())._on_(aString));
- _st(_st(self._iVars())._at_(aString))._scope_(self);
- return self}, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},smalltalk.MethodLexicalScope)})},
- messageSends: ["at:put:", "on:", "iVars", "scope:", "at:"]}),
- smalltalk.MethodLexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "addNonLocalReturn:",
- fn: function (aScope){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self._nonLocalReturns())._add_(aScope);
- return self}, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},smalltalk.MethodLexicalScope)})},
- messageSends: ["add:", "nonLocalReturns"]}),
- smalltalk.MethodLexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "allVariableNames",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(smalltalk.MethodLexicalScope.superclass.fn.prototype._allVariableNames.apply(_st(self), [])).__comma(_st(self._iVars())._keys());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},smalltalk.MethodLexicalScope)})},
- messageSends: [",", "keys", "iVars", "allVariableNames"]}),
- smalltalk.MethodLexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "bindingFor:",
- fn: function (aNode){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=smalltalk.MethodLexicalScope.superclass.fn.prototype._bindingFor_.apply(_st(self), [aNode]);
- if(($receiver = $2) == nil || $receiver == undefined){
- $1=_st(self._iVars())._at_ifAbsent_(_st(aNode)._value(),(function(){
- return smalltalk.withContext(function($ctx2) {
- return nil;
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},smalltalk.MethodLexicalScope)})},
- messageSends: ["ifNil:", "at:ifAbsent:", "value", "iVars", "bindingFor:"]}),
- smalltalk.MethodLexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "canInlineNonLocalReturns",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},smalltalk.MethodLexicalScope)})},
- messageSends: []}),
- smalltalk.MethodLexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "hasLocalReturn",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self._localReturn();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},smalltalk.MethodLexicalScope)})},
- messageSends: ["localReturn"]}),
- smalltalk.MethodLexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "hasNonLocalReturn",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self._nonLocalReturns())._notEmpty();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},smalltalk.MethodLexicalScope)})},
- messageSends: ["notEmpty", "nonLocalReturns"]}),
- smalltalk.MethodLexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "iVars",
- fn: function (){
- var self=this;
- function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@iVars"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@iVars"]=_st($Dictionary())._new();
- $1=self["@iVars"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"iVars",{},smalltalk.MethodLexicalScope)})},
- messageSends: ["ifNil:", "new"]}),
- smalltalk.MethodLexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isMethodScope",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isMethodScope",{},smalltalk.MethodLexicalScope)})},
- messageSends: []}),
- smalltalk.MethodLexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "localReturn",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@localReturn"];
- if(($receiver = $2) == nil || $receiver == undefined){
- $1=false;
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"localReturn",{},smalltalk.MethodLexicalScope)})},
- messageSends: ["ifNil:"]}),
- smalltalk.MethodLexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "localReturn:",
- fn: function (aBoolean){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@localReturn"]=aBoolean;
- return self}, function($ctx1) {$ctx1.fill(self,"localReturn:",{aBoolean:aBoolean},smalltalk.MethodLexicalScope)})},
- messageSends: []}),
- smalltalk.MethodLexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "methodScope",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"methodScope",{},smalltalk.MethodLexicalScope)})},
- messageSends: []}),
- smalltalk.MethodLexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "nonLocalReturns",
- fn: function (){
- var self=this;
- function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@nonLocalReturns"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@nonLocalReturns"]=_st($OrderedCollection())._new();
- $1=self["@nonLocalReturns"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},smalltalk.MethodLexicalScope)})},
- messageSends: ["ifNil:", "new"]}),
- smalltalk.MethodLexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "pseudoVars",
- fn: function (){
- var self=this;
- function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- function $PseudoVar(){return smalltalk.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)}
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3,$4;
- $1=self["@pseudoVars"];
- if(($receiver = $1) == nil || $receiver == undefined){
- self["@pseudoVars"]=_st($Dictionary())._new();
- self["@pseudoVars"];
- _st(_st(_st($Smalltalk())._current())._pseudoVariableNames())._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- $2=_st($PseudoVar())._on_(each);
- _st($2)._scope_(self._methodScope());
- $3=_st($2)._yourself();
- return _st(self["@pseudoVars"])._at_put_(each,$3);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- } else {
- $1;
- };
- $4=self["@pseudoVars"];
- return $4;
- }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},smalltalk.MethodLexicalScope)})},
- messageSends: ["ifNil:", "new", "do:", "at:put:", "scope:", "methodScope", "on:", "yourself", "pseudoVariableNames", "current"]}),
- smalltalk.MethodLexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "removeNonLocalReturn:",
- fn: function (aScope){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
- return smalltalk.withContext(function($ctx2) {
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},smalltalk.MethodLexicalScope)})},
- messageSends: ["remove:ifAbsent:", "nonLocalReturns"]}),
- smalltalk.MethodLexicalScope);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "unknownVariables",
- fn: function (){
- var self=this;
- function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@unknownVariables"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@unknownVariables"]=_st($OrderedCollection())._new();
- $1=self["@unknownVariables"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},smalltalk.MethodLexicalScope)})},
- messageSends: ["ifNil:", "new"]}),
- smalltalk.MethodLexicalScope);
- smalltalk.addClass('ScopeVar', smalltalk.Object, ['scope', 'name'], 'Compiler-Semantic');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "alias",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self._name())._asVariableName();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.ScopeVar)})},
- messageSends: ["asVariableName", "name"]}),
- smalltalk.ScopeVar);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isArgVar",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isArgVar",{},smalltalk.ScopeVar)})},
- messageSends: []}),
- smalltalk.ScopeVar);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isClassRefVar",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isClassRefVar",{},smalltalk.ScopeVar)})},
- messageSends: []}),
- smalltalk.ScopeVar);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isInstanceVar",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isInstanceVar",{},smalltalk.ScopeVar)})},
- messageSends: []}),
- smalltalk.ScopeVar);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isPseudoVar",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isPseudoVar",{},smalltalk.ScopeVar)})},
- messageSends: []}),
- smalltalk.ScopeVar);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isTempVar",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isTempVar",{},smalltalk.ScopeVar)})},
- messageSends: []}),
- smalltalk.ScopeVar);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isUnknownVar",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return false;
- }, function($ctx1) {$ctx1.fill(self,"isUnknownVar",{},smalltalk.ScopeVar)})},
- messageSends: []}),
- smalltalk.ScopeVar);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "name",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@name"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.ScopeVar)})},
- messageSends: []}),
- smalltalk.ScopeVar);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "name:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@name"]=aString;
- return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.ScopeVar)})},
- messageSends: []}),
- smalltalk.ScopeVar);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "scope",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@scope"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"scope",{},smalltalk.ScopeVar)})},
- messageSends: []}),
- smalltalk.ScopeVar);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "scope:",
- fn: function (aScope){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@scope"]=aScope;
- return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},smalltalk.ScopeVar)})},
- messageSends: []}),
- smalltalk.ScopeVar);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "validateAssignment",
- fn: function (){
- var self=this;
- function $InvalidAssignmentError(){return smalltalk.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3;
- $1=_st(self._isArgVar())._or_((function(){
- return smalltalk.withContext(function($ctx2) {
- return self._isPseudoVar();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- if(smalltalk.assert($1)){
- $2=_st($InvalidAssignmentError())._new();
- _st($2)._variableName_(self._name());
- $3=_st($2)._signal();
- $3;
- };
- return self}, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},smalltalk.ScopeVar)})},
- messageSends: ["ifTrue:", "variableName:", "name", "new", "signal", "or:", "isPseudoVar", "isArgVar"]}),
- smalltalk.ScopeVar);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "on:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- _st($2)._name_(aString);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},smalltalk.ScopeVar.klass)})},
- messageSends: ["name:", "new", "yourself"]}),
- smalltalk.ScopeVar.klass);
- smalltalk.addClass('AliasVar', smalltalk.ScopeVar, ['node'], 'Compiler-Semantic');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "node",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@node"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"node",{},smalltalk.AliasVar)})},
- messageSends: []}),
- smalltalk.AliasVar);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "node:",
- fn: function (aNode){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@node"]=aNode;
- return self}, function($ctx1) {$ctx1.fill(self,"node:",{aNode:aNode},smalltalk.AliasVar)})},
- messageSends: []}),
- smalltalk.AliasVar);
- smalltalk.addClass('ArgVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isArgVar",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isArgVar",{},smalltalk.ArgVar)})},
- messageSends: []}),
- smalltalk.ArgVar);
- smalltalk.addClass('ClassRefVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "alias",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st("$".__comma(self._name())).__comma("()");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.ClassRefVar)})},
- messageSends: [",", "name"]}),
- smalltalk.ClassRefVar);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isClassRefVar",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isClassRefVar",{},smalltalk.ClassRefVar)})},
- messageSends: []}),
- smalltalk.ClassRefVar);
- smalltalk.addClass('InstanceVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "alias",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st("self[\x22@".__comma(self._name())).__comma("\x22]");
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.InstanceVar)})},
- messageSends: [",", "name"]}),
- smalltalk.InstanceVar);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isInstanceVar",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isInstanceVar",{},smalltalk.InstanceVar)})},
- messageSends: []}),
- smalltalk.InstanceVar);
- smalltalk.addClass('PseudoVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "alias",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self._name();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"alias",{},smalltalk.PseudoVar)})},
- messageSends: ["name"]}),
- smalltalk.PseudoVar);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isPseudoVar",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isPseudoVar",{},smalltalk.PseudoVar)})},
- messageSends: []}),
- smalltalk.PseudoVar);
- smalltalk.addClass('TempVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isTempVar",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isTempVar",{},smalltalk.TempVar)})},
- messageSends: []}),
- smalltalk.TempVar);
- smalltalk.addClass('UnknownVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isUnknownVar",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return true;
- }, function($ctx1) {$ctx1.fill(self,"isUnknownVar",{},smalltalk.UnknownVar)})},
- messageSends: []}),
- smalltalk.UnknownVar);
- smalltalk.addClass('SemanticAnalyzer', smalltalk.NodeVisitor, ['currentScope', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
- smalltalk.addMethod(
- smalltalk.method({
- selector: "classReferences",
- fn: function (){
- var self=this;
- function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@classReferences"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@classReferences"]=_st($Set())._new();
- $1=self["@classReferences"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"classReferences",{},smalltalk.SemanticAnalyzer)})},
- messageSends: ["ifNil:", "new"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "errorShadowingVariable:",
- fn: function (aString){
- var self=this;
- function $ShadowingVariableError(){return smalltalk.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=_st($ShadowingVariableError())._new();
- _st($1)._variableName_(aString);
- $2=_st($1)._signal();
- return self}, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},smalltalk.SemanticAnalyzer)})},
- messageSends: ["variableName:", "new", "signal"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "errorUnknownVariable:",
- fn: function (aNode){
- var self=this;
- var identifier;
- function $UnknownVariableError(){return smalltalk.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
- function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2,$3;
- identifier=_st(aNode)._value();
- $1=_st(_st(_st(_st(_st($Smalltalk())._current())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
- return smalltalk.withContext(function($ctx2) {
- return self._isVariableGloballyUndefined_(identifier);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- if(smalltalk.assert($1)){
- $2=_st($UnknownVariableError())._new();
- _st($2)._variableName_(_st(aNode)._value());
- $3=_st($2)._signal();
- $3;
- } else {
- _st(_st(_st(self["@currentScope"])._methodScope())._unknownVariables())._add_(_st(aNode)._value());
- };
- return self}, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},smalltalk.SemanticAnalyzer)})},
- messageSends: ["value", "ifTrue:ifFalse:", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope", "and:", "isVariableGloballyUndefined:", "not", "includes:", "globalJsVariables", "current"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "isVariableGloballyUndefined:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- return eval('typeof ' + aString + ' == "undefined"');
- return self}, function($ctx1) {$ctx1.fill(self,"isVariableGloballyUndefined:",{aString:aString},smalltalk.SemanticAnalyzer)})},
- messageSends: []}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "messageSends",
- fn: function (){
- var self=this;
- function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@messageSends"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@messageSends"]=_st($Dictionary())._new();
- $1=self["@messageSends"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.SemanticAnalyzer)})},
- messageSends: ["ifNil:", "new"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "newBlockScope",
- fn: function (){
- var self=this;
- function $LexicalScope(){return smalltalk.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self._newScopeOfClass_($LexicalScope());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},smalltalk.SemanticAnalyzer)})},
- messageSends: ["newScopeOfClass:"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "newMethodScope",
- fn: function (){
- var self=this;
- function $MethodLexicalScope(){return smalltalk.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self._newScopeOfClass_($MethodLexicalScope());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},smalltalk.SemanticAnalyzer)})},
- messageSends: ["newScopeOfClass:"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "newScopeOfClass:",
- fn: function (aLexicalScopeClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=_st(aLexicalScopeClass)._new();
- _st($2)._outerScope_(self["@currentScope"]);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},smalltalk.SemanticAnalyzer)})},
- messageSends: ["outerScope:", "new", "yourself"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "popScope",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@currentScope"];
- if(($receiver = $1) == nil || $receiver == undefined){
- $1;
- } else {
- self["@currentScope"]=_st(self["@currentScope"])._outerScope();
- self["@currentScope"];
- };
- return self}, function($ctx1) {$ctx1.fill(self,"popScope",{},smalltalk.SemanticAnalyzer)})},
- messageSends: ["ifNotNil:", "outerScope"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "pushScope:",
- fn: function (aScope){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(aScope)._outerScope_(self["@currentScope"]);
- self["@currentScope"]=aScope;
- return self}, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},smalltalk.SemanticAnalyzer)})},
- messageSends: ["outerScope:"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "superSends",
- fn: function (){
- var self=this;
- function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
- return smalltalk.withContext(function($ctx1) {
- var $2,$1;
- $2=self["@superSends"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@superSends"]=_st($Dictionary())._new();
- $1=self["@superSends"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"superSends",{},smalltalk.SemanticAnalyzer)})},
- messageSends: ["ifNil:", "new"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=self["@theClass"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.SemanticAnalyzer)})},
- messageSends: []}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "theClass:",
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self["@theClass"]=aClass;
- return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.SemanticAnalyzer)})},
- messageSends: []}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "validateVariableScope:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- $1=_st(self["@currentScope"])._lookupVariable_(aString);
- if(($receiver = $1) == nil || $receiver == undefined){
- $1;
- } else {
- self._errorShadowingVariable_(aString);
- };
- return self}, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},smalltalk.SemanticAnalyzer)})},
- messageSends: ["ifNotNil:", "errorShadowingVariable:", "lookupVariable:"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "visitAssignmentNode:",
- fn: function (aNode){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply(_st(self), [aNode]);
- _st(_st(aNode)._left())._beAssigned();
- return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
- messageSends: ["visitAssignmentNode:", "beAssigned", "left"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "visitBlockNode:",
- fn: function (aNode){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- self._pushScope_(self._newBlockScope());
- _st(aNode)._scope_(self["@currentScope"]);
- _st(self["@currentScope"])._node_(aNode);
- _st(_st(aNode)._parameters())._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- self._validateVariableScope_(each);
- return _st(self["@currentScope"])._addArg_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]);
- self._popScope();
- return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
- messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "do:", "validateVariableScope:", "addArg:", "parameters", "visitBlockNode:", "popScope"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "visitCascadeNode:",
- fn: function (aNode){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- _st(_st(aNode)._nodes())._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._receiver_(_st(aNode)._receiver());
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply(_st(self), [aNode]);
- $1=_st(_st(_st(aNode)._nodes())._first())._superSend();
- if(smalltalk.assert($1)){
- _st(_st(aNode)._nodes())._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(each)._superSend_(true);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- };
- return self}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
- messageSends: ["do:", "receiver:", "receiver", "nodes", "visitCascadeNode:", "ifTrue:", "superSend:", "superSend", "first"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "visitClassReferenceNode:",
- fn: function (aNode){
- var self=this;
- function $ClassRefVar(){return smalltalk.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- _st(self._classReferences())._add_(_st(aNode)._value());
- $1=_st($ClassRefVar())._new();
- _st($1)._name_(_st(aNode)._value());
- $2=_st($1)._yourself();
- _st(aNode)._binding_($2);
- return self}, function($ctx1) {$ctx1.fill(self,"visitClassReferenceNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
- messageSends: ["add:", "value", "classReferences", "binding:", "name:", "new", "yourself"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "visitMethodNode:",
- fn: function (aNode){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- self._pushScope_(self._newMethodScope());
- _st(aNode)._scope_(self["@currentScope"]);
- _st(self["@currentScope"])._node_(aNode);
- _st(_st(self._theClass())._allInstanceVariableNames())._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- return _st(self["@currentScope"])._addIVar_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- _st(_st(aNode)._arguments())._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- self._validateVariableScope_(each);
- return _st(self["@currentScope"])._addArg_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply(_st(self), [aNode]);
- $1=aNode;
- _st($1)._classReferences_(self._classReferences());
- _st($1)._messageSends_(_st(self._messageSends())._keys());
- $2=_st($1)._superSends_(_st(self._superSends())._keys());
- self._popScope();
- return self}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
- messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "addIVar:", "allInstanceVariableNames", "theClass", "validateVariableScope:", "addArg:", "arguments", "visitMethodNode:", "classReferences:", "classReferences", "messageSends:", "keys", "messageSends", "superSends:", "superSends", "popScope"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "visitReturnNode:",
- fn: function (aNode){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $1;
- _st(aNode)._scope_(self["@currentScope"]);
- $1=_st(self["@currentScope"])._isMethodScope();
- if(smalltalk.assert($1)){
- _st(self["@currentScope"])._localReturn_(true);
- } else {
- _st(_st(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
- };
- smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply(_st(self), [aNode]);
- return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
- messageSends: ["scope:", "ifTrue:ifFalse:", "localReturn:", "addNonLocalReturn:", "methodScope", "isMethodScope", "visitReturnNode:"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "visitSendNode:",
- fn: function (aNode){
- var self=this;
- function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
- function $IRSendInliner(){return smalltalk.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$2;
- $1=_st(_st(_st(aNode)._receiver())._value()).__eq("super");
- if(smalltalk.assert($1)){
- _st(aNode)._superSend_(true);
- _st(_st(aNode)._receiver())._value_("self");
- _st(self._superSends())._at_ifAbsentPut_(_st(aNode)._selector(),(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st($Set())._new();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- _st(_st(self._superSends())._at_(_st(aNode)._selector()))._add_(aNode);
- } else {
- $2=_st(_st($IRSendInliner())._inlinedSelectors())._includes_(_st(aNode)._selector());
- if(smalltalk.assert($2)){
- _st(aNode)._shouldBeInlined_(true);
- _st(_st(aNode)._receiver())._shouldBeAliased_(true);
- };
- };
- _st(self._messageSends())._at_ifAbsentPut_(_st(aNode)._selector(),(function(){
- return smalltalk.withContext(function($ctx2) {
- return _st($Set())._new();
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- _st(_st(self._messageSends())._at_(_st(aNode)._selector()))._add_(aNode);
- _st(aNode)._index_(_st(_st(self._messageSends())._at_(_st(aNode)._selector()))._size());
- smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
- return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
- messageSends: ["ifTrue:ifFalse:", "superSend:", "value:", "receiver", "at:ifAbsentPut:", "selector", "new", "superSends", "add:", "at:", "ifTrue:", "shouldBeInlined:", "shouldBeAliased:", "includes:", "inlinedSelectors", "=", "value", "messageSends", "index:", "size", "visitSendNode:"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "visitSequenceNode:",
- fn: function (aNode){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- _st(_st(aNode)._temps())._do_((function(each){
- return smalltalk.withContext(function($ctx2) {
- self._validateVariableScope_(each);
- return _st(self["@currentScope"])._addTemp_(each);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
- smalltalk.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply(_st(self), [aNode]);
- return self}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
- messageSends: ["do:", "validateVariableScope:", "addTemp:", "temps", "visitSequenceNode:"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "visitVariableNode:",
- fn: function (aNode){
- var self=this;
- function $UnknownVar(){return smalltalk.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
- return smalltalk.withContext(function($ctx1) {
- var $1,$3,$4,$5,$2;
- $1=aNode;
- $3=_st(self["@currentScope"])._lookupVariable_(aNode);
- if(($receiver = $3) == nil || $receiver == undefined){
- self._errorUnknownVariable_(aNode);
- $4=_st($UnknownVar())._new();
- _st($4)._name_(_st(aNode)._value());
- $5=_st($4)._yourself();
- $2=$5;
- } else {
- $2=$3;
- };
- _st($1)._binding_($2);
- return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},smalltalk.SemanticAnalyzer)})},
- messageSends: ["binding:", "ifNil:", "errorUnknownVariable:", "name:", "value", "new", "yourself", "lookupVariable:"]}),
- smalltalk.SemanticAnalyzer);
- smalltalk.addMethod(
- smalltalk.method({
- selector: "on:",
- fn: function (aClass){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
- var $2,$3,$1;
- $2=self._new();
- _st($2)._theClass_(aClass);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},smalltalk.SemanticAnalyzer.klass)})},
- messageSends: ["theClass:", "new", "yourself"]}),
- smalltalk.SemanticAnalyzer.klass);
- });
|