Package com.google.javascript.rhino
Interface StaticScope
-
- All Known Subinterfaces:
FlowScope
,StaticTypedScope
- All Known Implementing Classes:
AbstractScope
,Scope
,TypedScope
public interface StaticScope
TheStaticScope
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 StaticSlot
getOwnSlot(java.lang.String name)
LikegetSlot
but does not recurse into parent scopes.StaticScope
getParentScope()
Returns the scope enclosing this one or null if none.Node
getRootNode()
Returns the root node associated with this scope.StaticSlot
getSlot(java.lang.String name)
Returns any defined slot within this scope for this name.default @Nullable StaticScope
getTopmostScopeOfEventualDeclaration(java.lang.String name)
Returns the topmost slot containing this name, or null if no slots do.
-
-
-
Method Detail
-
getRootNode
Node getRootNode()
Returns the root node associated with this scope. May be null.
-
getParentScope
StaticScope getParentScope()
Returns the scope enclosing this one or null if none.
-
getSlot
StaticSlot 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.- 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
StaticSlot getOwnSlot(java.lang.String name)
LikegetSlot
but does not recurse into parent scopes.
-
getTopmostScopeOfEventualDeclaration
default @Nullable StaticScope getTopmostScopeOfEventualDeclaration(java.lang.String name)
Returns the topmost slot containing this name, or null if no slots do. May return true in cases wheregetSlot(java.lang.String)
returns null, though. Do not rely on this method if you need an actual slot.This method is intended for use while scopes are still being built, hence the name 'eventual' declaration. Once scope building is complete, the scope returned from this method must be equivalent to "getSlot(name).getScope()" or null
-
-