mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +02:00
visit problems 88731
This commit is contained in:
parent
594abda89f
commit
96d33f7198
3 changed files with 28 additions and 0 deletions
|
@ -43,6 +43,8 @@ public abstract class ASTVisitor {
|
||||||
|
|
||||||
public boolean shouldVisitTranslationUnit = false;
|
public boolean shouldVisitTranslationUnit = false;
|
||||||
|
|
||||||
|
public boolean shouldVisitProblems = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return continue to continue visiting, abort to stop, skip to not descend
|
* @return continue to continue visiting, abort to stop, skip to not descend
|
||||||
* into this node.
|
* into this node.
|
||||||
|
@ -101,4 +103,8 @@ public abstract class ASTVisitor {
|
||||||
public int visit(IASTEnumerator enumerator) {
|
public int visit(IASTEnumerator enumerator) {
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int visit( IASTProblem problem ){
|
||||||
|
return PROCESS_CONTINUE;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -15,6 +15,7 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
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.IASTFileLocation;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
|
||||||
|
@ -318,4 +319,14 @@ public class CASTProblem extends CASTNode implements IASTProblem {
|
||||||
return (IASTTranslationUnit) node;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -15,6 +15,7 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
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.IASTFileLocation;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
|
||||||
|
@ -316,4 +317,14 @@ public class CPPASTProblem extends CPPASTNode implements IASTProblem {
|
||||||
return (IASTTranslationUnit) node;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue