help-smalltalk
[Top][All Lists]
Advanced

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

Re: [Help-smalltalk] ParseTreeRewriter refactoring


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] ParseTreeRewriter refactoring
Date: Fri, 12 Jan 2007 10:51:48 +0100
User-agent: Thunderbird 1.5.0.9 (Macintosh/20061207)


Please don't use deepCopy here; it copies too much data from the
original tree.  collect: [:node | node copy] does exactly the right
thing in both the single-node and node-collection cases.

No, it does exactly the same:

deepCopy
    "Returns a deep copy of the receiver (the instance variables are
     copies of the receiver's instance variables)"
    | class aCopy num |
    class := self class.
    aCopy := self shallowCopy.
    class isPointers
        ifTrue: [ num := class instSize + self basicSize ]
        ifFalse: [ num := class instSize ].

    " copy the instance variables (if any) "
    1 to: num do: [ :i |
        aCopy instVarAt: i put: (self instVarAt: i) copy.
    ].
    ^aCopy
! !

+visitNodes: aNodeList
+    ^self visitNodes: aNodeList searches: searches onMatch: [:newNodes |]!

Why does this inline visitNodes:onMatch:?  (As with visitArguments:.)

Just because, I'll undo this inlining.

Thanks,

Paolo




reply via email to

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