Package: org.codehaus.groovy.ast

## [Java] Class VariableScope

- org.codehaus.groovy.ast.VariableScope

-     public class VariableScope
      extends Object

  Records declared and referenced variables for a given scope. Helps determine variable sharing across closure and method boundaries.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `VariableScope()`
    `VariableScope(VariableScope parent)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public VariableScope` | `copy()`
    `` | `public ClassNode` | `getClassScope()` Non-null iff this scope corresponds to a class; as opposed to a method, "if" statement, block statement, etc.
    `` | `public Variable` | `getDeclaredVariable(String name)`
    `` | `public Map<String, Variable>` | `getDeclaredVariables()` Gets a map containing the variables declared in this scope.
    `` | `public Iterator<Variable>` | `getDeclaredVariablesIterator()` Gets an iterator for the declared class variables.
    `` | `public VariableScope` | `getParent()`
    `` | `public Variable` | `getReferencedClassVariable(String name)`
    `` | `public Map<String, Variable>` | `getReferencedClassVariables()` Gets a map containing the class variables referenced by this scope.
    `` | `public Iterator<Variable>` | `getReferencedClassVariablesIterator()` Gets an iterator for the referenced class variables.
    `` | `public Variable` | `getReferencedLocalVariable(String name)`
    `` | `public int` | `getReferencedLocalVariablesCount()`
    `` | `public Iterator<Variable>` | `getReferencedLocalVariablesIterator()` Gets an iterator for the referenced local variables.
    `` | `public boolean` | `isClassScope()` Returns true iff this scope corresponds to a class; as opposed to a method, "if" statement, block statement, etc.
    `` | `public boolean` | `isInStaticContext()`
    `` | `public boolean` | `isReferencedClassVariable(String name)`
    `` | `public boolean` | `isReferencedLocalVariable(String name)`
    `` | `public boolean` | `isRoot()`
    `` | `public void` | `putDeclaredVariable(Variable var)`
    `` | `public void` | `putReferencedClassVariable(Variable var)`
    `` | `public void` | `putReferencedLocalVariable(Variable var)`
    `` | `public Object` | `removeReferencedClassVariable(String name)`
    `` | `public void` | `setClassScope(ClassNode classScope)`
    `` | `public void` | `setInStaticContext(boolean inStaticContext)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Constructor Detail

    - #### public VariableScope()

    - #### public VariableScope(VariableScope parent)

  - ### Method Detail

    - #### public VariableScope copy()

    - #### public ClassNode getClassScope()

      Non-null iff this scope corresponds to a class; as opposed to a method, "if" statement, block statement, etc.

    - #### public Variable getDeclaredVariable(String name)

    - #### public Map<String, Variable> getDeclaredVariables()

      Gets a map containing the variables declared in this scope. This map cannot be modified.

      Returns:
        a map containing the declared variable references

    - #### public Iterator<Variable> getDeclaredVariablesIterator()

      Gets an iterator for the declared class variables. The remove operation is not supported.

      Returns:
        an iterator for the declared variables

    - #### public VariableScope getParent()

    - #### public Variable getReferencedClassVariable(String name)

    - #### public Map<String, Variable> getReferencedClassVariables()

      Gets a map containing the class variables referenced by this scope. This not can not be modified.

      Returns:
        a map containing the class variable references

    - #### public Iterator<Variable> getReferencedClassVariablesIterator()

      Gets an iterator for the referenced class variables. The remove operation is not supported.

      Returns:
        an iterator for the referenced class variables

    - #### public Variable getReferencedLocalVariable(String name)

    - #### public int getReferencedLocalVariablesCount()

    - #### public Iterator<Variable> getReferencedLocalVariablesIterator()

      Gets an iterator for the referenced local variables. The remove operation *is* supported.

      Returns:
        an iterator for the referenced local variables

    - #### public boolean isClassScope()

      Returns true iff this scope corresponds to a class; as opposed to a method, "if" statement, block statement, etc.

    - #### public boolean isInStaticContext()

    - #### public boolean isReferencedClassVariable(String name)

    - #### public boolean isReferencedLocalVariable(String name)

    - #### public boolean isRoot()

    - #### public void putDeclaredVariable(Variable var)

    - #### public void putReferencedClassVariable(Variable var)

    - #### public void putReferencedLocalVariable(Variable var)

    - #### public Object removeReferencedClassVariable(String name)

    - #### public void setClassScope(ClassNode classScope)

    - #### public void setInStaticContext(boolean inStaticContext)