help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Re: last tests patch for a while -- ParseTreeRewrit


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] Re: last tests patch for a while -- ParseTreeRewriter
Date: Wed, 23 May 2007 08:24:45 +0200
User-agent: Thunderbird 2.0.0.0 (Macintosh/20070326)

Stephen Compall wrote:
On Tue, 2007-05-22 at 10:17 +0200, Paolo Bonzini wrote:
-           newValue := oldContext at: key put: value "deepCopy <<<".
+           newValue := oldContext at: key put: value deepCopy "<<<".

Quick postscript on this: I originally used `value collect: [:each |
each copy]' instead of deepCopy because value may be a node instead of a
list of nodes.  (RBProgramNode has 'collect: aBlock  ^aBlock value:
self'.)  So deepCopy copies the 'parent' instvar, which copies the value
and everything else in its tree.


Thanks for the explanation.  I added instead this one:

--- orig/compiler/RBParseNodes.st
+++ mod/compiler/RBParseNodes.st
@@ -253,6 +253,13 @@ nodesDo: aBlock

 !RBProgramNode methodsFor: 'enumeration'!

+deepCopy
+    "Hacked to fit collection protocols.  We use #deepCopy to obtain a list
+     of copied nodes.  We do already copy for our instance variables
+     through #postCopy, so we redirect #deepCopy to be a normal #copy."
+
+    ^self copy
+
 collect: aBlock
     "Hacked to fit collection protocols"


Thanks again for contributing these tests and bug fixes. I will contact other people I know that work on the refactoring browser in order to have them merged.

Paolo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]