|
@@ -183,7 +183,7 @@ var self=this;
|
|
|
var context,sequenceNode;
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
|
var $1,$2,$3,$4,$5,$6;
|
|
|
-context=_st(self["@outerContext"])._newBlockContext();
|
|
|
+context=_st(self["@outerContext"])._newInnerContext();
|
|
|
$1=_st(_st(_st(self["@node"])._nodes())._first())._copy();
|
|
|
_st($1)._parent_(nil);
|
|
|
$2=_st($1)._yourself();
|
|
@@ -211,8 +211,8 @@ $6=_st(_st(context)._interpreter())._pop();
|
|
|
return $6;
|
|
|
}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},globals.AIBlockClosure)})},
|
|
|
args: ["aCollection"],
|
|
|
-source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newBlockContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node nodes first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals in the context\x22\x0a\x09sequenceNode temps do: [ :each |\x0a\x09\x09context defineLocal: each ].\x0a\x09\x09\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context defineLocal: each.\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode nextChild;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
|
|
|
-messageSends: ["newBlockContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "nextChild", "proceed", "setNonLocalReturnFromContext:", "pop"],
|
|
|
+source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newInnerContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node nodes first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals in the context\x22\x0a\x09sequenceNode temps do: [ :each |\x0a\x09\x09context defineLocal: each ].\x0a\x09\x09\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context defineLocal: each.\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode nextChild;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
|
|
|
+messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "nextChild", "proceed", "setNonLocalReturnFromContext:", "pop"],
|
|
|
referencedClasses: []
|
|
|
}),
|
|
|
globals.AIBlockClosure);
|
|
@@ -240,7 +240,7 @@ referencedClasses: []
|
|
|
globals.AIBlockClosure.klass);
|
|
|
|
|
|
|
|
|
-smalltalk.addClass('AIContext', globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter'], 'Compiler-Interpreter');
|
|
|
+smalltalk.addClass('AIContext', globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
|
|
|
globals.AIContext.comment="I am like a `MethodContext`, used by the `ASTInterpreter`.\x0aUnlike a `MethodContext`, my instances are not read-only.\x0a\x0aWhen debugging, my instances are created by copying the current `MethodContext` (thisContext)";
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
@@ -515,6 +515,7 @@ self._evaluatedSelector_(_st(aMethodContext)._evaluatedSelector());
|
|
|
self._index_(_st(aMethodContext)._index());
|
|
|
self._sendIndexes_(_st(aMethodContext)._sendIndexes());
|
|
|
self._receiver_(_st(aMethodContext)._receiver());
|
|
|
+self._supercall_(_st(aMethodContext)._supercall());
|
|
|
$1=self._selector_(_st(aMethodContext)._selector());
|
|
|
$2=_st(aMethodContext)._outerContext();
|
|
|
$ctx1.sendIdx["outerContext"]=1;
|
|
@@ -538,8 +539,8 @@ return _st(self._locals())._at_put_(key,value);
|
|
|
};
|
|
|
return self}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},globals.AIContext)})},
|
|
|
args: ["aMethodContext"],
|
|
|
-source: "initializeFromMethodContext: aMethodContext\x0a\x0a\x09self\x0a\x09\x09evaluatedSelector: aMethodContext evaluatedSelector;\x0a\x09\x09index: aMethodContext index;\x0a\x09\x09sendIndexes: aMethodContext sendIndexes;\x0a\x09\x09receiver: aMethodContext receiver;\x0a\x09\x09selector: aMethodContext selector.\x0a\x09\x09\x0a\x09aMethodContext outerContext ifNotNil: [ :outer |\x0a\x09\x09\x22If the method context is nil, the block was defined in JS, so ignore it\x22\x0a\x09\x09outer methodContext ifNotNil: [\x0a\x09\x09\x09self outerContext: (self class fromMethodContext: aMethodContext outerContext) ].\x0a\x09\x09\x09aMethodContext locals keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09\x09self locals at: key put: value ] ]",
|
|
|
-messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"],
|
|
|
+source: "initializeFromMethodContext: aMethodContext\x0a\x0a\x09self\x0a\x09\x09evaluatedSelector: aMethodContext evaluatedSelector;\x0a\x09\x09index: aMethodContext index;\x0a\x09\x09sendIndexes: aMethodContext sendIndexes;\x0a\x09\x09receiver: aMethodContext receiver;\x0a\x09\x09supercall: aMethodContext supercall;\x0a\x09\x09selector: aMethodContext selector.\x0a\x09\x09\x0a\x09aMethodContext outerContext ifNotNil: [ :outer |\x0a\x09\x09\x22If the method context is nil, the block was defined in JS, so ignore it\x22\x0a\x09\x09outer methodContext ifNotNil: [\x0a\x09\x09\x09self outerContext: (self class fromMethodContext: aMethodContext outerContext) ].\x0a\x09\x09\x09aMethodContext locals keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09\x09self locals at: key put: value ] ]",
|
|
|
+messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"],
|
|
|
referencedClasses: []
|
|
|
}),
|
|
|
globals.AIContext);
|
|
@@ -818,35 +819,7 @@ globals.AIContext);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
-selector: "method",
|
|
|
-protocol: 'accessing',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
-var $2,$5,$4,$3,$1,$receiver;
|
|
|
-$2=self._methodContext();
|
|
|
-$ctx1.sendIdx["methodContext"]=1;
|
|
|
-if(($receiver = $2) == null || $receiver.isNil){
|
|
|
-$1=$2;
|
|
|
-} else {
|
|
|
-$5=self._methodContext();
|
|
|
-$ctx1.sendIdx["methodContext"]=2;
|
|
|
-$4=_st($5)._receiver();
|
|
|
-$3=_st($4)._class();
|
|
|
-$1=_st($3)._lookupSelector_(_st(self._methodContext())._selector());
|
|
|
-};
|
|
|
-return $1;
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"method",{},globals.AIContext)})},
|
|
|
-args: [],
|
|
|
-source: "method\x0a\x09^ self methodContext ifNotNil: [\x0a\x09\x09self methodContext receiver class lookupSelector: self methodContext selector ]",
|
|
|
-messageSends: ["ifNotNil:", "methodContext", "lookupSelector:", "class", "receiver", "selector"],
|
|
|
-referencedClasses: []
|
|
|
-}),
|
|
|
-globals.AIContext);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-smalltalk.method({
|
|
|
-selector: "newBlockContext",
|
|
|
+selector: "newInnerContext",
|
|
|
protocol: 'factory',
|
|
|
fn: function (){
|
|
|
var self=this;
|
|
@@ -857,9 +830,9 @@ _st($2)._outerContext_(self);
|
|
|
$3=_st($2)._yourself();
|
|
|
$1=$3;
|
|
|
return $1;
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"newBlockContext",{},globals.AIContext)})},
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},globals.AIContext)})},
|
|
|
args: [],
|
|
|
-source: "newBlockContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
|
|
|
+source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
|
|
|
messageSends: ["outerContext:", "new", "class", "yourself"],
|
|
|
referencedClasses: []
|
|
|
}),
|
|
@@ -1064,6 +1037,44 @@ referencedClasses: ["ASTPCNodeVisitor"]
|
|
|
}),
|
|
|
globals.AIContext);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "supercall",
|
|
|
+protocol: 'interpreting',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+var $2,$1,$receiver;
|
|
|
+$2=self["@supercall"];
|
|
|
+if(($receiver = $2) == null || $receiver.isNil){
|
|
|
+$1=false;
|
|
|
+} else {
|
|
|
+$1=$2;
|
|
|
+};
|
|
|
+return $1;
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"supercall",{},globals.AIContext)})},
|
|
|
+args: [],
|
|
|
+source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
|
|
|
+messageSends: ["ifNil:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+globals.AIContext);
|
|
|
+
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "supercall:",
|
|
|
+protocol: 'interpreting',
|
|
|
+fn: function (aBoolean){
|
|
|
+var self=this;
|
|
|
+self["@supercall"]=aBoolean;
|
|
|
+return self},
|
|
|
+args: ["aBoolean"],
|
|
|
+source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
|
|
|
+messageSends: [],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+globals.AIContext);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "variableNotFound",
|
|
@@ -1150,7 +1161,8 @@ var $early={};
|
|
|
try {
|
|
|
_st(self._context())._localAt_ifAbsent_(_st(aNode)._value(),(function(){
|
|
|
return smalltalk.withContext(function($ctx2) {
|
|
|
-$1=globals.AISemanticAnalyzer.superclass.fn.prototype._visitVariableNode_.apply(_st(self), [aNode]);
|
|
|
+$1=($ctx2.supercall = true, globals.AISemanticAnalyzer.superclass.fn.prototype._visitVariableNode_.apply(_st(self), [aNode]));
|
|
|
+$ctx2.supercall = false;
|
|
|
throw $early=[$1];
|
|
|
}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
|
|
|
_st(aNode)._binding_(_st($ASTContextVar())._new());
|
|
@@ -1678,7 +1690,8 @@ protocol: 'initialization',
|
|
|
fn: function (){
|
|
|
var self=this;
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
|
-globals.ASTInterpreter.superclass.fn.prototype._initialize.apply(_st(self), []);
|
|
|
+($ctx1.supercall = true, globals.ASTInterpreter.superclass.fn.prototype._initialize.apply(_st(self), []));
|
|
|
+$ctx1.supercall = false;
|
|
|
self["@forceAtEnd"]=false;
|
|
|
return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ASTInterpreter)})},
|
|
|
args: [],
|
|
@@ -2139,7 +2152,8 @@ return smalltalk.withContext(function($ctx1) {
|
|
|
var $1;
|
|
|
$1=self._hasReturned();
|
|
|
if(! smalltalk.assert($1)){
|
|
|
-globals.ASTInterpreter.superclass.fn.prototype._visit_.apply(_st(self), [aNode]);
|
|
|
+($ctx1.supercall = true, globals.ASTInterpreter.superclass.fn.prototype._visit_.apply(_st(self), [aNode]));
|
|
|
+$ctx1.supercall = false;
|
|
|
};
|
|
|
return self}, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},globals.ASTInterpreter)})},
|
|
|
args: ["aNode"],
|
|
@@ -2196,7 +2210,8 @@ protocol: 'visiting',
|
|
|
fn: function (aNode){
|
|
|
var self=this;
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
|
-globals.ASTInterpreter.superclass.fn.prototype._visitBlockSequenceNode_.apply(_st(self), [aNode]);
|
|
|
+($ctx1.supercall = true, globals.ASTInterpreter.superclass.fn.prototype._visitBlockSequenceNode_.apply(_st(self), [aNode]));
|
|
|
+$ctx1.supercall = false;
|
|
|
self["@forceAtEnd"]=true;
|
|
|
return self}, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},globals.ASTInterpreter)})},
|
|
|
args: ["aNode"],
|
|
@@ -2592,7 +2607,8 @@ $1=self._context();
|
|
|
$2=self._selector();
|
|
|
$ctx1.sendIdx["selector"]=1;
|
|
|
sendIndex=_st($1)._sendIndexAt_($2);
|
|
|
-globals.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]);
|
|
|
+($ctx1.supercall = true, globals.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]));
|
|
|
+$ctx1.supercall = false;
|
|
|
$4=self._selector();
|
|
|
$ctx1.sendIdx["selector"]=2;
|
|
|
$3=_st($4).__eq(_st(aNode)._selector());
|