|
@@ -1,5 +1,5 @@
|
|
smalltalk.addPackage('Compiler-Interpreter', {});
|
|
smalltalk.addPackage('Compiler-Interpreter', {});
|
|
-smalltalk.addClass('AIContext', smalltalk.NodeVisitor, ['outerContext', 'pc', 'locals', 'receiver', 'selector'], 'Compiler-Interpreter');
|
|
|
|
|
|
+smalltalk.addClass('AIContext', smalltalk.NodeVisitor, ['outerContext', 'pc', 'locals', 'selector'], 'Compiler-Interpreter');
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
"_initializeFromMethodContext_",
|
|
"_initializeFromMethodContext_",
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
@@ -170,12 +170,12 @@ category: 'accessing',
|
|
fn: function (){
|
|
fn: function (){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
var $1;
|
|
return smalltalk.withContext(function($ctx1) {
var $1;
|
|
-$1=self["@receiver"];
|
|
|
|
|
|
+$1=_st(self)._localAt_("self");
|
|
return $1;
|
|
return $1;
|
|
}, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.AIContext)})},
|
|
}, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.AIContext)})},
|
|
args: [],
|
|
args: [],
|
|
-source: "receiver\x0a\x09^ receiver",
|
|
|
|
-messageSends: [],
|
|
|
|
|
|
+source: "receiver\x0a\x09^ self localAt: 'self'",
|
|
|
|
+messageSends: ["localAt:"],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
smalltalk.AIContext);
|
|
smalltalk.AIContext);
|
|
@@ -187,71 +187,16 @@ selector: "receiver:",
|
|
category: 'accessing',
|
|
category: 'accessing',
|
|
fn: function (anObject){
|
|
fn: function (anObject){
|
|
var self=this;
|
|
var self=this;
|
|
-return smalltalk.withContext(function($ctx1) {
self["@receiver"]=anObject;
|
|
|
|
|
|
+return smalltalk.withContext(function($ctx1) {
_st(self)._localAt_put_("self",anObject);
|
|
return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.AIContext)})},
|
|
return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.AIContext)})},
|
|
args: ["anObject"],
|
|
args: ["anObject"],
|
|
-source: "receiver: anObject\x0a\x09receiver := anObject",
|
|
|
|
-messageSends: [],
|
|
|
|
-referencedClasses: []
|
|
|
|
-}),
|
|
|
|
-smalltalk.AIContext);
|
|
|
|
-
|
|
|
|
-smalltalk.addMethod(
|
|
|
|
-"_selector",
|
|
|
|
-smalltalk.method({
|
|
|
|
-selector: "selector",
|
|
|
|
-category: 'accessing',
|
|
|
|
-fn: function (){
|
|
|
|
-var self=this;
|
|
|
|
-return smalltalk.withContext(function($ctx1) {
var $1;
|
|
|
|
-$1=self["@selector"];
|
|
|
|
-return $1;
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"selector",{}, smalltalk.AIContext)})},
|
|
|
|
-args: [],
|
|
|
|
-source: "selector\x0a\x09^ selector",
|
|
|
|
-messageSends: [],
|
|
|
|
-referencedClasses: []
|
|
|
|
-}),
|
|
|
|
-smalltalk.AIContext);
|
|
|
|
-
|
|
|
|
-smalltalk.addMethod(
|
|
|
|
-"_selector_",
|
|
|
|
-smalltalk.method({
|
|
|
|
-selector: "selector:",
|
|
|
|
-category: 'accessing',
|
|
|
|
-fn: function (aString){
|
|
|
|
-var self=this;
|
|
|
|
-return smalltalk.withContext(function($ctx1) {
self["@selector"]=aString;
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString}, smalltalk.AIContext)})},
|
|
|
|
-args: ["aString"],
|
|
|
|
-source: "selector: aString\x0a\x09selector := aString",
|
|
|
|
-messageSends: [],
|
|
|
|
|
|
+source: "receiver: anObject\x0a\x09self localAt: 'self' put: anObject",
|
|
|
|
+messageSends: ["localAt:put:"],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
smalltalk.AIContext);
|
|
smalltalk.AIContext);
|
|
|
|
|
|
|
|
|
|
-smalltalk.addMethod(
|
|
|
|
-"_fromMethodContext_",
|
|
|
|
-smalltalk.method({
|
|
|
|
-selector: "fromMethodContext:",
|
|
|
|
-category: 'instance creation',
|
|
|
|
-fn: function (aMethodContext){
|
|
|
|
-var self=this;
|
|
|
|
-return smalltalk.withContext(function($ctx1) {
var $2,$3,$1;
|
|
|
|
-$2=_st(self)._new();
|
|
|
|
-_st($2)._initializeFromMethodContext_(aMethodContext);
|
|
|
|
-$3=_st($2)._yourself();
|
|
|
|
-$1=$3;
|
|
|
|
-return $1;
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext}, smalltalk.AIContext.klass)})},
|
|
|
|
-args: ["aMethodContext"],
|
|
|
|
-source: "fromMethodContext: aMethodContext\x0a\x09^ self new \x0a \x09initializeFromMethodContext: aMethodContext;\x0a yourself",
|
|
|
|
-messageSends: ["initializeFromMethodContext:", "new", "yourself"],
|
|
|
|
-referencedClasses: []
|
|
|
|
-}),
|
|
|
|
-smalltalk.AIContext.klass);
|
|
|
|
-
|
|
|
|
|
|
|
|
smalltalk.addClass('ASTInterpreter', smalltalk.NodeVisitor, ['currentNode', 'context', 'shouldReturn', 'currentValue'], 'Compiler-Interpreter');
|
|
smalltalk.addClass('ASTInterpreter', smalltalk.NodeVisitor, ['currentNode', 'context', 'shouldReturn', 'currentValue'], 'Compiler-Interpreter');
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
@@ -728,6 +673,30 @@ referencedClasses: []
|
|
}),
|
|
}),
|
|
smalltalk.ASTInterpreter);
|
|
smalltalk.ASTInterpreter);
|
|
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
|
+"_visitVariableNode_",
|
|
|
|
+smalltalk.method({
|
|
|
|
+selector: "visitVariableNode:",
|
|
|
|
+category: 'visiting',
|
|
|
|
+fn: function (aNode){
|
|
|
|
+var self=this;
|
|
|
|
+return smalltalk.withContext(function($ctx1) {
var $1,$3,$2;
|
|
|
|
+$1=self;
|
|
|
|
+$3=_st(_st(aNode)._binding())._isInstanceVar();
|
|
|
|
+if(smalltalk.assert($3)){
|
|
|
|
+$2=_st(_st(_st(self)._context())._receiver())._instVarAt_(_st(aNode)._value());
|
|
|
|
+} else {
|
|
|
|
+$2=_st(_st(self)._context())._localAt_(_st(aNode)._value());
|
|
|
|
+};
|
|
|
|
+_st($1)._continue_($2);
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode}, smalltalk.ASTInterpreter)})},
|
|
|
|
+args: ["aNode"],
|
|
|
|
+source: "visitVariableNode: aNode\x0a self continue: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context localAt: aNode value ])",
|
|
|
|
+messageSends: ["continue:", "ifTrue:ifFalse:", "instVarAt:", "value", "receiver", "context", "localAt:", "isInstanceVar", "binding"],
|
|
|
|
+referencedClasses: []
|
|
|
|
+}),
|
|
|
|
+smalltalk.ASTInterpreter);
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
smalltalk.addClass('ASTDebugger', smalltalk.ASTInterpreter, ['continuation'], 'Compiler-Interpreter');
|
|
smalltalk.addClass('ASTDebugger', smalltalk.ASTInterpreter, ['continuation'], 'Compiler-Interpreter');
|