1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 02:06:01 +02:00

Using IASTNode instead of ASTNode, bug 267888.

This commit is contained in:
Markus Schorn 2009-04-01 11:22:50 +00:00
parent 4b27284fa6
commit ef28bd3a93

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik * Copyright (c) 2008, 2009 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others * Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
@ -22,6 +22,7 @@ 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.IASTInitializer; import org.eclipse.cdt.core.dom.ast.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration; import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTStatement; import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
@ -29,7 +30,6 @@ 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.gnu.IGNUASTCompoundStatementExpression; import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTLiteralNode; import org.eclipse.cdt.internal.core.dom.rewrite.ASTLiteralNode;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap; import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
@ -128,7 +128,7 @@ public class ASTWriterVisitor extends CPPASTVisitor {
return super.leave(tu); return super.leave(tu);
} }
private void writeLeadingComments(ASTNode node) { private void writeLeadingComments(IASTNode node) {
for(IASTComment comment : commentMap.getLeadingCommentsForNode(node)) { for(IASTComment comment : commentMap.getLeadingCommentsForNode(node)) {
scribe.print(comment.getComment()); scribe.print(comment.getComment());
scribe.newLine(); scribe.newLine();
@ -141,7 +141,7 @@ public class ASTWriterVisitor extends CPPASTVisitor {
@Override @Override
public int visit(IASTName name) { public int visit(IASTName name) {
writeLeadingComments((ASTNode) name); writeLeadingComments(name);
if(!macroHandler.checkisMacroExpansionNode(name)) { if(!macroHandler.checkisMacroExpansionNode(name)) {
nameWriter.writeName(name); nameWriter.writeName(name);
} }
@ -152,7 +152,7 @@ public class ASTWriterVisitor extends CPPASTVisitor {
@Override @Override
public int visit(IASTDeclSpecifier declSpec) { public int visit(IASTDeclSpecifier declSpec) {
writeLeadingComments((ASTNode) declSpec); writeLeadingComments(declSpec);
declSpecWriter.writeDelcSpec(declSpec); declSpecWriter.writeDelcSpec(declSpec);
return ASTVisitor.PROCESS_SKIP; return ASTVisitor.PROCESS_SKIP;
} }
@ -161,7 +161,7 @@ public class ASTWriterVisitor extends CPPASTVisitor {
@Override @Override
public int visit(IASTExpression expression) { public int visit(IASTExpression expression) {
writeLeadingComments((ASTNode) expression); writeLeadingComments(expression);
if(!macroHandler.checkisMacroExpansionNode(expression)) { if(!macroHandler.checkisMacroExpansionNode(expression)) {
if (expression instanceof IGNUASTCompoundStatementExpression) { if (expression instanceof IGNUASTCompoundStatementExpression) {
IGNUASTCompoundStatementExpression gnuCompStmtExp = (IGNUASTCompoundStatementExpression) expression; IGNUASTCompoundStatementExpression gnuCompStmtExp = (IGNUASTCompoundStatementExpression) expression;
@ -177,7 +177,7 @@ public class ASTWriterVisitor extends CPPASTVisitor {
@Override @Override
public int visit(IASTStatement statement) { public int visit(IASTStatement statement) {
writeLeadingComments((ASTNode) statement); writeLeadingComments(statement);
if(macroHandler.isStatementWithMixedLocation(statement) && !(statement instanceof IASTCompoundStatement)){ if(macroHandler.isStatementWithMixedLocation(statement) && !(statement instanceof IASTCompoundStatement)){
return statementWriter.writeMixedStatement(statement); return statementWriter.writeMixedStatement(statement);
} }
@ -190,7 +190,7 @@ public class ASTWriterVisitor extends CPPASTVisitor {
@Override @Override
public int visit(IASTDeclaration declaration) { public int visit(IASTDeclaration declaration) {
writeLeadingComments((ASTNode) declaration); writeLeadingComments(declaration);
if(!macroHandler.checkisMacroExpansionNode(declaration)) { if(!macroHandler.checkisMacroExpansionNode(declaration)) {
declarationWriter.writeDeclaration(declaration); declarationWriter.writeDeclaration(declaration);
} }
@ -201,7 +201,7 @@ public class ASTWriterVisitor extends CPPASTVisitor {
@Override @Override
public int visit(IASTDeclarator declarator) { public int visit(IASTDeclarator declarator) {
writeLeadingComments((ASTNode) declarator); writeLeadingComments(declarator);
if(!macroHandler.checkisMacroExpansionNode(declarator)) { if(!macroHandler.checkisMacroExpansionNode(declarator)) {
declaratorWriter.writeDeclarator(declarator); declaratorWriter.writeDeclarator(declarator);
} }
@ -219,7 +219,7 @@ public class ASTWriterVisitor extends CPPASTVisitor {
@Override @Override
public int visit(IASTInitializer initializer) { public int visit(IASTInitializer initializer) {
writeLeadingComments((ASTNode) initializer); writeLeadingComments(initializer);
if(!macroHandler.checkisMacroExpansionNode(initializer)) { if(!macroHandler.checkisMacroExpansionNode(initializer)) {
initializerWriter.writeInitializer(initializer); initializerWriter.writeInitializer(initializer);
} }
@ -230,7 +230,7 @@ public class ASTWriterVisitor extends CPPASTVisitor {
@Override @Override
public int visit(IASTParameterDeclaration parameterDeclaration) { public int visit(IASTParameterDeclaration parameterDeclaration) {
writeLeadingComments((ASTNode) parameterDeclaration); writeLeadingComments(parameterDeclaration);
if(!macroHandler.checkisMacroExpansionNode(parameterDeclaration)) { if(!macroHandler.checkisMacroExpansionNode(parameterDeclaration)) {
parameterDeclaration.getDeclSpecifier().accept(this); parameterDeclaration.getDeclSpecifier().accept(this);
IASTDeclarator declarator = getParameterDeclarator(parameterDeclaration); IASTDeclarator declarator = getParameterDeclarator(parameterDeclaration);
@ -257,7 +257,7 @@ public class ASTWriterVisitor extends CPPASTVisitor {
@Override @Override
public int visit(ICPPASTNamespaceDefinition namespace) { public int visit(ICPPASTNamespaceDefinition namespace) {
writeLeadingComments((ASTNode) namespace); writeLeadingComments(namespace);
if(!macroHandler.checkisMacroExpansionNode(namespace)) { if(!macroHandler.checkisMacroExpansionNode(namespace)) {
declarationWriter.writeDeclaration(namespace); declarationWriter.writeDeclaration(namespace);
} }
@ -266,7 +266,7 @@ public class ASTWriterVisitor extends CPPASTVisitor {
@Override @Override
public int visit(ICPPASTTemplateParameter parameter) { public int visit(ICPPASTTemplateParameter parameter) {
writeLeadingComments((ASTNode) parameter); writeLeadingComments(parameter);
if(!macroHandler.checkisMacroExpansionNode(parameter)) { if(!macroHandler.checkisMacroExpansionNode(parameter)) {
tempParameterWriter.writeTemplateParameter(parameter); tempParameterWriter.writeTemplateParameter(parameter);
} }