mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Removed uses of a deprecated class.
This commit is contained in:
parent
0442096272
commit
d7b4ba9d15
6 changed files with 111 additions and 121 deletions
|
@ -13,8 +13,8 @@ package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.CDOM;
|
import org.eclipse.cdt.core.dom.CDOM;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
|
||||||
import org.eclipse.cdt.core.index.IIndexManager;
|
import org.eclipse.cdt.core.index.IIndexManager;
|
||||||
import org.eclipse.cdt.core.model.CoreModelUtil;
|
import org.eclipse.cdt.core.model.CoreModelUtil;
|
||||||
import org.eclipse.cdt.core.parser.tests.rewrite.TestHelper;
|
import org.eclipse.cdt.core.parser.tests.rewrite.TestHelper;
|
||||||
|
@ -25,14 +25,12 @@ import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
|
||||||
import org.eclipse.jface.text.Document;
|
import org.eclipse.jface.text.Document;
|
||||||
import org.eclipse.ltk.core.refactoring.Change;
|
import org.eclipse.ltk.core.refactoring.Change;
|
||||||
import org.eclipse.ltk.core.refactoring.CompositeChange;
|
import org.eclipse.ltk.core.refactoring.CompositeChange;
|
||||||
import org.eclipse.ltk.core.refactoring.TextFileChange;
|
import org.eclipse.ltk.core.refactoring.TextFileChange;
|
||||||
|
|
||||||
public abstract class ChangeGeneratorTest extends BaseTestFramework {
|
public abstract class ChangeGeneratorTest extends BaseTestFramework {
|
||||||
|
|
||||||
protected String source;
|
protected String source;
|
||||||
protected String expectedSource;
|
protected String expectedSource;
|
||||||
|
|
||||||
|
@ -52,7 +50,7 @@ public abstract class ChangeGeneratorTest extends BaseTestFramework {
|
||||||
final ChangeGenerator changegenartor = new ChangeGenerator(modStore);
|
final ChangeGenerator changegenartor = new ChangeGenerator(modStore);
|
||||||
IFile testFile = importFile("source.h", source); //$NON-NLS-1$
|
IFile testFile = importFile("source.h", source); //$NON-NLS-1$
|
||||||
|
|
||||||
CPPASTVisitor visitor = createModificator(modStore);
|
ASTVisitor visitor = createModificator(modStore);
|
||||||
|
|
||||||
CCorePlugin.getIndexManager().reindex(cproject);
|
CCorePlugin.getIndexManager().reindex(cproject);
|
||||||
|
|
||||||
|
@ -75,7 +73,7 @@ public abstract class ChangeGeneratorTest extends BaseTestFramework {
|
||||||
assertEquals(TestHelper.unifyNewLines(expectedSource), TestHelper.unifyNewLines(doc.get()));
|
assertEquals(TestHelper.unifyNewLines(expectedSource), TestHelper.unifyNewLines(doc.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract CPPASTVisitor createModificator(ASTModificationStore modStore);
|
protected abstract ASTVisitor createModificator(ASTModificationStore modStore);
|
||||||
|
|
||||||
public ChangeGeneratorTest(String name) {
|
public ChangeGeneratorTest(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
@ -87,5 +85,4 @@ public abstract class ChangeGeneratorTest extends BaseTestFramework {
|
||||||
fileManager.closeAllFiles();
|
fileManager.closeAllFiles();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,11 +13,11 @@ package org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.append;
|
||||||
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
|
||||||
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
|
import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.ChangeGeneratorTest;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTArrayModifier;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTArrayModifier;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTLiteralExpression;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTLiteralExpression;
|
||||||
|
@ -33,17 +33,14 @@ public class ArrayModifierTest extends ChangeGeneratorTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
|
|
||||||
|
|
||||||
source = "int *pi[5];"; //$NON-NLS-1$
|
source = "int *pi[5];"; //$NON-NLS-1$
|
||||||
expectedSource = "int *pi[5][3];"; //$NON-NLS-1$
|
expectedSource = "int *pi[5][3];"; //$NON-NLS-1$
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CPPASTVisitor createModificator(
|
protected ASTVisitor createModificator(final ASTModificationStore modStore) {
|
||||||
final ASTModificationStore modStore) {
|
return new ASTVisitor() {
|
||||||
return new CPPASTVisitor() {
|
|
||||||
{
|
{
|
||||||
shouldVisitDeclarators = true;
|
shouldVisitDeclarators = true;
|
||||||
}
|
}
|
||||||
|
@ -66,6 +63,5 @@ public class ArrayModifierTest extends ChangeGeneratorTest {
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
return new ArrayModifierTest();
|
return new ArrayModifierTest();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||||
* @author Emanuel Graf IFS
|
* @author Emanuel Graf IFS
|
||||||
*/
|
*/
|
||||||
public class ASTWriterVisitor extends ASTVisitor {
|
public class ASTWriterVisitor extends ASTVisitor {
|
||||||
|
|
||||||
protected Scribe scribe = new Scribe();
|
protected Scribe scribe = new Scribe();
|
||||||
protected NodeCommentMap commentMap;
|
protected NodeCommentMap commentMap;
|
||||||
protected ExpressionWriter expWriter;
|
protected ExpressionWriter expWriter;
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
|
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||||
|
@ -56,8 +55,7 @@ import org.eclipse.core.runtime.Path;
|
||||||
*/
|
*/
|
||||||
public class ASTCommenter {
|
public class ASTCommenter {
|
||||||
|
|
||||||
private static final class PPRangeChecker extends CPPASTVisitor {
|
private static final class PPRangeChecker extends ASTVisitor {
|
||||||
|
|
||||||
int ppOffset;
|
int ppOffset;
|
||||||
int commentOffset;
|
int commentOffset;
|
||||||
boolean isPrePPComment = true;
|
boolean isPrePPComment = true;
|
||||||
|
@ -165,7 +163,6 @@ public class ASTCommenter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a NodeCommentMap for the given TranslationUnit. This is the only way
|
* Creates a NodeCommentMap for the given TranslationUnit. This is the only way
|
||||||
* to get a NodeCommentMap which contains all the comments mapped against nodes.
|
* to get a NodeCommentMap which contains all the comments mapped against nodes.
|
||||||
|
@ -244,8 +241,7 @@ public class ASTCommenter {
|
||||||
return commentsInCode;
|
return commentsInCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean commentIsAtTheBeginningBeforePreprocessorStatements(
|
private static boolean commentIsAtTheBeginningBeforePreprocessorStatements(IASTComment comment,
|
||||||
IASTComment comment,
|
|
||||||
ArrayList<Integer> listOfPreProcessorOffset, IASTTranslationUnit tu) {
|
ArrayList<Integer> listOfPreProcessorOffset, IASTTranslationUnit tu) {
|
||||||
if (listOfPreProcessorOffset == null) {
|
if (listOfPreProcessorOffset == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -288,16 +284,13 @@ public class ASTCommenter {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static NodeCommentMap addCommentsToCommentMap(IASTTranslationUnit rootNode, ArrayList<IASTComment> comments){
|
private static NodeCommentMap addCommentsToCommentMap(IASTTranslationUnit rootNode, ArrayList<IASTComment> comments){
|
||||||
NodeCommentMap commentMap = new NodeCommentMap();
|
NodeCommentMap commentMap = new NodeCommentMap();
|
||||||
CommentHandler commHandler = new CommentHandler(comments);
|
CommentHandler commHandler = new CommentHandler(comments);
|
||||||
|
|
||||||
IASTDeclaration[] declarations = rootNode.getDeclarations();
|
IASTDeclaration[] declarations = rootNode.getDeclarations();
|
||||||
for (int i = 0; i < declarations.length; i++) {
|
for (int i = 0; i < declarations.length; i++) {
|
||||||
|
|
||||||
if (isInWorkspace(declarations[i])) {
|
if (isInWorkspace(declarations[i])) {
|
||||||
|
|
||||||
ASTCommenterVisitor commenter = new ASTCommenterVisitor(commHandler, commentMap);
|
ASTCommenterVisitor commenter = new ASTCommenterVisitor(commHandler, commentMap);
|
||||||
declarations[i].accept(commenter);
|
declarations[i].accept(commenter);
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.rewrite.commenthandler;
|
package org.eclipse.cdt.internal.core.dom.rewrite.commenthandler;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTComment;
|
import org.eclipse.cdt.core.dom.ast.IASTComment;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||||
|
@ -25,7 +26,6 @@ import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
|
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
|
@ -38,8 +38,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTCompositeTypeSpecifier
|
||||||
*
|
*
|
||||||
* @author Guido Zgraggen IFS
|
* @author Guido Zgraggen IFS
|
||||||
*/
|
*/
|
||||||
public class ASTCommenterVisitor extends CPPASTVisitor {
|
public class ASTCommenterVisitor extends ASTVisitor {
|
||||||
|
|
||||||
protected CommentHandler commHandler;
|
protected CommentHandler commHandler;
|
||||||
protected NodeCommentMap commentMap;
|
protected NodeCommentMap commentMap;
|
||||||
|
|
||||||
|
@ -69,13 +68,10 @@ public class ASTCommenterVisitor extends CPPASTVisitor {
|
||||||
nodeCommenter = new NodeCommenter(this, commHandler, commentMap);
|
nodeCommenter = new NodeCommenter(this, commHandler, commentMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addRemainingComments(IASTDeclaration declaration) {
|
public void addRemainingComments(IASTDeclaration declaration) {
|
||||||
nodeCommenter.appendRemainingComments(declaration);
|
nodeCommenter.appendRemainingComments(declaration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int visit(IASTName name) {
|
public int visit(IASTName name) {
|
||||||
return nodeCommenter.appendComments((ASTNode) name);
|
return nodeCommenter.appendComments((ASTNode) name);
|
||||||
|
@ -131,35 +127,42 @@ public class ASTCommenterVisitor extends CPPASTVisitor {
|
||||||
nodeCommenter.appendComments((ASTNode) tu);
|
nodeCommenter.appendComments((ASTNode) tu);
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTName name) {
|
public int leave(IASTName name) {
|
||||||
nodeCommenter.appendComments((ASTNode) name);
|
nodeCommenter.appendComments((ASTNode) name);
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTDeclaration declaration) {
|
public int leave(IASTDeclaration declaration) {
|
||||||
nodeCommenter.appendComments((ASTNode) declaration);
|
nodeCommenter.appendComments((ASTNode) declaration);
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(ICPPASTNamespaceDefinition namespaceDefinition) {
|
public int leave(ICPPASTNamespaceDefinition namespaceDefinition) {
|
||||||
return nodeCommenter.appendFreestandingComments((ASTNode) namespaceDefinition);
|
return nodeCommenter.appendFreestandingComments((ASTNode) namespaceDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTInitializer initializer) {
|
public int leave(IASTInitializer initializer) {
|
||||||
nodeCommenter.appendComments((ASTNode) initializer);
|
nodeCommenter.appendComments((ASTNode) initializer);
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTParameterDeclaration parameterDeclaration) {
|
public int leave(IASTParameterDeclaration parameterDeclaration) {
|
||||||
nodeCommenter.appendComments((ASTNode) parameterDeclaration);
|
nodeCommenter.appendComments((ASTNode) parameterDeclaration);
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTDeclarator declarator) {
|
public int leave(IASTDeclarator declarator) {
|
||||||
nodeCommenter.appendComments((ASTNode) declarator);
|
nodeCommenter.appendComments((ASTNode) declarator);
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTDeclSpecifier declSpec) {
|
public int leave(IASTDeclSpecifier declSpec) {
|
||||||
if(declSpec instanceof CPPASTCompositeTypeSpecifier) {
|
if(declSpec instanceof CPPASTCompositeTypeSpecifier) {
|
||||||
|
@ -168,11 +171,13 @@ public class ASTCommenterVisitor extends CPPASTVisitor {
|
||||||
nodeCommenter.appendComments((ASTNode) declSpec);
|
nodeCommenter.appendComments((ASTNode) declSpec);
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTExpression expression) {
|
public int leave(IASTExpression expression) {
|
||||||
nodeCommenter.appendComments((ASTNode) expression);
|
nodeCommenter.appendComments((ASTNode) expression);
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTStatement statement) {
|
public int leave(IASTStatement statement) {
|
||||||
if(statement instanceof IASTCompoundStatement) {
|
if(statement instanceof IASTCompoundStatement) {
|
||||||
|
@ -181,21 +186,25 @@ public class ASTCommenterVisitor extends CPPASTVisitor {
|
||||||
nodeCommenter.appendComments((ASTNode) statement);
|
nodeCommenter.appendComments((ASTNode) statement);
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTTypeId typeId) {
|
public int leave(IASTTypeId typeId) {
|
||||||
nodeCommenter.appendComments((ASTNode) typeId);
|
nodeCommenter.appendComments((ASTNode) typeId);
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTEnumerator enumerator) {
|
public int leave(IASTEnumerator enumerator) {
|
||||||
nodeCommenter.appendComments((ASTNode) enumerator);
|
nodeCommenter.appendComments((ASTNode) enumerator);
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave(IASTProblem problem){
|
public int leave(IASTProblem problem){
|
||||||
nodeCommenter.appendComments((ASTNode) problem);
|
nodeCommenter.appendComments((ASTNode) problem);
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int leave( IASTComment comment){
|
public int leave( IASTComment comment){
|
||||||
nodeCommenter.appendComments((ASTNode) comment);
|
nodeCommenter.appendComments((ASTNode) comment);
|
||||||
|
|
|
@ -19,7 +19,6 @@ import org.eclipse.cdt.core.dom.ast.IASTComment;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
|
@ -63,13 +62,12 @@ import org.eclipse.core.runtime.Path;
|
||||||
* @author Guido Zgraggen IFS
|
* @author Guido Zgraggen IFS
|
||||||
*/
|
*/
|
||||||
public class NodeCommenter {
|
public class NodeCommenter {
|
||||||
|
protected ASTVisitor visitor;
|
||||||
protected CPPASTVisitor visitor;
|
|
||||||
protected CommentHandler commHandler;
|
protected CommentHandler commHandler;
|
||||||
protected NodeCommentMap commentMap;
|
protected NodeCommentMap commentMap;
|
||||||
protected Vector<IASTNode> children;
|
protected Vector<IASTNode> children;
|
||||||
|
|
||||||
public NodeCommenter(CPPASTVisitor visitor, CommentHandler commHandler, NodeCommentMap commentMap) {
|
public NodeCommenter(ASTVisitor visitor, CommentHandler commHandler, NodeCommentMap commentMap) {
|
||||||
this.visitor = visitor;
|
this.visitor = visitor;
|
||||||
this.commHandler = commHandler;
|
this.commHandler = commHandler;
|
||||||
this.commentMap = commentMap;
|
this.commentMap = commentMap;
|
||||||
|
@ -92,7 +90,7 @@ public class NodeCommenter {
|
||||||
ASTNode com = (ASTNode) comment;
|
ASTNode com = (ASTNode) comment;
|
||||||
|
|
||||||
if (node.getFileLocation() == null) {
|
if (node.getFileLocation() == null) {
|
||||||
//MacroExpansions have no Filelocation
|
//MacroExpansions have no FileLocation
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,8 +100,7 @@ public class NodeCommenter {
|
||||||
if (OffsetHelper.getNodeEndPoint(com) <= OffsetHelper.getNodeOffset(node)) {
|
if (OffsetHelper.getNodeEndPoint(com) <= OffsetHelper.getNodeOffset(node)) {
|
||||||
addLeadingCommentToMap(node, comment);
|
addLeadingCommentToMap(node, comment);
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (isTrailing(node, com, nodeLineNumber, commentLineNumber)) {
|
||||||
else if(isTrailing(node, com, nodeLineNumber, commentLineNumber)) {
|
|
||||||
addTrailingCommentToMap(node, comment);
|
addTrailingCommentToMap(node, comment);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -144,7 +141,6 @@ public class NodeCommenter {
|
||||||
&& OffsetHelper.getNodeOffset(com) >= OffsetHelper.getNodeEndPoint(node)
|
&& OffsetHelper.getNodeOffset(com) >= OffsetHelper.getNodeEndPoint(node)
|
||||||
&& canNotBeAddedToParent(node,com)
|
&& canNotBeAddedToParent(node,com)
|
||||||
&& !mustBeAddToSubnodes(node)) {
|
&& !mustBeAddToSubnodes(node)) {
|
||||||
|
|
||||||
if (OffsetHelper.getNodeOffset(com) < OffsetHelper.getNodeEndPoint(node) + 2) {
|
if (OffsetHelper.getNodeOffset(com) < OffsetHelper.getNodeEndPoint(node) + 2) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue