Class Scope

    • Method Detail

      • getRootNode

        public Node getRootNode()
        Gets the container node of the scope. This is typically the FUNCTION node or the global BLOCK/SCRIPT node.
        Specified by:
        getRootNode in interface StaticScope<JSType>
      • getParent

        public Scope getParent()
      • getSlot

        public Scope.Var getSlot​(java.lang.String name)
        Description copied from interface: StaticScope
        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 interface StaticScope<JSType>
        Parameters:
        name - The name of the variable slot to look up.
        Returns:
        The defined slot for the variable, or null if no definition exists.
      • getVar

        public Scope.Var getVar​(java.lang.String name)
        Returns the variable, may be null
      • getArgumentsVar

        public Scope.Var getArgumentsVar()
        Get a unique VAR object to represents "arguments" within this scope
      • isDeclared

        public boolean isDeclared​(java.lang.String name,
                                  boolean recurse)
        Returns true if a variable is declared.
      • getVars

        public java.util.Iterator<Scope.Var> getVars()
        Return an iterator over all of the variables declared in this scope.
      • getVarCount

        public int getVarCount()
        Returns number of variables in this scope
      • isGlobal

        public boolean isGlobal()
        Returns whether this is the global scope.
      • isLocal

        public boolean isLocal()
        Returns whether this is a local scope (i.e. not the global scope).
      • getDeclarativelyUnboundVarsWithoutTypes

        public java.util.Iterator<Scope.Var> getDeclarativelyUnboundVarsWithoutTypes()
        Gets all variables declared with "var" but without declared types attached.