|
@@ -346,31 +346,25 @@ selector: "isInlined",
|
|
|
protocol: "testing",
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
args: [],
|
|
|
-source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
|
|
|
+source: "isInlined\x0a\x09^ self instruction ifNil: [ false ] ifNotNil: [ :instr | instr isInlined ]",
|
|
|
referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
pragmas: [],
|
|
|
-messageSends: ["and:", "notNil", "instruction", "isInlined"]
|
|
|
+messageSends: ["ifNil:ifNotNil:", "instruction", "isInlined"]
|
|
|
}, function ($methodClass){ return 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");
|
|
|
-}));
|
|
|
+var $1,$receiver;
|
|
|
+$1=$self._instruction();
|
|
|
+if(($receiver = $1) == null || $receiver.a$nil){
|
|
|
+return false;
|
|
|
+} else {
|
|
|
+var instr;
|
|
|
+instr=$receiver;
|
|
|
+return $recv(instr)._isInlined();
|
|
|
+}
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
}, function($ctx1) {$ctx1.fill(self,"isInlined",{})});
|
|
|
//>>excludeEnd("ctx");
|
|
@@ -1077,24 +1071,6 @@ return $recv($self._name())._asVariableName();
|
|
|
}; }),
|
|
|
$globals.ScopeVar);
|
|
|
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "isArgVar",
|
|
|
-protocol: "testing",
|
|
|
-//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
-args: [],
|
|
|
-source: "isArgVar\x0a\x09^ false",
|
|
|
-referencedClasses: [],
|
|
|
-//>>excludeEnd("ide");
|
|
|
-pragmas: [],
|
|
|
-messageSends: []
|
|
|
-}, function ($methodClass){ return function (){
|
|
|
-var self=this,$self=this;
|
|
|
-return false;
|
|
|
-
|
|
|
-}; }),
|
|
|
-$globals.ScopeVar);
|
|
|
-
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
selector: "isClassRefVar",
|
|
@@ -1313,44 +1289,6 @@ return self;
|
|
|
}; }),
|
|
|
$globals.ScopeVar);
|
|
|
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "validateAssignment",
|
|
|
-protocol: "testing",
|
|
|
-//>>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");
|
|
|
-pragmas: [],
|
|
|
-messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
|
|
|
-}, function ($methodClass){ return 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",{})});
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-}; }),
|
|
|
-$globals.ScopeVar);
|
|
|
-
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -1379,7 +1317,7 @@ return $recv($1)._yourself();
|
|
|
$globals.ScopeVar.a$cls);
|
|
|
|
|
|
|
|
|
-$core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
|
|
|
+$core.addClass("AliasVar", $globals.ScopeVar, [], "Compiler-Semantic");
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
$globals.AliasVar.comment="I am an internally defined variable by the compiler";
|
|
|
//>>excludeEnd("ide");
|
|
@@ -1401,67 +1339,12 @@ return true;
|
|
|
}; }),
|
|
|
$globals.AliasVar);
|
|
|
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "node",
|
|
|
-protocol: "accessing",
|
|
|
-//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
-args: [],
|
|
|
-source: "node\x0a\x09^ node",
|
|
|
-referencedClasses: [],
|
|
|
-//>>excludeEnd("ide");
|
|
|
-pragmas: [],
|
|
|
-messageSends: []
|
|
|
-}, function ($methodClass){ return function (){
|
|
|
-var self=this,$self=this;
|
|
|
-return $self.node;
|
|
|
-
|
|
|
-}; }),
|
|
|
-$globals.AliasVar);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "node:",
|
|
|
-protocol: "accessing",
|
|
|
-//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
-args: ["aNode"],
|
|
|
-source: "node: aNode\x0a\x09node := aNode",
|
|
|
-referencedClasses: [],
|
|
|
-//>>excludeEnd("ide");
|
|
|
-pragmas: [],
|
|
|
-messageSends: []
|
|
|
-}, function ($methodClass){ return function (aNode){
|
|
|
-var self=this,$self=this;
|
|
|
-$self.node=aNode;
|
|
|
-return self;
|
|
|
-
|
|
|
-}; }),
|
|
|
-$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",
|
|
|
-//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
-args: [],
|
|
|
-source: "isArgVar\x0a\x09^ true",
|
|
|
-referencedClasses: [],
|
|
|
-//>>excludeEnd("ide");
|
|
|
-pragmas: [],
|
|
|
-messageSends: []
|
|
|
-}, function ($methodClass){ return function (){
|
|
|
-var self=this,$self=this;
|
|
|
-return true;
|
|
|
-
|
|
|
-}; }),
|
|
|
-$globals.ArgVar);
|
|
|
-
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
selector: "isImmutable",
|
|
@@ -1957,6 +1840,33 @@ return $1;
|
|
|
}; }),
|
|
|
$globals.SemanticAnalyzer);
|
|
|
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "errorInvalidAssignment:",
|
|
|
+protocol: "error handling",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: ["aString"],
|
|
|
+source: "errorInvalidAssignment: aString\x0a\x09InvalidAssignmentError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
|
|
|
+referencedClasses: ["InvalidAssignmentError"],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["variableName:", "new", "signal"]
|
|
|
+}, function ($methodClass){ return function (aString){
|
|
|
+var self=this,$self=this;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+var $1;
|
|
|
+$1=$recv($globals.InvalidAssignmentError)._new();
|
|
|
+$recv($1)._variableName_(aString);
|
|
|
+$recv($1)._signal();
|
|
|
+return self;
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"errorInvalidAssignment:",{aString:aString})});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}; }),
|
|
|
+$globals.SemanticAnalyzer);
|
|
|
+
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
selector: "errorShadowingVariable:",
|
|
@@ -2348,16 +2258,18 @@ selector: "visitAssignmentNode:",
|
|
|
protocol: "visiting",
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
args: ["aNode"],
|
|
|
-source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
|
|
|
+source: "visitAssignmentNode: aNode\x0a\x09| lhs |\x0a\x09super visitAssignmentNode: aNode.\x0a\x09lhs := aNode left.\x0a\x09lhs isImmutable ifTrue: [ self errorInvalidAssignment: lhs value ].\x0a\x09lhs assigned: true",
|
|
|
referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
pragmas: [],
|
|
|
-messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
|
|
|
+messageSends: ["visitAssignmentNode:", "left", "ifTrue:", "isImmutable", "errorInvalidAssignment:", "value", "assigned:"]
|
|
|
}, function ($methodClass){ return function (aNode){
|
|
|
var self=this,$self=this;
|
|
|
+var lhs;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
+var $1;
|
|
|
(
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
$ctx1.supercall = true,
|
|
@@ -2366,10 +2278,15 @@ $ctx1.supercall = true,
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
$ctx1.supercall = false;
|
|
|
//>>excludeEnd("ctx");;
|
|
|
-$recv($recv(aNode)._left())._beAssigned();
|
|
|
+lhs=$recv(aNode)._left();
|
|
|
+$1=$recv(lhs)._isImmutable();
|
|
|
+if($core.assert($1)){
|
|
|
+$self._errorInvalidAssignment_($recv(lhs)._value());
|
|
|
+}
|
|
|
+$recv(lhs)._assigned_(true);
|
|
|
return self;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode})});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,lhs:lhs})});
|
|
|
//>>excludeEnd("ctx");
|
|
|
}; }),
|
|
|
$globals.SemanticAnalyzer);
|