Interface StaticTypedScope
- All Superinterfaces:
StaticScope
- All Known Subinterfaces:
FlowScope
- All Known Implementing Classes:
TypedScope
The
StaticTypedScope interface must be implemented by any object that defines variables
for the purposes of static analysis. It is distinguished from the Scriptable class that
Rhino normally uses to represent a run-time scope.-
Method Summary
Modifier and TypeMethodDescriptiongetOwnSlot(String name) LikegetSlotbut does not recurse into parent scopes.Returns the scope enclosing this one or null if none.Returns any defined slot within this scope for this name.Returns the expected type ofthisin the current scope.default @Nullable JSTypelookupQualifiedName(QualifiedName qname) Looks up a given qualified name in the scope.Methods inherited from interface com.google.javascript.rhino.StaticScope
getRootNode, getTopmostScopeOfEventualDeclaration
-
Method Details
-
getParentScope
StaticTypedScope getParentScope()Returns the scope enclosing this one or null if none.- Specified by:
getParentScopein interfaceStaticScope
-
getSlot
Returns 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- Parameters:
name- The name of the variable slot to look up.- Returns:
- The defined slot for the variable, or
nullif no definition exists.
-
getOwnSlot
LikegetSlotbut does not recurse into parent scopes.- Specified by:
getOwnSlotin interfaceStaticScope
-
getTypeOfThis
JSType getTypeOfThis()Returns the expected type ofthisin the current scope. -
lookupQualifiedName
Looks up a given qualified name in the scope. if that fails, looks up the component properties off of any owner types that are in scope.This is always more or equally expensive as calling getSlot(String name), so should only be used when necessary.
This only returns declared qualified names and known properties. It returns null given an inferred name.
-