1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 21:15:23 +02:00

Bug 188115: Fix AST Visitor for problem type-ids.

This commit is contained in:
Markus Schorn 2010-07-02 09:53:14 +00:00
parent ed02194644
commit 6a748490e7

View file

@ -20,58 +20,50 @@ import org.eclipse.cdt.core.dom.ast.IASTProblemTypeId;
/** /**
* @author jcamelon * @author jcamelon
*/ */
public class CPPASTProblemTypeId extends CPPASTTypeId implements IASTProblemTypeId { public class CPPASTProblemTypeId extends CPPASTProblemOwner implements IASTProblemTypeId {
private IASTProblem problem;
public CPPASTProblemTypeId() { public CPPASTProblemTypeId() {
} }
public CPPASTProblemTypeId(IASTProblem problem) { public CPPASTProblemTypeId(IASTProblem problem) {
setProblem(problem); super(problem);
} }
@Override
public CPPASTProblemTypeId copy() { public CPPASTProblemTypeId copy() {
IASTProblem problem = getProblem();
IASTDeclSpecifier declSpec = getDeclSpecifier();
IASTDeclarator absDecl = getAbstractDeclarator();
CPPASTProblemTypeId copy = new CPPASTProblemTypeId(); CPPASTProblemTypeId copy = new CPPASTProblemTypeId();
copy.setProblem(problem == null ? null : problem.copy()); copyBaseProblem(copy);
copy.setDeclSpecifier(declSpec == null ? null : declSpec.copy());
copy.setAbstractDeclarator(absDecl == null ? null : absDecl.copy());
copy.setOffsetAndLength(this);
return copy; return copy;
} }
public IASTProblem getProblem() {
return problem;
}
public void setProblem(IASTProblem p) {
assertNotFrozen();
problem = p;
if (p != null) {
p.setParent(this);
p.setPropertyInParent(PROBLEM);
}
}
@Override @Override
public final boolean accept (ASTVisitor action) { public final boolean accept (ASTVisitor action) {
if (action.shouldVisitProblems) { if (action.shouldVisitTypeIds) {
switch (action.visit(getProblem())) { switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false; case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true; case ASTVisitor.PROCESS_SKIP: return true;
default: break; default: break;
} }
switch (action.leave(getProblem())) {
case ASTVisitor.PROCESS_ABORT: return false; // Visits the problem
case ASTVisitor.PROCESS_SKIP: return true; if (!super.accept(action))
default: break; return false;
}
} if (action.shouldVisitTypeIds && action.leave(this) == ASTVisitor.PROCESS_ABORT)
return false;
}
return true; return true;
} }
public IASTDeclSpecifier getDeclSpecifier() {
return null;
}
public void setDeclSpecifier(IASTDeclSpecifier declSpec) {
}
public IASTDeclarator getAbstractDeclarator() {
return null;
}
public void setAbstractDeclarator(IASTDeclarator abstractDeclarator) {
}
} }