Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Applying Multiple Changes with Refactoring

On Saturday 24 May 2008, student08 wrote:
> Thanks it turned out the cause of my problem was trying to re-use the
> declarators from the declaration to create a new function prototype. Guess
> ASTRewrite didn't like that.

A re-used node is accessible by to parent nodes, but getParent() returns only 
one node and this the cause for the problem in the in the change generator.

> Just wondering if there's a simple way of copying all the contents of the
> declarator from a declaration, or would I have to iterate through all the
> declarator's contents one by one and create them anew?
No there isch no easy way to copy or clone a node. But you can use an empty 
placeholder node to build your new node. And replace the placeholder node 
with the existing node using a replace modification. 

Back to the top