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

visit problems 88731

This commit is contained in:
Andrew Niefer 2005-03-22 20:14:21 +00:00
parent 594abda89f
commit 96d33f7198
3 changed files with 28 additions and 0 deletions

View file

@ -43,6 +43,8 @@ public abstract class ASTVisitor {
public boolean shouldVisitTranslationUnit = false;
public boolean shouldVisitProblems = false;
/**
* @return continue to continue visiting, abort to stop, skip to not descend
* into this node.
@ -101,4 +103,8 @@ public abstract class ASTVisitor {
public int visit(IASTEnumerator enumerator) {
return PROCESS_CONTINUE;
}
public int visit( IASTProblem problem ){
return PROCESS_CONTINUE;
}
}

View file

@ -15,6 +15,7 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
@ -318,4 +319,14 @@ public class CASTProblem extends CASTNode implements IASTProblem {
return (IASTTranslationUnit) node;
}
public boolean accept( ASTVisitor action ){
if( action.shouldVisitProblems ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true;
}
}

View file

@ -15,6 +15,7 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
@ -316,4 +317,14 @@ public class CPPASTProblem extends CPPASTNode implements IASTProblem {
return (IASTTranslationUnit) node;
}
public boolean accept( ASTVisitor action ){
if( action.shouldVisitProblems ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
return true;
}
}