Package com.google.javascript.jscomp
Class DeadPropertyAssignmentElimination
java.lang.Object
com.google.javascript.jscomp.DeadPropertyAssignmentElimination
- All Implemented Interfaces:
CompilerPass
An optimization pass that finds and removes dead property assignments within functions and
classes.
This pass does not currently use the control-flow graph. It makes the following assumptions:
- Functions with inner functions are not processed.
- All properties are read whenever entering a block node. Dead assignments within a block are processed.
- Hook nodes are not processed (it's assumed they read everything)
- Switch blocks are not processed (it's assumed they read everything)
- Any reference to a property getter/setter is treated like a call that escapes all props.
- If there's an Object.definePropert{y,ies} call where the object or property name is aliased then the optimization does not run at all.
- Properties names defined in externs will not be pruned.
-
Method Summary
-
Method Details
-
process
Description copied from interface:CompilerPass
Process the JS with root node root. Can modify the contents of each Node tree- Specified by:
process
in interfaceCompilerPass
- Parameters:
externs
- Top of external JS treeroot
- Top of JS tree
-