Parcourir la source

ASTInterpreter: setting up sequence local upon entering

... not upon leaving a node
Herbert Vojčík il y a 9 ans
Parent
commit
87d1d806e6
2 fichiers modifiés avec 47 ajouts et 37 suppressions
  1. 41 32
      src/Compiler-Interpreter.js
  2. 6 5
      src/Compiler-Interpreter.st

+ 41 - 32
src/Compiler-Interpreter.js

@@ -2190,6 +2190,47 @@ messageSends: ["node", "at:ifPresent:ifAbsent:", "refResults", "interpreter", "n
 }),
 $globals.ASTEnterNode);
 
+$core.addMethod(
+$core.method({
+selector: "visitSequenceNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$recv($recv(aNode)._temps())._do_((function(each){
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx2) {
+//>>excludeEnd("ctx");
+return $recv($recv(self._interpreter())._context())._defineLocal_(each);
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
+//>>excludeEnd("ctx");
+}));
+$1=(
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.supercall = true, 
+//>>excludeEnd("ctx");
+($globals.ASTEnterNode.superclass||$boot.dnu).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.supercall = false;
+//>>excludeEnd("ctx");;
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
+}),
+$globals.ASTEnterNode);
+
 
 $core.addMethod(
 $core.method({
@@ -3485,38 +3526,6 @@ messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:",
 }),
 $globals.ASTInterpreter);
 
-$core.addMethod(
-$core.method({
-selector: "visitSequenceNode:",
-protocol: 'visiting',
-fn: function (aNode){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-$recv($recv(aNode)._temps())._do_((function(each){
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx2) {
-//>>excludeEnd("ctx");
-return $recv(self._context())._defineLocal_(each);
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
-//>>excludeEnd("ctx");
-}));
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aNode"],
-source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self context defineLocal: each ]",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["do:", "temps", "defineLocal:", "context"]
-}),
-$globals.ASTInterpreter);
-
 $core.addMethod(
 $core.method({
 selector: "visitValueNode:",

+ 6 - 5
src/Compiler-Interpreter.st

@@ -572,6 +572,12 @@ visitRefNode: aNode
 	self interpreter refResults at: ref nodeId
 		ifPresent: [ ^ aNode ]
 		ifAbsent: [ ref parent: aNode. ^ super visitRefNode: aNode ]
+!
+
+visitSequenceNode: aNode
+	aNode temps do: [ :each |
+		self interpreter context defineLocal: each ].
+	^ super visitSequenceNode: aNode
 ! !
 
 !ASTEnterNode class methodsFor: 'instance creation'!
@@ -901,11 +907,6 @@ visitSendNode: aNode
 		ifFalse: [ self push: result ]
 !
 
-visitSequenceNode: aNode
-	aNode temps do: [ :each |
-		self context defineLocal: each ]
-!
-
 visitValueNode: aNode
 	self push: aNode value
 !