Package com.google.javascript.jscomp
Class SymbolTable.SymbolScope
- java.lang.Object
-
- com.google.javascript.jscomp.SymbolTable.SymbolScope
-
- All Implemented Interfaces:
StaticScope<JSType>
- Enclosing class:
- SymbolTable
public static final class SymbolTable.SymbolScope extends java.lang.Object implements StaticScope<JSType>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetIndexOfSymbol(SymbolTable.Symbol sym)Gets a unique index for the symbol in this scope.SymbolTable.SymbolgetOwnSlot(java.lang.String name)LikegetSlotbut does not recurse into parent scopes.SymbolTable.SymbolScopegetParentScope()Returns the scope enclosing this one or null if none.SymbolTable.SymbolgetQualifiedSlot(java.lang.String name)Get the slot for a fully-qualified name (e.g., "a.b.c") by trying to find property scopes at each part of the path.NodegetRootNode()Returns the root node associated with this scope.intgetScopeDepth()SymbolTable.SymbolgetSlot(java.lang.String name)Returns any defined slot within this scope for this name.JSTypegetTypeOfThis()Returns the expected type ofthisin the current scope.booleanisDocScope()Returns whether this is a doc scope.booleanisGlobalScope()booleanisLexicalScope()booleanisPropertyScope()java.lang.StringtoString()
-
-
-
Method Detail
-
getIndexOfSymbol
public int getIndexOfSymbol(SymbolTable.Symbol sym)
Gets a unique index for the symbol in this scope.
-
getRootNode
public Node getRootNode()
Description copied from interface:StaticScopeReturns the root node associated with this scope. May be null.- Specified by:
getRootNodein interfaceStaticScope<JSType>
-
getParentScope
public SymbolTable.SymbolScope getParentScope()
Description copied from interface:StaticScopeReturns the scope enclosing this one or null if none.- Specified by:
getParentScopein interfaceStaticScope<JSType>
-
getQualifiedSlot
public SymbolTable.Symbol getQualifiedSlot(java.lang.String name)
Get the slot for a fully-qualified name (e.g., "a.b.c") by trying to find property scopes at each part of the path.
-
getSlot
public SymbolTable.Symbol getSlot(java.lang.String name)
Description copied from interface:StaticScopeReturns any defined slot within this scope for this name. This call continues searching through parent scopes if a slot with this name is not found in the current scope.- Specified by:
getSlotin interfaceStaticScope<JSType>- Parameters:
name- The name of the variable slot to look up.- Returns:
- The defined slot for the variable, or
nullif no definition exists.
-
getOwnSlot
public SymbolTable.Symbol getOwnSlot(java.lang.String name)
Description copied from interface:StaticScopeLikegetSlotbut does not recurse into parent scopes.- Specified by:
getOwnSlotin interfaceStaticScope<JSType>
-
getTypeOfThis
public JSType getTypeOfThis()
Description copied from interface:StaticScopeReturns the expected type ofthisin the current scope.- Specified by:
getTypeOfThisin interfaceStaticScope<JSType>
-
isGlobalScope
public boolean isGlobalScope()
-
isDocScope
public boolean isDocScope()
Returns whether this is a doc scope. A doc scope is a table for symbols that are documented solely within a JSDoc comment.
-
isPropertyScope
public boolean isPropertyScope()
-
isLexicalScope
public boolean isLexicalScope()
-
getScopeDepth
public int getScopeDepth()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-