class MemoizedScopeCreator extends java.lang.Object implements ScopeCreator, StaticSymbolTable<TypedVar,TypedVar>
On the other hand, you also have to be more aware of what your passes are doing. Scopes are memoized stupidly, so if the underlying tree changes, the scope may be out of sync.
Only used to memoize typed scope creators, not untyped ones.
| Modifier and Type | Field and Description |
|---|---|
private ScopeCreator |
delegate |
private java.util.Map<Node,TypedScope> |
scopes |
| Constructor and Description |
|---|
MemoizedScopeCreator(ScopeCreator delegate) |
| Modifier and Type | Method and Description |
|---|---|
TypedScope |
createScope(Node n,
Scope parent)
Creates a
Scope object. |
(package private) java.util.Collection<TypedScope> |
getAllMemoizedScopes() |
java.lang.Iterable<TypedVar> |
getAllSymbols()
Returns all variables in this symbol table.
|
java.lang.Iterable<TypedVar> |
getReferences(TypedVar var)
Returns the references that point to the given symbol.
|
TypedScope |
getScope(TypedVar var)
Returns the scope for a given symbol.
|
boolean |
hasBlockScope() |
(package private) void |
removeScopesForScript(java.lang.String scriptName)
Removes all scopes with root nodes from a given script file.
|
private final java.util.Map<Node,TypedScope> scopes
private final ScopeCreator delegate
MemoizedScopeCreator(ScopeCreator delegate)
delegate - The real source of Scope objects.public java.lang.Iterable<TypedVar> getReferences(TypedVar var)
StaticSymbolTablegetReferences in interface StaticSymbolTable<TypedVar,TypedVar>public TypedScope getScope(TypedVar var)
StaticSymbolTablegetScope in interface StaticSymbolTable<TypedVar,TypedVar>public java.lang.Iterable<TypedVar> getAllSymbols()
StaticSymbolTablegetAllSymbols in interface StaticSymbolTable<TypedVar,TypedVar>public TypedScope createScope(Node n, Scope parent)
ScopeCreatorScope object.createScope in interface ScopeCreatorn - the root node (either a FUNCTION node, a SCRIPT node, or a
synthetic block node whose children are all SCRIPT nodes)parent - the parent Scope object (may be null)java.util.Collection<TypedScope> getAllMemoizedScopes()
void removeScopesForScript(java.lang.String scriptName)
scriptName - the name of the script file to remove nodes for.public boolean hasBlockScope()
hasBlockScope in interface ScopeCreator