Interface StaticTypedScope
-
- All Superinterfaces:
StaticScope
- All Known Subinterfaces:
FlowScope
- All Known Implementing Classes:
TypedScope
public interface StaticTypedScope extends StaticScope
TheStaticTypedScope
interface must be implemented by any object that defines variables for the purposes of static analysis. It is distinguished from theScriptable
class that Rhino normally uses to represent a run-time scope.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description StaticTypedSlot
getOwnSlot(java.lang.String name)
LikegetSlot
but does not recurse into parent scopes.StaticTypedScope
getParentScope()
Returns the scope enclosing this one or null if none.StaticTypedSlot
getSlot(java.lang.String name)
Returns any defined slot within this scope for this name.JSType
getTypeOfThis()
Returns the expected type ofthis
in the current scope.default JSType
lookupQualifiedName(QualifiedName qname)
Looks up a given qualified name in the scope.-
Methods inherited from interface com.google.javascript.rhino.StaticScope
getRootNode, getTopmostScopeOfEventualDeclaration
-
-
-
-
Method Detail
-
getParentScope
StaticTypedScope getParentScope()
Returns the scope enclosing this one or null if none.- Specified by:
getParentScope
in interfaceStaticScope
-
getSlot
StaticTypedSlot getSlot(java.lang.String name)
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:
getSlot
in interfaceStaticScope
- Parameters:
name
- The name of the variable slot to look up.- Returns:
- The defined slot for the variable, or
null
if no definition exists.
-
getOwnSlot
StaticTypedSlot getOwnSlot(java.lang.String name)
LikegetSlot
but does not recurse into parent scopes.- Specified by:
getOwnSlot
in interfaceStaticScope
-
getTypeOfThis
JSType getTypeOfThis()
Returns the expected type ofthis
in the current scope.
-
lookupQualifiedName
@Nullable default JSType lookupQualifiedName(QualifiedName qname)
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.
-
-