194 posts
|
Hi guys!
I'm using AST really often, and recently stumbled on problem with copying an AST.
It doesn't copy stuff related to computing sourceInterval of AST, and I need it to copy:)
I know there are #deepCopy and #veryDeepCopy, but they are too heavy methods for AST, especially in my case, as I need to copy AST all the time.
Earlier, I discussed this problem with Marcus Denker. He suggested to fix #copy of AST (to be more accurate #postCopy).
If I want to copy stuff related to sourceInterval, I would have to implement #postCopy for each RBNode... differently.
RBProgramNode>>#postCopy
super postCopy.
properties := properties copy
So for each RBNode... it will be like:
RBNode...>>#postCopy
super postCopy.
"here some different code each time"
I'm just interested: What do you think about it?
Thanks,
Mark
|