Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] AST: replace ICPPASTBaseSpecifier

Following up on my previous post, I'm now pretty sure that this is a
bug. I filed it at https://bugs.eclipse.org/bugs/show_bug.cgi?id=414501
and attached a patch which seems to work for me (created by Tortoise
Git, I don't know whether you guys support this format?). However, the
changes are pretty trivial.

--
Greetings
Simon

On 06.08.2013 15:27, Simon Taddiken wrote:
> Hi,
> 
> I'm desperately trying to replace base specifiers using an ASTRewrite
> within a refactoring to insert the 'virtual' keyword which seems not to
> work. I guess the simplest approach would be:
> 
> final TextEditGroup editGroup = new TextEditGroup("bla");
> final ICPPASTBaseSpecifier baseSpec = //get specifier to replace ...
> final IASTTranslationUnit ast = baseSpec.getTranslationUnit();
> final ASTRewrite rewrite = collector.rewriterForTranslationUnit(ast);
> 
> final ICPPASTBaseSpecifier copy = baseSpec.copy();
> copy.setVirtual(true);
> rewrite.replace(baseSpec, copy, editGroup);
> 
> This produces no text change. Also copying the parent of the base
> specifier (which then is an ICPPASTCompositeTypeSpecifier), replacing
> the base specifier within the array returned by getBaseSpecifiers() and
> then replacing the whole class with its modified copy using the
> ASTRewrite does not yield any changes. The same applies for changing the
> visibility of base specifiers. Only thing that worked for me was
> replacing the specifier's name.
> 
> Any suggestions on what I'm missing out here?
> 


Back to the top