private class UnreachableCodeElimination.EliminationPass extends NodeTraversal.AbstractShallowCallback
Modifier and Type | Field and Description |
---|---|
private ControlFlowGraph<Node> |
cfg |
Modifier | Constructor and Description |
---|---|
private |
EliminationPass(ControlFlowGraph<Node> cfg) |
Modifier and Type | Method and Description |
---|---|
private Node |
computeFollowing(Node n) |
private boolean |
inFinally(Node parent,
Node child) |
private void |
removeDeadExprStatementSafely(Node n) |
private void |
removeNode(Node n) |
private void |
tryRemoveUnconditionalBranching(Node n)
Tries to remove n if it is an unconditional branch node (break, continue,
or return) and the target of n is the same as the the follow of n.
|
void |
visit(NodeTraversal t,
Node n,
Node parent)
Visits a node in postorder (after its children have been visited).
|
shouldTraverse
private final ControlFlowGraph<Node> cfg
private EliminationPass(ControlFlowGraph<Node> cfg)
public void visit(NodeTraversal t, Node n, Node parent)
NodeTraversal.Callback
Visits 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).
private void tryRemoveUnconditionalBranching(Node n)
private void removeDeadExprStatementSafely(Node n)
private void removeNode(Node n)