class NameReferenceGraphConstruction extends java.lang.Object implements CompilerPass
NameReferenceGraph
Modifier and Type | Class and Description |
---|---|
private static class |
NameReferenceGraphConstruction.NameUse |
private class |
NameReferenceGraphConstruction.Traversal |
Modifier and Type | Field and Description |
---|---|
private AbstractCompiler |
compiler |
private static boolean |
CONSERVATIVE |
private java.util.ArrayList<NameReferenceGraph.Name> |
currentFunctionStack |
private NameReferenceGraph |
graph |
private com.google.common.collect.Multimap<java.lang.String,NameReferenceGraphConstruction.NameUse> |
unknownNameUse |
Constructor and Description |
---|
NameReferenceGraphConstruction(AbstractCompiler compiler) |
Modifier and Type | Method and Description |
---|---|
private void |
connectUnknowns() |
private NameReferenceGraph.Name |
getNamedContainingFunction()
Find the first containing function that's not an function expression
closure.
|
(package private) NameReferenceGraph |
getNameReferenceGraph() |
private JSType |
getType(Node n)
A helper to retrieve the type of a node.
|
private void |
popContainingFunction()
Remove the top item off the containing function stack, and restore the
previous containing scope to the be the current containing function.
|
void |
process(Node externs,
Node root)
Process the JS with root node root.
|
private void |
pushContainingFunction(NameReferenceGraph.Name functionNode)
Mark the provided node as the current function that we are analyzing.
|
private final AbstractCompiler compiler
private final NameReferenceGraph graph
private final com.google.common.collect.Multimap<java.lang.String,NameReferenceGraphConstruction.NameUse> unknownNameUse
private static final boolean CONSERVATIVE
private final java.util.ArrayList<NameReferenceGraph.Name> currentFunctionStack
NameReferenceGraphConstruction(AbstractCompiler compiler)
NameReferenceGraph getNameReferenceGraph()
public void process(Node externs, Node root)
CompilerPass
process
in interface CompilerPass
externs
- Top of external JS treeroot
- Top of JS treeprivate void connectUnknowns()
private void pushContainingFunction(NameReferenceGraph.Name functionNode)
functionNode
- node representing current function.private void popContainingFunction()
private NameReferenceGraph.Name getNamedContainingFunction()