2
0
Ver Fonte

ASTInterprerTests: fix interpreting first child twice

(not manifested, as it was always value / variable anyway)
Herbert Vojčík há 9 anos atrás
pai
commit
3abd57bd83

+ 0 - 25
src/Compiler-Interpreter.js

@@ -2324,31 +2324,6 @@ messageSends: ["visit:", "node"]
 }),
 $globals.ASTInterpreter);
 
-$core.addMethod(
-$core.method({
-selector: "interpret:",
-protocol: 'interpreting',
-fn: function (aNode){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-self._node_(aNode);
-self._interpret();
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},$globals.ASTInterpreter)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["node:", "interpret"]
-}),
-$globals.ASTInterpreter);
-
 $core.addMethod(
 $core.method({
 selector: "messageFromSendNode:arguments:",

+ 0 - 5
src/Compiler-Interpreter.st

@@ -607,11 +607,6 @@ interpret
 	self visit: self node
 !
 
-interpret: aNode
-	self node: aNode.
-	self interpret
-!
-
 next
 	self node: self node nextNode
 !

+ 3 - 3
src/Compiler-Tests.js

@@ -1867,7 +1867,7 @@ return $recv(ctx)._localAt_put_(key,value);
 }));
 $3=interpreter;
 $recv($3)._context_(ctx);
-$recv($3)._interpret_($recv(ast)._nextChild());
+$recv($3)._node_($recv(ast)._nextChild());
 $recv($3)._proceed();
 return $recv($3)._result();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
@@ -1876,10 +1876,10 @@ return $recv($3)._result();
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["aString", "anObject", "aDictionary"],
-source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast interpreter |\x0a\x09\x0a\x09interpreter := ASTInterpreter new.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: interpreter;\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\x09^ interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09interpret: ast nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
+source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast interpreter |\x0a\x09\x0a\x09interpreter := ASTInterpreter new.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: interpreter;\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\x09^ interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09node: ast nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
 referencedClasses: ["ASTInterpreter", "AIContext"],
 //>>excludeEnd("ide");
-messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpret:", "nextChild", "proceed", "result"]
+messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "nextChild", "proceed", "result"]
 }),
 $globals.ASTInterpreterTest);
 

+ 1 - 1
src/Compiler-Tests.st

@@ -510,7 +510,7 @@ interpret: aString receiver: anObject withArguments: aDictionary
 	
 	^ interpreter
 		context: ctx;
-		interpret: ast nextChild;
+		node: ast nextChild;
 		proceed;
 		result
 ! !