class AnalyzePrototypeProperties extends java.lang.Object implements CompilerPass
Modifier and Type | Class and Description |
---|---|
(package private) static class |
AnalyzePrototypeProperties.AssignmentProperty
Properties created via EXPR assignment:
|
(package private) static class |
AnalyzePrototypeProperties.GlobalFunction
A function initialized as a VAR statement or a function declaration.
|
(package private) static class |
AnalyzePrototypeProperties.LiteralProperty
Properties created via object literals:
|
private class |
AnalyzePrototypeProperties.NameContext
The context of the current name.
|
(package private) class |
AnalyzePrototypeProperties.NameInfo
Information on all properties or global variables of a given name.
|
private class |
AnalyzePrototypeProperties.ProcessExternProperties |
private class |
AnalyzePrototypeProperties.ProcessProperties |
private class |
AnalyzePrototypeProperties.PropagateReferences |
(package private) static interface |
AnalyzePrototypeProperties.Property
Since there are two ways of assigning properties to prototypes, we hide
then behind this interface so they can both be removed regardless of type.
|
(package private) static interface |
AnalyzePrototypeProperties.Symbol
The declaration of an abstract symbol.
|
private static class |
AnalyzePrototypeProperties.SymbolType |
Modifier and Type | Field and Description |
---|---|
private boolean |
anchorUnusedVars |
private AnalyzePrototypeProperties.NameInfo |
anonymousNode |
private boolean |
canModifyExterns |
private AbstractCompiler |
compiler |
private AnalyzePrototypeProperties.NameInfo |
externNode |
private JSModule |
firstModule |
private AnalyzePrototypeProperties.NameInfo |
globalNode |
private static java.util.Set<java.lang.String> |
IMPLICITLY_USED_PROPERTIES |
private JSModuleGraph |
moduleGraph |
private static AnalyzePrototypeProperties.SymbolType |
PROPERTY |
private java.util.Map<java.lang.String,AnalyzePrototypeProperties.NameInfo> |
propertyNameInfo |
private LinkedDirectedGraph<AnalyzePrototypeProperties.NameInfo,JSModule> |
symbolGraph |
private static AnalyzePrototypeProperties.SymbolType |
VAR |
private java.util.Map<java.lang.String,AnalyzePrototypeProperties.NameInfo> |
varNameInfo |
Constructor and Description |
---|
AnalyzePrototypeProperties(AbstractCompiler compiler,
JSModuleGraph moduleGraph,
boolean canModifyExterns,
boolean anchorUnusedVars)
Creates a new pass for analyzing prototype properties.
|
Modifier and Type | Method and Description |
---|---|
java.util.Collection<AnalyzePrototypeProperties.NameInfo> |
getAllNameInfo()
Returns information on all prototype properties.
|
private AnalyzePrototypeProperties.NameInfo |
getNameInfoForName(java.lang.String name,
AnalyzePrototypeProperties.SymbolType type)
Gets the name info for the property or variable of a given name,
and creates a new one if necessary.
|
void |
process(Node externRoot,
Node root)
Process the JS with root node root.
|
private static final AnalyzePrototypeProperties.SymbolType PROPERTY
private static final AnalyzePrototypeProperties.SymbolType VAR
private final AbstractCompiler compiler
private final boolean canModifyExterns
private final boolean anchorUnusedVars
private final JSModuleGraph moduleGraph
private final JSModule firstModule
private static final java.util.Set<java.lang.String> IMPLICITLY_USED_PROPERTIES
private final LinkedDirectedGraph<AnalyzePrototypeProperties.NameInfo,JSModule> symbolGraph
private final AnalyzePrototypeProperties.NameInfo globalNode
private final AnalyzePrototypeProperties.NameInfo externNode
private final AnalyzePrototypeProperties.NameInfo anonymousNode
private final java.util.Map<java.lang.String,AnalyzePrototypeProperties.NameInfo> propertyNameInfo
private final java.util.Map<java.lang.String,AnalyzePrototypeProperties.NameInfo> varNameInfo
AnalyzePrototypeProperties(AbstractCompiler compiler, JSModuleGraph moduleGraph, boolean canModifyExterns, boolean anchorUnusedVars)
compiler
- The compiler.moduleGraph
- The graph for resolving module dependencies. May be
null if we don't care about module dependencies.canModifyExterns
- If true, then we can move prototype
properties that are declared in the externs file.anchorUnusedVars
- If true, then we must mark all vars as referenced,
even if they are never used.public void process(Node externRoot, Node root)
CompilerPass
process
in interface CompilerPass
externRoot
- Top of external JS treeroot
- Top of JS treepublic java.util.Collection<AnalyzePrototypeProperties.NameInfo> getAllNameInfo()
private AnalyzePrototypeProperties.NameInfo getNameInfoForName(java.lang.String name, AnalyzePrototypeProperties.SymbolType type)
name
- The name of the symbol.type
- The type of symbol.