Use RBVariableNode>>name: to change variable's name.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 19 Jun 2015 07:14:07 +0100
changeset 500 cf3cbf3933f1
parent 499 835999517f15
child 501 e29bd90f388e
Use RBVariableNode>>name: to change variable's name. The old way - `node token value:` is working in Pharo - there's no token in RBVariableNode. Sigh.
compiler/PPCCodeGenerator.st
--- a/compiler/PPCCodeGenerator.st	Fri Jun 19 06:53:06 2015 +0100
+++ b/compiler/PPCCodeGenerator.st	Fri Jun 19 07:14:07 2015 +0100
@@ -285,16 +285,16 @@
     blockNeedsCollection ifTrue:[
         "Bad, we have to use the collection.
          Replace all references to blockNodeVar to retvalVar..."
-        blockBody variableNodesDo:[:variableNode| 
+        self withAllVariableNodesOf: blockBody do:[:variableNode| 
             variableNode name = blockNodesVar name ifTrue:[ 
-                variableNode token value: self retvalVar.
+                variableNode name: self retvalVar.
             ].
         ].
     ] ifFalse:[ 
         "Good, can avoid intermediate collection.
          Replace references to collection with corresponding temporary variable"
-        blockMatches keysAndValuesDo:[:node :childValueVar |
-            node parent replaceNode: node withNode: (RBVariableNode named: childValueVar).
+        blockMatches keysAndValuesDo:[:matchingNode :childValueVar |
+            matchingNode parent replaceNode: matchingNode withNode: (RBVariableNode named: childValueVar).
         ].
         node child returnParsedObjectsAsCollection: false. 
     ].
@@ -323,7 +323,7 @@
         compiler code: blockBody.    
     ]
 
-    "Modified: / 18-06-2015 / 22:03:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 19-06-2015 / 07:05:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 visitAndNode: node
@@ -533,7 +533,7 @@
         blockArg := blockNode arguments first.
         self withAllVariableNodesOf: blockBody do:[:variableNode| 
             variableNode name = blockArg name ifTrue:[ 
-                variableNode token value: self retvalVar.
+                variableNode name: self retvalVar.
             ].
         ]. 
     ].
@@ -557,7 +557,7 @@
     ]
 
     "Created: / 02-06-2015 / 17:28:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 18-06-2015 / 22:03:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 19-06-2015 / 07:06:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 visitMessagePredicateNode: node