|
@@ -170,30 +170,6 @@ return self;
|
|
|
}; }),
|
|
|
$globals.ASTMethodRunningTest);
|
|
|
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "while:inClass:should:",
|
|
|
-protocol: "testing",
|
|
|
-
|
|
|
-args: ["aString", "aClass", "aBlock"],
|
|
|
-source: "while: aString inClass: aClass should: aBlock\x0a\x09self subclassResponsibility",
|
|
|
-referencedClasses: [],
|
|
|
-
|
|
|
-pragmas: [],
|
|
|
-messageSends: ["subclassResponsibility"]
|
|
|
-}, function ($methodClass){ return function (aString,aClass,aBlock){
|
|
|
-var self=this,$self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-$self._subclassResponsibility();
|
|
|
-return self;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"while:inClass:should:",{aString:aString,aClass:aClass,aBlock:aBlock})});
|
|
|
-
|
|
|
-}; }),
|
|
|
-$globals.ASTMethodRunningTest);
|
|
|
-
|
|
|
|
|
|
|
|
|
$core.addClass("AbstractCompilerTest", $globals.ASTMethodRunningTest, [], "Compiler-Tests");
|
|
@@ -1577,441 +1553,188 @@ return $recv($self._name()).__eq("AbstractCompilerTest");
|
|
|
$globals.AbstractCompilerTest.a$cls);
|
|
|
|
|
|
|
|
|
+$core.addClass("ASTDebuggerTest", $globals.AbstractCompilerTest, [], "Compiler-Tests");
|
|
|
+
|
|
|
+
|
|
|
$core.addClass("ASTInterpreterTest", $globals.AbstractCompilerTest, [], "Compiler-Tests");
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "codeGeneratorClass",
|
|
|
-protocol: "accessing",
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
|
|
|
-referencedClasses: ["CodeGenerator"],
|
|
|
-
|
|
|
-pragmas: [],
|
|
|
-messageSends: []
|
|
|
-}, function ($methodClass){ return function (){
|
|
|
-var self=this,$self=this;
|
|
|
-return $globals.CodeGenerator;
|
|
|
|
|
|
-}; }),
|
|
|
-$globals.ASTInterpreterTest);
|
|
|
|
|
|
+$core.addClass("CodeGeneratorTest", $globals.AbstractCompilerTest, [], "Compiler-Tests");
|
|
|
+
|
|
|
+
|
|
|
+$core.addClass("InliningCodeGeneratorTest", $globals.AbstractCompilerTest, [], "Compiler-Tests");
|
|
|
+
|
|
|
+
|
|
|
+$core.addClass("ASTPCNodeVisitorTest", $globals.TestCase, [], "Compiler-Tests");
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "interpret:forClass:receiver:withArguments:",
|
|
|
-protocol: "private",
|
|
|
+selector: "astPCNodeVisitor",
|
|
|
+protocol: "factory",
|
|
|
|
|
|
-args: ["aString", "aClass", "anObject", "aDictionary"],
|
|
|
-source: "interpret: aString forClass: aClass receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx |\x0a\x09\x0a\x09ctx := self prepareContextFor: aString class: aClass receiver: anObject withArguments: aDictionary.\x0a\x09\x0a\x09^ ctx interpreter proceed; result",
|
|
|
-referencedClasses: [],
|
|
|
+args: [],
|
|
|
+source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
|
|
|
+referencedClasses: ["ASTPCNodeVisitor"],
|
|
|
|
|
|
pragmas: [],
|
|
|
-messageSends: ["prepareContextFor:class:receiver:withArguments:", "proceed", "interpreter", "result"]
|
|
|
-}, function ($methodClass){ return function (aString,aClass,anObject,aDictionary){
|
|
|
+messageSends: ["index:", "new", "yourself"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
var self=this,$self=this;
|
|
|
-var ctx;
|
|
|
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
|
|
|
var $1;
|
|
|
-ctx=$self._prepareContextFor_class_receiver_withArguments_(aString,aClass,anObject,aDictionary);
|
|
|
-$1=$recv(ctx)._interpreter();
|
|
|
-$recv($1)._proceed();
|
|
|
-return $recv($1)._result();
|
|
|
+$1=$recv($globals.ASTPCNodeVisitor)._new();
|
|
|
+$recv($1)._index_((0));
|
|
|
+return $recv($1)._yourself();
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"interpret:forClass:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,aDictionary:aDictionary,ctx:ctx})});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{})});
|
|
|
|
|
|
}; }),
|
|
|
-$globals.ASTInterpreterTest);
|
|
|
+$globals.ASTPCNodeVisitorTest);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "prepareContextFor:class:receiver:withArguments:",
|
|
|
-protocol: "private",
|
|
|
+selector: "astPCNodeVisitorForSelector:",
|
|
|
+protocol: "factory",
|
|
|
|
|
|
-args: ["aString", "aClass", "anObject", "aDictionary"],
|
|
|
-source: "prepareContextFor: aString class: aClass receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast |\x0a\x09\x0a\x09ast := self parse: aString forClass: aClass.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09selector: ast selector;\x0a\x09\x09interpreter: ASTInterpreter new;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09\x0a\x09ctx interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09node: ast;\x0a\x09\x09enterNode.\x0a\x09\x0a\x09^ctx",
|
|
|
-referencedClasses: ["AIContext", "ASTInterpreter"],
|
|
|
+args: ["aString"],
|
|
|
+source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
|
|
|
+referencedClasses: ["ASTPCNodeVisitor"],
|
|
|
|
|
|
pragmas: [],
|
|
|
-messageSends: ["parse:forClass:", "receiver:", "new", "selector:", "selector", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode"]
|
|
|
-}, function ($methodClass){ return function (aString,aClass,anObject,aDictionary){
|
|
|
+messageSends: ["selector:", "new", "index:", "yourself"]
|
|
|
+}, function ($methodClass){ return function (aString){
|
|
|
var self=this,$self=this;
|
|
|
-var ctx,ast;
|
|
|
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
|
|
|
-var $1,$2,$3,$receiver;
|
|
|
-ast=$self._parse_forClass_(aString,aClass);
|
|
|
-$1=$recv($globals.AIContext)._new();
|
|
|
-
|
|
|
-$ctx1.sendIdx["new"]=1;
|
|
|
-
|
|
|
-$recv($1)._receiver_(anObject);
|
|
|
-$recv($1)._selector_($recv(ast)._selector());
|
|
|
-$recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
|
|
|
-ctx=$recv($1)._yourself();
|
|
|
-$2=$recv(ast)._sequenceNode();
|
|
|
-if(($receiver = $2) == null || $receiver.a$nil){
|
|
|
-$2;
|
|
|
-} else {
|
|
|
-var sequence;
|
|
|
-sequence=$receiver;
|
|
|
-$recv($recv(sequence)._temps())._do_((function(each){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-
|
|
|
-return $recv(ctx)._defineLocal_(each);
|
|
|
-
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
|
|
|
-
|
|
|
-}));
|
|
|
-}
|
|
|
-$recv(aDictionary)._keysAndValuesDo_((function(key,value){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-
|
|
|
-return $recv(ctx)._localAt_put_(key,value);
|
|
|
-
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
|
|
|
-
|
|
|
-}));
|
|
|
-$3=$recv(ctx)._interpreter();
|
|
|
-$recv($3)._context_(ctx);
|
|
|
-$recv($3)._node_(ast);
|
|
|
-$recv($3)._enterNode();
|
|
|
-return ctx;
|
|
|
+var $1;
|
|
|
+$1=$recv($globals.ASTPCNodeVisitor)._new();
|
|
|
+$recv($1)._selector_(aString);
|
|
|
+$recv($1)._index_((0));
|
|
|
+return $recv($1)._yourself();
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"prepareContextFor:class:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast})});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString})});
|
|
|
|
|
|
}; }),
|
|
|
-$globals.ASTInterpreterTest);
|
|
|
+$globals.ASTPCNodeVisitorTest);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "while:inClass:should:",
|
|
|
-protocol: "testing",
|
|
|
+selector: "testJSStatementNode",
|
|
|
+protocol: "tests",
|
|
|
|
|
|
-args: ["aString", "aClass", "aBlock"],
|
|
|
-source: "while: aString inClass: aClass should: aBlock\x0a\x09self\x0a\x09\x09whileInstalled: aString\x0a\x09\x09inClass: aClass\x0a\x09\x09should: [ aBlock value: [\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09interpret: aString\x0a\x09\x09\x09\x09forClass: aClass\x0a\x09\x09\x09\x09receiver: receiver\x0a\x09\x09\x09\x09withArguments: #{} ] ]",
|
|
|
-referencedClasses: [],
|
|
|
+args: [],
|
|
|
+source: "testJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <inlineJS: ''consolee.log(1)''>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
|
|
|
+referencedClasses: ["Object"],
|
|
|
|
|
|
pragmas: [],
|
|
|
-messageSends: ["whileInstalled:inClass:should:", "value:", "interpret:forClass:receiver:withArguments:"]
|
|
|
-}, function ($methodClass){ return function (aString,aClass,aBlock){
|
|
|
+messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
var self=this,$self=this;
|
|
|
+var ast,visitor;
|
|
|
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
|
|
|
-$self._whileInstalled_inClass_should_(aString,aClass,(function(){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-
|
|
|
-return $recv(aBlock)._value_((function(){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx3) {
|
|
|
-
|
|
|
-return $self._interpret_forClass_receiver_withArguments_(aString,aClass,$self.receiver,$globals.HashedCollection._newFromPairs_([]));
|
|
|
-
|
|
|
-}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
-
|
|
|
-}));
|
|
|
-
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
-
|
|
|
-}));
|
|
|
+var $3,$2,$1;
|
|
|
+ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
|
|
|
+$3=$self._astPCNodeVisitor();
|
|
|
+$recv($3)._visit_(ast);
|
|
|
+$2=$recv($3)._currentNode();
|
|
|
+$1=$recv($2)._isJSStatementNode();
|
|
|
+$self._assert_($1);
|
|
|
return self;
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"while:inClass:should:",{aString:aString,aClass:aClass,aBlock:aBlock})});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor})});
|
|
|
|
|
|
}; }),
|
|
|
-$globals.ASTInterpreterTest);
|
|
|
-
|
|
|
-
|
|
|
+$globals.ASTPCNodeVisitorTest);
|
|
|
|
|
|
-$core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "interpret:forClass:receiver:withArguments:",
|
|
|
-protocol: "private",
|
|
|
+selector: "testMessageSend",
|
|
|
+protocol: "tests",
|
|
|
|
|
|
-args: ["aString", "aClass", "anObject", "aDictionary"],
|
|
|
-source: "interpret: aString forClass: aClass receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx |\x0a\x09\x0a\x09ctx := self prepareContextFor: aString class: aClass receiver: anObject withArguments: aDictionary.\x0a\x09\x0a\x09^ (ASTDebugger context: ctx) proceed; result",
|
|
|
-referencedClasses: ["ASTDebugger"],
|
|
|
+args: [],
|
|
|
+source: "testMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo self asString yourself. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
|
|
|
+referencedClasses: ["Object"],
|
|
|
|
|
|
pragmas: [],
|
|
|
-messageSends: ["prepareContextFor:class:receiver:withArguments:", "proceed", "context:", "result"]
|
|
|
-}, function ($methodClass){ return function (aString,aClass,anObject,aDictionary){
|
|
|
+messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
var self=this,$self=this;
|
|
|
-var ctx;
|
|
|
+var ast;
|
|
|
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
|
|
|
-var $1;
|
|
|
-ctx=$self._prepareContextFor_class_receiver_withArguments_(aString,aClass,anObject,aDictionary);
|
|
|
-$1=$recv($globals.ASTDebugger)._context_(ctx);
|
|
|
-$recv($1)._proceed();
|
|
|
-return $recv($1)._result();
|
|
|
+var $3,$2,$1;
|
|
|
+ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
|
|
|
+$3=$self._astPCNodeVisitorForSelector_("yourself");
|
|
|
+$recv($3)._visit_(ast);
|
|
|
+$2=$recv($3)._currentNode();
|
|
|
+$1=$recv($2)._selector();
|
|
|
+$self._assert_equals_($1,"yourself");
|
|
|
+return self;
|
|
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"interpret:forClass:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,aDictionary:aDictionary,ctx:ctx})});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast})});
|
|
|
|
|
|
}; }),
|
|
|
-$globals.ASTDebuggerTest);
|
|
|
-
|
|
|
-
|
|
|
+$globals.ASTPCNodeVisitorTest);
|
|
|
|
|
|
-$core.addClass("CodeGeneratorTest", $globals.AbstractCompilerTest, [], "Compiler-Tests");
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "codeGeneratorClass",
|
|
|
-protocol: "accessing",
|
|
|
+selector: "testMessageSendWithBlocks",
|
|
|
+protocol: "tests",
|
|
|
|
|
|
args: [],
|
|
|
-source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
|
|
|
-referencedClasses: ["CodeGenerator"],
|
|
|
+source: "testMessageSendWithBlocks\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
|
|
|
+referencedClasses: ["Object"],
|
|
|
|
|
|
pragmas: [],
|
|
|
-messageSends: []
|
|
|
+messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
|
|
|
}, function ($methodClass){ return function (){
|
|
|
var self=this,$self=this;
|
|
|
-return $globals.CodeGenerator;
|
|
|
-
|
|
|
+var ast;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $3,$2,$1;
|
|
|
+ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
|
|
|
+$3=$self._astPCNodeVisitorForSelector_("yourself");
|
|
|
+$recv($3)._visit_(ast);
|
|
|
+$2=$recv($3)._currentNode();
|
|
|
+$1=$recv($2)._selector();
|
|
|
+$self._assert_equals_($1,"yourself");
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast})});
|
|
|
+
|
|
|
}; }),
|
|
|
-$globals.CodeGeneratorTest);
|
|
|
+$globals.ASTPCNodeVisitorTest);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "while:inClass:should:",
|
|
|
-protocol: "testing",
|
|
|
+selector: "testMessageSendWithInlining",
|
|
|
+protocol: "tests",
|
|
|
|
|
|
-args: ["aString", "aClass", "aBlock"],
|
|
|
-source: "while: aString inClass: aClass should: aBlock\x0a\x09self\x0a\x09\x09whileInstalled: aString\x0a\x09\x09inClass: aClass\x0a\x09\x09should: [ :method | aBlock value: [\x0a\x09\x09\x09receiver perform: method selector ] ]",
|
|
|
-referencedClasses: [],
|
|
|
+args: [],
|
|
|
+source: "testMessageSendWithInlining\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'.\x0a\x09\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'asBoolean')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'asBoolean'",
|
|
|
+referencedClasses: ["Object"],
|
|
|
|
|
|
pragmas: [],
|
|
|
-messageSends: ["whileInstalled:inClass:should:", "value:", "perform:", "selector"]
|
|
|
-}, function ($methodClass){ return function (aString,aClass,aBlock){
|
|
|
+messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
var self=this,$self=this;
|
|
|
+var ast;
|
|
|
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
|
|
|
-$self._whileInstalled_inClass_should_(aString,aClass,(function(method){
|
|
|
+var $3,$4,$2,$1,$7,$6,$5;
|
|
|
+ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
|
|
|
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
+$ctx1.sendIdx["parse:forClass:"]=1;
|
|
|
|
|
|
-return $recv(aBlock)._value_((function(){
|
|
|
-
|
|
|
-return $core.withContext(function($ctx3) {
|
|
|
-
|
|
|
-return $recv($self.receiver)._perform_($recv(method)._selector());
|
|
|
-
|
|
|
-}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
-
|
|
|
-}));
|
|
|
-
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
|
|
|
-
|
|
|
-}));
|
|
|
-return self;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"while:inClass:should:",{aString:aString,aClass:aClass,aBlock:aBlock})});
|
|
|
-
|
|
|
-}; }),
|
|
|
-$globals.CodeGeneratorTest);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-$core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "codeGeneratorClass",
|
|
|
-protocol: "accessing",
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
|
|
|
-referencedClasses: ["InliningCodeGenerator"],
|
|
|
-
|
|
|
-pragmas: [],
|
|
|
-messageSends: []
|
|
|
-}, function ($methodClass){ return function (){
|
|
|
-var self=this,$self=this;
|
|
|
-return $globals.InliningCodeGenerator;
|
|
|
-
|
|
|
-}; }),
|
|
|
-$globals.InliningCodeGeneratorTest);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-$core.addClass("ASTPCNodeVisitorTest", $globals.TestCase, [], "Compiler-Tests");
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "astPCNodeVisitor",
|
|
|
-protocol: "factory",
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
|
|
|
-referencedClasses: ["ASTPCNodeVisitor"],
|
|
|
-
|
|
|
-pragmas: [],
|
|
|
-messageSends: ["index:", "new", "yourself"]
|
|
|
-}, function ($methodClass){ return function (){
|
|
|
-var self=this,$self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-var $1;
|
|
|
-$1=$recv($globals.ASTPCNodeVisitor)._new();
|
|
|
-$recv($1)._index_((0));
|
|
|
-return $recv($1)._yourself();
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{})});
|
|
|
-
|
|
|
-}; }),
|
|
|
-$globals.ASTPCNodeVisitorTest);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "astPCNodeVisitorForSelector:",
|
|
|
-protocol: "factory",
|
|
|
-
|
|
|
-args: ["aString"],
|
|
|
-source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
|
|
|
-referencedClasses: ["ASTPCNodeVisitor"],
|
|
|
-
|
|
|
-pragmas: [],
|
|
|
-messageSends: ["selector:", "new", "index:", "yourself"]
|
|
|
-}, function ($methodClass){ return function (aString){
|
|
|
-var self=this,$self=this;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-var $1;
|
|
|
-$1=$recv($globals.ASTPCNodeVisitor)._new();
|
|
|
-$recv($1)._selector_(aString);
|
|
|
-$recv($1)._index_((0));
|
|
|
-return $recv($1)._yourself();
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString})});
|
|
|
-
|
|
|
-}; }),
|
|
|
-$globals.ASTPCNodeVisitorTest);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "testJSStatementNode",
|
|
|
-protocol: "tests",
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "testJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <inlineJS: ''consolee.log(1)''>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
|
|
|
-referencedClasses: ["Object"],
|
|
|
-
|
|
|
-pragmas: [],
|
|
|
-messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
|
|
|
-}, function ($methodClass){ return function (){
|
|
|
-var self=this,$self=this;
|
|
|
-var ast,visitor;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-var $3,$2,$1;
|
|
|
-ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
|
|
|
-$3=$self._astPCNodeVisitor();
|
|
|
-$recv($3)._visit_(ast);
|
|
|
-$2=$recv($3)._currentNode();
|
|
|
-$1=$recv($2)._isJSStatementNode();
|
|
|
-$self._assert_($1);
|
|
|
-return self;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor})});
|
|
|
-
|
|
|
-}; }),
|
|
|
-$globals.ASTPCNodeVisitorTest);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "testMessageSend",
|
|
|
-protocol: "tests",
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "testMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo self asString yourself. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
|
|
|
-referencedClasses: ["Object"],
|
|
|
-
|
|
|
-pragmas: [],
|
|
|
-messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
|
|
|
-}, function ($methodClass){ return function (){
|
|
|
-var self=this,$self=this;
|
|
|
-var ast;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-var $3,$2,$1;
|
|
|
-ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
|
|
|
-$3=$self._astPCNodeVisitorForSelector_("yourself");
|
|
|
-$recv($3)._visit_(ast);
|
|
|
-$2=$recv($3)._currentNode();
|
|
|
-$1=$recv($2)._selector();
|
|
|
-$self._assert_equals_($1,"yourself");
|
|
|
-return self;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast})});
|
|
|
-
|
|
|
-}; }),
|
|
|
-$globals.ASTPCNodeVisitorTest);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "testMessageSendWithBlocks",
|
|
|
-protocol: "tests",
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "testMessageSendWithBlocks\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
|
|
|
-referencedClasses: ["Object"],
|
|
|
-
|
|
|
-pragmas: [],
|
|
|
-messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
|
|
|
-}, function ($methodClass){ return function (){
|
|
|
-var self=this,$self=this;
|
|
|
-var ast;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-var $3,$2,$1;
|
|
|
-ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
|
|
|
-$3=$self._astPCNodeVisitorForSelector_("yourself");
|
|
|
-$recv($3)._visit_(ast);
|
|
|
-$2=$recv($3)._currentNode();
|
|
|
-$1=$recv($2)._selector();
|
|
|
-$self._assert_equals_($1,"yourself");
|
|
|
-return self;
|
|
|
-
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast})});
|
|
|
-
|
|
|
-}; }),
|
|
|
-$globals.ASTPCNodeVisitorTest);
|
|
|
-
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "testMessageSendWithInlining",
|
|
|
-protocol: "tests",
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "testMessageSendWithInlining\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'.\x0a\x09\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'asBoolean')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'asBoolean'",
|
|
|
-referencedClasses: ["Object"],
|
|
|
-
|
|
|
-pragmas: [],
|
|
|
-messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
|
|
|
-}, function ($methodClass){ return function (){
|
|
|
-var self=this,$self=this;
|
|
|
-var ast;
|
|
|
-
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
-
|
|
|
-var $3,$4,$2,$1,$7,$6,$5;
|
|
|
-ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
|
|
|
-
|
|
|
-$ctx1.sendIdx["parse:forClass:"]=1;
|
|
|
-
|
|
|
-$3=$self._astPCNodeVisitorForSelector_("yourself");
|
|
|
+$3=$self._astPCNodeVisitorForSelector_("yourself");
|
|
|
|
|
|
$ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
|
|
|
|
|
@@ -2156,25 +1879,7 @@ $globals.ASTPositionTest);
|
|
|
|
|
|
|
|
|
|
|
|
-$core.addClass("CodeGeneratorInstallTest", $globals.TestCase, ["receiver"], "Compiler-Tests");
|
|
|
-$core.addMethod(
|
|
|
-$core.method({
|
|
|
-selector: "codeGeneratorClass",
|
|
|
-protocol: "accessing",
|
|
|
-
|
|
|
-args: [],
|
|
|
-source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
|
|
|
-referencedClasses: ["CodeGenerator"],
|
|
|
-
|
|
|
-pragmas: [],
|
|
|
-messageSends: []
|
|
|
-}, function ($methodClass){ return function (){
|
|
|
-var self=this,$self=this;
|
|
|
-return $globals.CodeGenerator;
|
|
|
-
|
|
|
-}; }),
|
|
|
-$globals.CodeGeneratorInstallTest);
|
|
|
-
|
|
|
+$core.addClass("AbstractCodeGeneratorInstallTest", $globals.TestCase, ["receiver"], "Compiler-Tests");
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
selector: "receiver",
|
|
@@ -2191,7 +1896,7 @@ var self=this,$self=this;
|
|
|
return $self.receiver;
|
|
|
|
|
|
}; }),
|
|
|
-$globals.CodeGeneratorInstallTest);
|
|
|
+$globals.AbstractCodeGeneratorInstallTest);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -2251,7 +1956,7 @@ return self;
|
|
|
}, function($ctx1) {$ctx1.fill(self,"shouldntInstall:",{aString:aString,method:method})});
|
|
|
|
|
|
}; }),
|
|
|
-$globals.CodeGeneratorInstallTest);
|
|
|
+$globals.AbstractCodeGeneratorInstallTest);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -2275,7 +1980,7 @@ return self;
|
|
|
}, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{})});
|
|
|
|
|
|
}; }),
|
|
|
-$globals.CodeGeneratorInstallTest);
|
|
|
+$globals.AbstractCodeGeneratorInstallTest);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -2326,7 +2031,7 @@ return self;
|
|
|
}, function($ctx1) {$ctx1.fill(self,"testNiladicJSOverride",{})});
|
|
|
|
|
|
}; }),
|
|
|
-$globals.CodeGeneratorInstallTest);
|
|
|
+$globals.AbstractCodeGeneratorInstallTest);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -2394,7 +2099,7 @@ return self;
|
|
|
}, function($ctx1) {$ctx1.fill(self,"testNiladicJSOverrideDifferentNames",{})});
|
|
|
|
|
|
}; }),
|
|
|
-$globals.CodeGeneratorInstallTest);
|
|
|
+$globals.AbstractCodeGeneratorInstallTest);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
@@ -2418,30 +2123,43 @@ return self;
|
|
|
}, function($ctx1) {$ctx1.fill(self,"testPragmaInBlock",{})});
|
|
|
|
|
|
}; }),
|
|
|
-$globals.CodeGeneratorInstallTest);
|
|
|
+$globals.AbstractCodeGeneratorInstallTest);
|
|
|
|
|
|
|
|
|
-
|
|
|
-$core.addClass("InliningCodeGeneratorInstallTest", $globals.CodeGeneratorInstallTest, [], "Compiler-Tests");
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "codeGeneratorClass",
|
|
|
-protocol: "accessing",
|
|
|
+selector: "isAbstract",
|
|
|
+protocol: "testing",
|
|
|
|
|
|
args: [],
|
|
|
-source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
|
|
|
-referencedClasses: ["InliningCodeGenerator"],
|
|
|
+source: "isAbstract\x0a\x09^ self name = AbstractCodeGeneratorInstallTest name",
|
|
|
+referencedClasses: ["AbstractCodeGeneratorInstallTest"],
|
|
|
|
|
|
pragmas: [],
|
|
|
-messageSends: []
|
|
|
+messageSends: ["=", "name"]
|
|
|
}, function ($methodClass){ return function (){
|
|
|
var self=this,$self=this;
|
|
|
-return $globals.InliningCodeGenerator;
|
|
|
-
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $1;
|
|
|
+$1=$self._name();
|
|
|
+
|
|
|
+$ctx1.sendIdx["name"]=1;
|
|
|
+
|
|
|
+return $recv($1).__eq($recv($globals.AbstractCodeGeneratorInstallTest)._name());
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"isAbstract",{})});
|
|
|
+
|
|
|
}; }),
|
|
|
-$globals.InliningCodeGeneratorInstallTest);
|
|
|
+$globals.AbstractCodeGeneratorInstallTest.a$cls);
|
|
|
+
|
|
|
+
|
|
|
+$core.addClass("CodeGeneratorInstallTest", $globals.AbstractCodeGeneratorInstallTest, [], "Compiler-Tests");
|
|
|
|
|
|
|
|
|
+$core.addClass("InliningCodeGeneratorInstallTest", $globals.AbstractCodeGeneratorInstallTest, [], "Compiler-Tests");
|
|
|
+
|
|
|
|
|
|
$core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
|
|
|
$core.addMethod(
|
|
@@ -3554,10 +3272,276 @@ return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_(aString,aC
|
|
|
}; }),
|
|
|
$globals.TASTParsingTest);
|
|
|
|
|
|
+
|
|
|
+$core.addTrait("TCTDebugged", "Compiler-Tests");
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "interpret:forClass:receiver:withArguments:",
|
|
|
+protocol: "private",
|
|
|
+
|
|
|
+args: ["aString", "aClass", "anObject", "aDictionary"],
|
|
|
+source: "interpret: aString forClass: aClass receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx |\x0a\x09\x0a\x09ctx := self prepareContextFor: aString class: aClass receiver: anObject withArguments: aDictionary.\x0a\x09\x0a\x09^ (ASTDebugger context: ctx) proceed; result",
|
|
|
+referencedClasses: ["ASTDebugger"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["prepareContextFor:class:receiver:withArguments:", "proceed", "context:", "result"]
|
|
|
+}, function ($methodClass){ return function (aString,aClass,anObject,aDictionary){
|
|
|
+var self=this,$self=this;
|
|
|
+var ctx;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $1;
|
|
|
+ctx=$self._prepareContextFor_class_receiver_withArguments_(aString,aClass,anObject,aDictionary);
|
|
|
+$1=$recv($globals.ASTDebugger)._context_(ctx);
|
|
|
+$recv($1)._proceed();
|
|
|
+return $recv($1)._result();
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"interpret:forClass:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,aDictionary:aDictionary,ctx:ctx})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.TCTDebugged);
|
|
|
+
|
|
|
+
|
|
|
+$core.addTrait("TCTExecuted", "Compiler-Tests");
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "while:inClass:should:",
|
|
|
+protocol: "testing",
|
|
|
+
|
|
|
+args: ["aString", "aClass", "aBlock"],
|
|
|
+source: "while: aString inClass: aClass should: aBlock\x0a\x09super\x0a\x09\x09while: aString\x0a\x09\x09inClass: aClass\x0a\x09\x09should: [ :method | aBlock value: [\x0a\x09\x09\x09self receiver perform: method selector ] ]",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["while:inClass:should:", "value:", "perform:", "receiver", "selector"]
|
|
|
+}, function ($methodClass){ return function (aString,aClass,aBlock){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+(
|
|
|
+
|
|
|
+$ctx1.supercall = true,
|
|
|
+
|
|
|
+($methodClass.superclass||$boot.nilAsClass).fn.prototype._while_inClass_should_.call($self,aString,aClass,(function(method){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv(aBlock)._value_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $recv($self._receiver())._perform_($recv(method)._selector());
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
|
|
|
+
|
|
|
+})));
|
|
|
+
|
|
|
+$ctx1.supercall = false;
|
|
|
+
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"while:inClass:should:",{aString:aString,aClass:aClass,aBlock:aBlock})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.TCTExecuted);
|
|
|
+
|
|
|
+
|
|
|
+$core.addTrait("TCTInlined", "Compiler-Tests");
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "codeGeneratorClass",
|
|
|
+protocol: "accessing",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
|
|
|
+referencedClasses: ["InliningCodeGenerator"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: []
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+return $globals.InliningCodeGenerator;
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.TCTInlined);
|
|
|
+
|
|
|
+
|
|
|
+$core.addTrait("TCTInterpreted", "Compiler-Tests");
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "interpret:forClass:receiver:withArguments:",
|
|
|
+protocol: "private",
|
|
|
+
|
|
|
+args: ["aString", "aClass", "anObject", "aDictionary"],
|
|
|
+source: "interpret: aString forClass: aClass receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx |\x0a\x09\x0a\x09ctx := self prepareContextFor: aString class: aClass receiver: anObject withArguments: aDictionary.\x0a\x09\x0a\x09^ ctx interpreter proceed; result",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["prepareContextFor:class:receiver:withArguments:", "proceed", "interpreter", "result"]
|
|
|
+}, function ($methodClass){ return function (aString,aClass,anObject,aDictionary){
|
|
|
+var self=this,$self=this;
|
|
|
+var ctx;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $1;
|
|
|
+ctx=$self._prepareContextFor_class_receiver_withArguments_(aString,aClass,anObject,aDictionary);
|
|
|
+$1=$recv(ctx)._interpreter();
|
|
|
+$recv($1)._proceed();
|
|
|
+return $recv($1)._result();
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"interpret:forClass:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,aDictionary:aDictionary,ctx:ctx})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.TCTInterpreted);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "prepareContextFor:class:receiver:withArguments:",
|
|
|
+protocol: "private",
|
|
|
+
|
|
|
+args: ["aString", "aClass", "anObject", "aDictionary"],
|
|
|
+source: "prepareContextFor: aString class: aClass receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast |\x0a\x09\x0a\x09ast := self parse: aString forClass: aClass.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09selector: ast selector;\x0a\x09\x09interpreter: ASTInterpreter new;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09\x0a\x09ctx interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09node: ast;\x0a\x09\x09enterNode.\x0a\x09\x0a\x09^ctx",
|
|
|
+referencedClasses: ["AIContext", "ASTInterpreter"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["parse:forClass:", "receiver:", "new", "selector:", "selector", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode"]
|
|
|
+}, function ($methodClass){ return function (aString,aClass,anObject,aDictionary){
|
|
|
+var self=this,$self=this;
|
|
|
+var ctx,ast;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $1,$2,$3,$receiver;
|
|
|
+ast=$self._parse_forClass_(aString,aClass);
|
|
|
+$1=$recv($globals.AIContext)._new();
|
|
|
+
|
|
|
+$ctx1.sendIdx["new"]=1;
|
|
|
+
|
|
|
+$recv($1)._receiver_(anObject);
|
|
|
+$recv($1)._selector_($recv(ast)._selector());
|
|
|
+$recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
|
|
|
+ctx=$recv($1)._yourself();
|
|
|
+$2=$recv(ast)._sequenceNode();
|
|
|
+if(($receiver = $2) == null || $receiver.a$nil){
|
|
|
+$2;
|
|
|
+} else {
|
|
|
+var sequence;
|
|
|
+sequence=$receiver;
|
|
|
+$recv($recv(sequence)._temps())._do_((function(each){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv(ctx)._defineLocal_(each);
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
|
|
|
+
|
|
|
+}));
|
|
|
+}
|
|
|
+$recv(aDictionary)._keysAndValuesDo_((function(key,value){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv(ctx)._localAt_put_(key,value);
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
|
|
|
+
|
|
|
+}));
|
|
|
+$3=$recv(ctx)._interpreter();
|
|
|
+$recv($3)._context_(ctx);
|
|
|
+$recv($3)._node_(ast);
|
|
|
+$recv($3)._enterNode();
|
|
|
+return ctx;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"prepareContextFor:class:receiver:withArguments:",{aString:aString,aClass:aClass,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.TCTInterpreted);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "while:inClass:should:",
|
|
|
+protocol: "testing",
|
|
|
+
|
|
|
+args: ["aString", "aClass", "aBlock"],
|
|
|
+source: "while: aString inClass: aClass should: aBlock\x0a\x09super\x0a\x09\x09while: aString\x0a\x09\x09inClass: aClass\x0a\x09\x09should: [ aBlock value: [\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09interpret: aString\x0a\x09\x09\x09\x09forClass: aClass\x0a\x09\x09\x09\x09receiver: self receiver\x0a\x09\x09\x09\x09withArguments: #{} ] ]",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["while:inClass:should:", "value:", "interpret:forClass:receiver:withArguments:", "receiver"]
|
|
|
+}, function ($methodClass){ return function (aString,aClass,aBlock){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+(
|
|
|
+
|
|
|
+$ctx1.supercall = true,
|
|
|
+
|
|
|
+($methodClass.superclass||$boot.nilAsClass).fn.prototype._while_inClass_should_.call($self,aString,aClass,(function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv(aBlock)._value_((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx3) {
|
|
|
+
|
|
|
+return $self._interpret_forClass_receiver_withArguments_(aString,aClass,$self._receiver(),$globals.HashedCollection._newFromPairs_([]));
|
|
|
+
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+
|
|
|
+})));
|
|
|
+
|
|
|
+$ctx1.supercall = false;
|
|
|
+
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"while:inClass:should:",{aString:aString,aClass:aClass,aBlock:aBlock})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.TCTInterpreted);
|
|
|
+
|
|
|
+
|
|
|
+$core.addTrait("TCTNonInlined", "Compiler-Tests");
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "codeGeneratorClass",
|
|
|
+protocol: "accessing",
|
|
|
+
|
|
|
+args: [],
|
|
|
+source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
|
|
|
+referencedClasses: ["CodeGenerator"],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: []
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+return $globals.CodeGenerator;
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.TCTNonInlined);
|
|
|
+
|
|
|
$core.setTraitComposition([{trait: $globals.TASTParsingTest}], $globals.TASTCompilingTest);
|
|
|
-$core.setTraitComposition([{trait: $globals.TASTCompilingTest, aliases: {"whileInstalled:inClass:should:":"while:inClass:should:"}, exclusions: ["while:inClass:should:"]}], $globals.ASTMethodRunningTest);
|
|
|
+$core.setTraitComposition([{trait: $globals.TCTInterpreted}], $globals.TCTDebugged);
|
|
|
+$core.setTraitComposition([{trait: $globals.TASTCompilingTest}], $globals.ASTMethodRunningTest);
|
|
|
+$core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTDebugged}], $globals.ASTDebuggerTest);
|
|
|
+$core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTInterpreted}], $globals.ASTInterpreterTest);
|
|
|
+$core.setTraitComposition([{trait: $globals.TCTNonInlined}, {trait: $globals.TCTExecuted}], $globals.CodeGeneratorTest);
|
|
|
+$core.setTraitComposition([{trait: $globals.TCTInlined}, {trait: $globals.TCTExecuted}], $globals.InliningCodeGeneratorTest);
|
|
|
$core.setTraitComposition([{trait: $globals.TASTParsingTest}], $globals.ASTPCNodeVisitorTest);
|
|
|
$core.setTraitComposition([{trait: $globals.TASTParsingTest}], $globals.ASTPositionTest);
|
|
|
-$core.setTraitComposition([{trait: $globals.TASTCompilingTest}], $globals.CodeGeneratorInstallTest);
|
|
|
+$core.setTraitComposition([{trait: $globals.TASTCompilingTest}], $globals.AbstractCodeGeneratorInstallTest);
|
|
|
+$core.setTraitComposition([{trait: $globals.TCTNonInlined}], $globals.CodeGeneratorInstallTest);
|
|
|
+$core.setTraitComposition([{trait: $globals.TCTInlined}], $globals.InliningCodeGeneratorInstallTest);
|
|
|
|
|
|
});
|