final class PreprocessorSymbolTable extends java.lang.Object implements StaticTypedScope<JSType>, StaticSymbolTable<SimpleSlot,PreprocessorSymbolTable.Reference>
ProcessClosurePrimitives
).Modifier and Type | Class and Description |
---|---|
(package private) static class |
PreprocessorSymbolTable.Reference |
Modifier and Type | Field and Description |
---|---|
private com.google.common.collect.Multimap<java.lang.String,PreprocessorSymbolTable.Reference> |
refs |
private Node |
root |
private java.util.Map<java.lang.String,SimpleSlot> |
symbols
All preprocessor symbols are globals.
|
Constructor and Description |
---|
PreprocessorSymbolTable(Node root) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
addReference(Node node) |
java.lang.Iterable<SimpleSlot> |
getAllSymbols()
Returns all variables in this symbol table.
|
SimpleSlot |
getOwnSlot(java.lang.String name)
Like
getSlot but does not recurse into parent scopes. |
StaticTypedScope<JSType> |
getParentScope()
Returns the scope enclosing this one or null if none.
|
java.lang.Iterable<PreprocessorSymbolTable.Reference> |
getReferences(SimpleSlot symbol)
Returns the references that point to the given symbol.
|
Node |
getRootNode()
Returns the root node associated with this scope.
|
StaticTypedScope<JSType> |
getScope(SimpleSlot slot)
Returns the scope for a given symbol.
|
SimpleSlot |
getSlot(java.lang.String name)
Returns any defined slot within this scope for this name.
|
JSType |
getTypeOfThis()
Returns the expected type of
this in the current scope. |
private final java.util.Map<java.lang.String,SimpleSlot> symbols
private final com.google.common.collect.Multimap<java.lang.String,PreprocessorSymbolTable.Reference> refs
private final Node root
PreprocessorSymbolTable(Node root)
public Node getRootNode()
StaticScope
getRootNode
in interface StaticScope
public JSType getTypeOfThis()
StaticTypedScope
this
in the current scope.getTypeOfThis
in interface StaticTypedScope<JSType>
public StaticTypedScope<JSType> getParentScope()
StaticTypedScope
getParentScope
in interface StaticTypedScope<JSType>
getParentScope
in interface StaticScope
public SimpleSlot getSlot(java.lang.String name)
StaticTypedScope
getSlot
in interface StaticTypedScope<JSType>
getSlot
in interface StaticScope
name
- The name of the variable slot to look up.null
if no
definition exists.public SimpleSlot getOwnSlot(java.lang.String name)
StaticTypedScope
getSlot
but does not recurse into parent scopes.getOwnSlot
in interface StaticTypedScope<JSType>
getOwnSlot
in interface StaticScope
public java.lang.Iterable<PreprocessorSymbolTable.Reference> getReferences(SimpleSlot symbol)
StaticSymbolTable
getReferences
in interface StaticSymbolTable<SimpleSlot,PreprocessorSymbolTable.Reference>
public java.lang.Iterable<SimpleSlot> getAllSymbols()
StaticSymbolTable
getAllSymbols
in interface StaticSymbolTable<SimpleSlot,PreprocessorSymbolTable.Reference>
public StaticTypedScope<JSType> getScope(SimpleSlot slot)
StaticSymbolTable
getScope
in interface StaticSymbolTable<SimpleSlot,PreprocessorSymbolTable.Reference>
void addReference(Node node)