Community
Participate
Working Groups
Build Identifier: While fixing Extract Constant refactoring, I've found out some problems with my current implementation of DeclarationGenerator - it fails to generate the proper IASTDeclarator for complex cases like nested pointer-to-array-of-pointer-to-sth types. I'm redesigning the implementation of DeclarationGenerator atm, I hope to have it finished and working today. I hope that my new approach to this problem will allow to extend it with handling function pointers, too. Update soon. Reproducible: Always
Created attachment 173362 [details] new declarator generation Success! Well, that's literally my 4th attempt on the generation logic - fortunately, this one seems to be both correct and shortest in terms of code so far :) Wasn't so pleasant to throw away my original code, but at least we have the sophisticated declarations generated correctly. The good thing is that after rewriting the code it was easy to add support for function pointers, including those returning function pointers. Works like a charm, finally. See bug 318785 for NPEs after applying the change.
> > See bug 318785 for NPEs after applying the change. The cause for the NPE is the ArrayDeclarator, getName() returns null but according to the javaDoc for this method the method should return an empty name.
Created attachment 173580 [details] fixed declaration generation Here we go! + added an empty ASTName for every created declarator where there was a null ASTName before and: + fixed PointerOperator order + added some support for pointer-to-members
Created attachment 173625 [details] test case
Fixed in HEAD and 7.0 > 20100707 Thanks Tomasz
*** cdt cvs genie on behalf of egraf *** Bug 318784: DeclarationGenerator fails for some cases <a href=https://bugs.eclipse.org/bugs/show_bug.cgi?id=318784>https://bugs.eclipse.org/bugs/show_bug.cgi?id=318784</a> [*] DeclarationGeneratorImpl.java 1.2 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/DeclarationGeneratorImpl.java?root=Tools_Project&r1=1.1&r2=1.2 [*] ExtractLocalVariable.rts 1.6 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractLocalVariable.rts?root=Tools_Project&r1=1.5&r2=1.6 [*] ExtractLocalVariable.rts 1.3.6.2 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractLocalVariable.rts?root=Tools_Project&r1=1.3.6.1&r2=1.3.6.2 [*] DeclarationGeneratorImpl.java 1.1.2.3 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/DeclarationGeneratorImpl.java?root=Tools_Project&r1=1.1.2.2&r2=1.1.2.3