class CheckUnreachableCode extends java.lang.Object implements NodeTraversal.ScopedCallback
ControlFlowGraph and GraphReachability to inform user
about unreachable code.| Modifier and Type | Class and Description |
|---|---|
private static class |
CheckUnreachableCode.ReachablePredicate |
| Modifier and Type | Field and Description |
|---|---|
private AbstractCompiler |
compiler |
(package private) static DiagnosticType |
UNREACHABLE_CODE |
| Constructor and Description |
|---|
CheckUnreachableCode(AbstractCompiler compiler) |
| Modifier and Type | Method and Description |
|---|---|
void |
enterScope(NodeTraversal t)
Called immediately after entering a new scope.
|
void |
exitScope(NodeTraversal t)
Called immediately before exiting a scope.
|
private void |
initScope(ControlFlowGraph<Node> controlFlowGraph) |
boolean |
shouldTraverse(NodeTraversal t,
Node n,
Node parent)
Visits a node in pre order (before visiting its children) and decides
whether this node's children should be traversed.
|
void |
visit(NodeTraversal t,
Node n,
Node parent)
Visits a node in postorder (after its children have been visited).
|
static final DiagnosticType UNREACHABLE_CODE
private final AbstractCompiler compiler
CheckUnreachableCode(AbstractCompiler compiler)
public void enterScope(NodeTraversal t)
NodeTraversal.ScopedCallbackenterScope in interface NodeTraversal.ScopedCallbackpublic boolean shouldTraverse(NodeTraversal t, Node n, Node parent)
NodeTraversal.CallbackVisits a node in pre order (before visiting its children) and decides
whether this node's children should be traversed. If children are
traversed, they will be visited by
NodeTraversal.Callback.visit(NodeTraversal, Node, Node) in postorder.
Implementations can have side effects (e.g. modifying the parse tree).
shouldTraverse in interface NodeTraversal.Callbackprivate void initScope(ControlFlowGraph<Node> controlFlowGraph)
public void exitScope(NodeTraversal t)
NodeTraversal.ScopedCallbackexitScope in interface NodeTraversal.ScopedCallbackpublic void visit(NodeTraversal t, Node n, Node parent)
NodeTraversal.CallbackVisits a node in postorder (after its children have been visited).
A node is visited only if all its parents should be traversed
(NodeTraversal.Callback.shouldTraverse(NodeTraversal, Node, Node)).
Implementations can have side effects (e.g. modifying the parse tree).
visit in interface NodeTraversal.Callback