Package com.google.javascript.jscomp
Class DeadPropertyAssignmentElimination
- java.lang.Object
-
- com.google.javascript.jscomp.DeadPropertyAssignmentElimination
-
- All Implemented Interfaces:
CompilerPass
public class DeadPropertyAssignmentElimination extends java.lang.Object implements 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
process(Node externs, Node root)
Process the JS with root node root.
-
-
-
Method Detail
-
process
public void process(Node externs, Node root)
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
-
-