UNPKG

amber

Version:

An implementation of the Smalltalk language that runs on top of the JS runtime.

1,804 lines (1,671 loc) 89 kB
define(["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict"; if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver; var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals; $core.addPackage("Compiler-Semantic"); ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); }; ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"}; $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.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."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "addArg:", protocol: "adding", fn: function (aString){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1; $1=$self._args(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["args"]=1; //>>excludeEnd("ctx"); $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString)); $recv($recv($self._args())._at_(aString))._scope_(self); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self", referencedClasses: ["ArgVar"], //>>excludeEnd("ide"); messageSends: ["at:put:", "args", "on:", "scope:", "at:"] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "addTemp:", protocol: "adding", fn: function (aString){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1; $1=$self._temps(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["temps"]=1; //>>excludeEnd("ctx"); $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString)); $recv($recv($self._temps())._at_(aString))._scope_(self); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self", referencedClasses: ["TempVar"], //>>excludeEnd("ide"); messageSends: ["at:put:", "temps", "on:", "scope:", "at:"] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "alias", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return "$ctx".__comma($recv($self._scopeLevel())._asString()); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "alias\x0a\x09^ '$ctx', self scopeLevel asString", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [",", "asString", "scopeLevel"] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "allVariableNames", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1; $1=$recv($self._args())._keys(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["keys"]=1; //>>excludeEnd("ctx"); return $recv($1).__comma($recv($self._temps())._keys()); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "allVariableNames\x0a\x09^ self args keys, self temps keys", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [",", "keys", "args", "temps"] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "args", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$receiver; $1=$self["@args"]; if(($receiver = $1) == null || $receiver.a$nil){ $self["@args"]=$recv($globals.Dictionary)._new(); return $self["@args"]; } else { return $1; } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]", referencedClasses: ["Dictionary"], //>>excludeEnd("ide"); messageSends: ["ifNil:", "new"] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "bindingFor:", protocol: "accessing", fn: function (aStringOrNode){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $2,$3,$4,$5,$1; $2=$self._pseudoVars(); $3=$recv(aStringOrNode)._value(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["value"]=1; //>>excludeEnd("ctx"); $1=$recv($2)._at_ifAbsent_($3,(function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); $4=$self._args(); $5=$recv(aStringOrNode)._value(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["value"]=2; //>>excludeEnd("ctx"); return $recv($4)._at_ifAbsent_($5,(function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx3) { //>>excludeEnd("ctx"); return $recv($self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){ return nil; })); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)}); //>>excludeEnd("ctx"); })); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx2.sendIdx["at:ifAbsent:"]=2; //>>excludeEnd("ctx"); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); //>>excludeEnd("ctx"); })); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["at:ifAbsent:"]=1; //>>excludeEnd("ctx"); return $1; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aStringOrNode"], 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 ]]]", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "blockIndex", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$receiver; $1=$self["@blockIndex"]; if(($receiver = $1) == null || $receiver.a$nil){ return (0); } else { return $1; } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["ifNil:"] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "blockIndex:", protocol: "accessing", fn: function (anInteger){ var self=this,$self=this; $self["@blockIndex"]=anInteger; return self; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anInteger"], source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "canInlineNonLocalReturns", protocol: "testing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return $recv($self._isInlined())._and_((function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); return $recv($self._outerScope())._canInlineNonLocalReturns(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); //>>excludeEnd("ctx"); })); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "instruction", protocol: "accessing", fn: function (){ var self=this,$self=this; return $self["@instruction"]; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "instruction\x0a\x09^ instruction", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "instruction:", protocol: "accessing", fn: function (anIRInstruction){ var self=this,$self=this; $self["@instruction"]=anIRInstruction; return self; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIRInstruction"], source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "isBlockScope", protocol: "testing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return $recv($self._isMethodScope())._not(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isBlockScope\x0a\x09^ self isMethodScope not", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["not", "isMethodScope"] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "isInlined", protocol: "testing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $2,$1; $2=$self._instruction(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["instruction"]=1; //>>excludeEnd("ctx"); $1=$recv($2)._notNil(); return $recv($1)._and_((function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); return $recv($self._instruction())._isInlined(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); //>>excludeEnd("ctx"); })); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["and:", "notNil", "instruction", "isInlined"] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "isMethodScope", protocol: "testing", fn: function (){ var self=this,$self=this; return false; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isMethodScope\x0a\x09^ false", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "lookupVariable:", protocol: "accessing", fn: function (aNode){ var self=this,$self=this; var lookup; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$2,$receiver; lookup=$self._bindingFor_(aNode); $1=lookup; if(($receiver = $1) == null || $receiver.a$nil){ $2=$self._outerScope(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["outerScope"]=1; //>>excludeEnd("ctx"); if(($receiver = $2) == null || $receiver.a$nil){ lookup=$2; } else { lookup=$recv($self._outerScope())._lookupVariable_(aNode); } lookup; } else { $1; } return lookup; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNode"], 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", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "methodScope", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$receiver; $1=$self._outerScope(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["outerScope"]=1; //>>excludeEnd("ctx"); if(($receiver = $1) == null || $receiver.a$nil){ return $1; } else { return $recv($self._outerScope())._methodScope(); } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["ifNotNil:", "outerScope", "methodScope"] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "node", protocol: "accessing", fn: function (){ var self=this,$self=this; return $self["@node"]; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "node:", protocol: "accessing", fn: function (aNode){ var self=this,$self=this; $self["@node"]=aNode; return self; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNode"], source: "node: aNode\x0a\x09node := aNode", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "outerScope", protocol: "accessing", fn: function (){ var self=this,$self=this; return $self["@outerScope"]; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "outerScope\x0a\x09^ outerScope", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "outerScope:", protocol: "accessing", fn: function (aLexicalScope){ var self=this,$self=this; $self["@outerScope"]=aLexicalScope; return self; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aLexicalScope"], source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "pseudoVars", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return $recv($self._methodScope())._pseudoVars(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "pseudoVars\x0a\x09^ self methodScope pseudoVars", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["pseudoVars", "methodScope"] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "scopeLevel", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$2,$4,$3,$receiver; $1=$self._outerScope(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["outerScope"]=1; //>>excludeEnd("ctx"); if(($receiver = $1) == null || $receiver.a$nil){ return (1); } else { $1; } $2=$self._isInlined(); if($core.assert($2)){ $4=$self._outerScope(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["outerScope"]=2; //>>excludeEnd("ctx"); $3=$recv($4)._scopeLevel(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["scopeLevel"]=1; //>>excludeEnd("ctx"); return $3; } return $recv($recv($self._outerScope())._scopeLevel()).__plus((1)); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"] }), $globals.LexicalScope); $core.addMethod( $core.method({ selector: "temps", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$receiver; $1=$self["@temps"]; if(($receiver = $1) == null || $receiver.a$nil){ $self["@temps"]=$recv($globals.Dictionary)._new(); return $self["@temps"]; } else { return $1; } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]", referencedClasses: ["Dictionary"], //>>excludeEnd("ide"); messageSends: ["ifNil:", "new"] }), $globals.LexicalScope); $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.MethodLexicalScope.comment="I represent a method scope."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "addIVar:", protocol: "adding", fn: function (aString){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1; $1=$self._iVars(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx["iVars"]=1; //>>excludeEnd("ctx"); $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString)); $recv($recv($self._iVars())._at_(aString))._scope_(self); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self", referencedClasses: ["InstanceVar"], //>>excludeEnd("ide"); messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"] }), $globals.MethodLexicalScope); $core.addMethod( $core.method({ selector: "addNonLocalReturn:", protocol: "adding", fn: function (aScope){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv($self._nonLocalReturns())._add_(aScope); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aScope"], source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["add:", "nonLocalReturns"] }), $globals.MethodLexicalScope); $core.addMethod( $core.method({ selector: "allVariableNames", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1; $1=( //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, //>>excludeEnd("ctx"); ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($self, [])); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; //>>excludeEnd("ctx");; return $recv($1).__comma($recv($self._iVars())._keys()); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [",", "allVariableNames", "keys", "iVars"] }), $globals.MethodLexicalScope); $core.addMethod( $core.method({ selector: "bindingFor:", protocol: "accessing", fn: function (aNode){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$receiver; $1=( //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, //>>excludeEnd("ctx"); ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($self, [aNode])); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = false; //>>excludeEnd("ctx");; if(($receiver = $1) == null || $receiver.a$nil){ return $recv($self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){ return nil; })); } else { return $1; } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNode"], source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"] }), $globals.MethodLexicalScope); $core.addMethod( $core.method({ selector: "canInlineNonLocalReturns", protocol: "testing", fn: function (){ var self=this,$self=this; return true; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "canInlineNonLocalReturns\x0a\x09^ true", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.MethodLexicalScope); $core.addMethod( $core.method({ selector: "hasLocalReturn", protocol: "testing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return $self._localReturn(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "hasLocalReturn\x0a\x09^ self localReturn", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["localReturn"] }), $globals.MethodLexicalScope); $core.addMethod( $core.method({ selector: "hasNonLocalReturn", protocol: "testing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return $recv($self._nonLocalReturns())._notEmpty(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["notEmpty", "nonLocalReturns"] }), $globals.MethodLexicalScope); $core.addMethod( $core.method({ selector: "iVars", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$receiver; $1=$self["@iVars"]; if(($receiver = $1) == null || $receiver.a$nil){ $self["@iVars"]=$recv($globals.Dictionary)._new(); return $self["@iVars"]; } else { return $1; } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]", referencedClasses: ["Dictionary"], //>>excludeEnd("ide"); messageSends: ["ifNil:", "new"] }), $globals.MethodLexicalScope); $core.addMethod( $core.method({ selector: "isMethodScope", protocol: "testing", fn: function (){ var self=this,$self=this; return true; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isMethodScope\x0a\x09^ true", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.MethodLexicalScope); $core.addMethod( $core.method({ selector: "localReturn", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$receiver; $1=$self["@localReturn"]; if(($receiver = $1) == null || $receiver.a$nil){ return false; } else { return $1; } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["ifNil:"] }), $globals.MethodLexicalScope); $core.addMethod( $core.method({ selector: "localReturn:", protocol: "accessing", fn: function (aBoolean){ var self=this,$self=this; $self["@localReturn"]=aBoolean; return self; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aBoolean"], source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.MethodLexicalScope); $core.addMethod( $core.method({ selector: "methodScope", protocol: "accessing", fn: function (){ var self=this,$self=this; return self; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "methodScope\x0a\x09^ self", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.MethodLexicalScope); $core.addMethod( $core.method({ selector: "nonLocalReturns", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$receiver; $1=$self["@nonLocalReturns"]; if(($receiver = $1) == null || $receiver.a$nil){ $self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new(); return $self["@nonLocalReturns"]; } else { return $1; } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]", referencedClasses: ["OrderedCollection"], //>>excludeEnd("ide"); messageSends: ["ifNil:", "new"] }), $globals.MethodLexicalScope); $core.addMethod( $core.method({ selector: "pseudoVars", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$2,$4,$3,$receiver; $1=$self["@pseudoVars"]; if(($receiver = $1) == null || $receiver.a$nil){ $self["@pseudoVars"]=$recv($globals.Dictionary)._new(); $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); $2=$self["@pseudoVars"]; $4=$recv($globals.PseudoVar)._on_(each); $recv($4)._scope_($self._methodScope()); $3=$recv($4)._yourself(); return $recv($2)._at_put_(each,$3); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)}); //>>excludeEnd("ctx"); })); } else { $1; } return $self["@pseudoVars"]; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09Smalltalk 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", referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"], //>>excludeEnd("ide"); messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"] }), $globals.MethodLexicalScope); $core.addMethod( $core.method({ selector: "removeNonLocalReturn:", protocol: "adding", fn: function (aScope){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){ })); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aScope"], source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["remove:ifAbsent:", "nonLocalReturns"] }), $globals.MethodLexicalScope); $core.addMethod( $core.method({ selector: "unknownVariables", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$receiver; $1=$self["@unknownVariables"]; if(($receiver = $1) == null || $receiver.a$nil){ $self["@unknownVariables"]=$recv($globals.OrderedCollection)._new(); return $self["@unknownVariables"]; } else { return $1; } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]", referencedClasses: ["OrderedCollection"], //>>excludeEnd("ide"); messageSends: ["ifNil:", "new"] }), $globals.MethodLexicalScope); $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.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."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "alias", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return $recv($self._name())._asVariableName(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "alias\x0a\x09^ self name asVariableName", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["asVariableName", "name"] }), $globals.ScopeVar); $core.addMethod( $core.method({ selector: "isArgVar", protocol: "testing", fn: function (){ var self=this,$self=this; return false; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isArgVar\x0a\x09^ false", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ScopeVar); $core.addMethod( $core.method({ selector: "isClassRefVar", protocol: "testing", fn: function (){ var self=this,$self=this; return false; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isClassRefVar\x0a\x09^ false", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ScopeVar); $core.addMethod( $core.method({ selector: "isImmutable", protocol: "testing", fn: function (){ var self=this,$self=this; return false; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isImmutable\x0a\x09^ false", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ScopeVar); $core.addMethod( $core.method({ selector: "isInstanceVar", protocol: "testing", fn: function (){ var self=this,$self=this; return false; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isInstanceVar\x0a\x09^ false", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ScopeVar); $core.addMethod( $core.method({ selector: "isPseudoVar", protocol: "testing", fn: function (){ var self=this,$self=this; return false; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isPseudoVar\x0a\x09^ false", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ScopeVar); $core.addMethod( $core.method({ selector: "isSelf", protocol: "testing", fn: function (){ var self=this,$self=this; return false; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isSelf\x0a\x09^ false", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ScopeVar); $core.addMethod( $core.method({ selector: "isSuper", protocol: "testing", fn: function (){ var self=this,$self=this; return false; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isSuper\x0a\x09^ false", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ScopeVar); $core.addMethod( $core.method({ selector: "isTempVar", protocol: "testing", fn: function (){ var self=this,$self=this; return false; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isTempVar\x0a\x09^ false", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ScopeVar); $core.addMethod( $core.method({ selector: "isUnknownVar", protocol: "testing", fn: function (){ var self=this,$self=this; return false; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isUnknownVar\x0a\x09^ false", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ScopeVar); $core.addMethod( $core.method({ selector: "name", protocol: "accessing", fn: function (){ var self=this,$self=this; return $self["@name"]; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "name\x0a\x09^ name", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ScopeVar); $core.addMethod( $core.method({ selector: "name:", protocol: "accessing", fn: function (aString){ var self=this,$self=this; $self["@name"]=aString; return self; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "name: aString\x0a\x09name := aString", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ScopeVar); $core.addMethod( $core.method({ selector: "scope", protocol: "accessing", fn: function (){ var self=this,$self=this; return $self["@scope"]; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "scope\x0a\x09^ scope", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ScopeVar); $core.addMethod( $core.method({ selector: "scope:", protocol: "accessing", fn: function (aScope){ var self=this,$self=this; $self["@scope"]=aScope; return self; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aScope"], source: "scope: aScope\x0a\x09scope := aScope", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ScopeVar); $core.addMethod( $core.method({ selector: "validateAssignment", protocol: "testing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1,$2; $1=$recv($self._isArgVar())._or_((function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); return $self._isPseudoVar(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); //>>excludeEnd("ctx"); })); if($core.assert($1)){ $2=$recv($globals.InvalidAssignmentError)._new(); $recv($2)._variableName_($self._name()); $recv($2)._signal(); } return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]", referencedClasses: ["InvalidAssignmentError"], //>>excludeEnd("ide"); messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"] }), $globals.ScopeVar); $core.addMethod( $core.method({ selector: "on:", protocol: "instance creation", fn: function (aString){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1; $1=$self._new(); $recv($1)._name_(aString); return $recv($1)._yourself(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.a$cls)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aString"], source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["name:", "new", "yourself"] }), $globals.ScopeVar.a$cls); $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.AliasVar.comment="I am an internally defined variable by the compiler"; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "isImmutable", protocol: "testing", fn: function (){ var self=this,$self=this; return true; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isImmutable\x0a\x09^ true", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.AliasVar); $core.addMethod( $core.method({ selector: "node", protocol: "accessing", fn: function (){ var self=this,$self=this; return $self["@node"]; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "node\x0a\x09^ node", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.AliasVar); $core.addMethod( $core.method({ selector: "node:", protocol: "accessing", fn: function (aNode){ var self=this,$self=this; $self["@node"]=aNode; return self; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNode"], source: "node: aNode\x0a\x09node := aNode", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.AliasVar); $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.ArgVar.comment="I am an argument of a method or block."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "isArgVar", protocol: "testing", fn: function (){ var self=this,$self=this; return true; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isArgVar\x0a\x09^ true", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ArgVar); $core.addMethod( $core.method({ selector: "isImmutable", protocol: "testing", fn: function (){ var self=this,$self=this; return true; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isImmutable\x0a\x09^ true", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ArgVar); $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.ClassRefVar.comment="I am an class reference variable"; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "alias", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return "$globals.".__comma($self._name()); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], 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^ '$globals.', self name", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [",", "name"] }), $globals.ClassRefVar); $core.addMethod( $core.method({ selector: "isClassRefVar", protocol: "testing", fn: function (){ var self=this,$self=this; return true; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isClassRefVar\x0a\x09^ true", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ClassRefVar); $core.addMethod( $core.method({ selector: "isImmutable", protocol: "testing", fn: function (){ var self=this,$self=this; return true; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isImmutable\x0a\x09^ true", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.ClassRefVar); $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.InstanceVar.comment="I am an instance variable of a method or block."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "alias", protocol: "testing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1; $1=$recv("$self[\x22@".__comma($self._name())).__comma("\x22]"); //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.sendIdx[","]=1; //>>excludeEnd("ctx"); return $1; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "alias\x0a\x09^ '$self[\x22@', self name, '\x22]'", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [",", "name"] }), $globals.InstanceVar); $core.addMethod( $core.method({ selector: "isInstanceVar", protocol: "testing", fn: function (){ var self=this,$self=this; return true; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isInstanceVar\x0a\x09^ true", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.InstanceVar); $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'"; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "alias", protocol: "accessing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return $self._name(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "alias\x0a\x09^ self name", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["name"] }), $globals.PseudoVar); $core.addMethod( $core.method({ selector: "isImmutable", protocol: "testing", fn: function (){ var self=this,$self=this; return true; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isImmutable\x0a\x09^ true", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.PseudoVar); $core.addMethod( $core.method({ selector: "isPseudoVar", protocol: "testing", fn: function (){ var self=this,$self=this; return true; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isPseudoVar\x0a\x09^ true", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.PseudoVar); $core.addMethod( $core.method({ selector: "isSelf", protocol: "testing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return $recv($self["@name"]).__eq("self"); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.PseudoVar)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isSelf\x0a\x09^ name = 'self'", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["="] }), $globals.PseudoVar); $core.addMethod( $core.method({ selector: "isSuper", protocol: "testing", fn: function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); return $recv($self["@name"]).__eq("super"); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.PseudoVar)}); //>>excludeEnd("ctx"); }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isSuper\x0a\x09^ name = 'super'", referencedClasses: [], //>>excludeEnd("ide"); messageSends: ["="] }), $globals.PseudoVar); $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.TempVar.comment="I am an temporary variable of a method or block."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "isTempVar", protocol: "testing", fn: function (){ var self=this,$self=this; return true; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isTempVar\x0a\x09^ true", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.TempVar); $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals"; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "isUnknownVar", protocol: "testing", fn: function (){ var self=this,$self=this; return true; }, //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isUnknownVar\x0a\x09^ true", referencedClasses: [], //>>excludeEnd("ide"); messageSends: [] }), $globals.UnknownVar); $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes."; //>>excludeEnd("ide"); $core.addMethod