class UnreachableCodeElimination extends java.lang.Object implements CompilerPass
alert
call in: if (x) { return; alert('unreachable'); }
.
- Statements that have no side effects, such as:
a.b.MyClass.prototype.propertyName;
or true;
.
That first kind of statement sometimes appears intentionally, so that
prototype properties can be annotated using JSDoc without actually
being initialized.Modifier and Type | Class and Description |
---|---|
private class |
UnreachableCodeElimination.EliminationPass |
Modifier and Type | Field and Description |
---|---|
private boolean |
codeChanged |
private AbstractCompiler |
compiler |
private static java.util.logging.Logger |
logger |
private boolean |
removeNoOpStatements |
Constructor and Description |
---|
UnreachableCodeElimination(AbstractCompiler compiler,
boolean removeNoOpStatements) |
Modifier and Type | Method and Description |
---|---|
void |
process(Node externs,
Node toplevel)
Process the JS with root node root.
|
private static final java.util.logging.Logger logger
private final AbstractCompiler compiler
private final boolean removeNoOpStatements
private boolean codeChanged
UnreachableCodeElimination(AbstractCompiler compiler, boolean removeNoOpStatements)
public void process(Node externs, Node toplevel)
CompilerPass
process
in interface CompilerPass
externs
- Top of external JS treetoplevel
- Top of JS tree