org.codehaus.groovy.ast

## Class VariableScope

- java.lang.Object
- - org.codehaus.groovy.ast.VariableScope

    public class VariableScope
    extends Object

Represents a variable scope. This is primarily used to determine variable sharing across method and closure boundaries.

Version:
  $Revision: 17917 $
Author:
  James Strachan, Jochen Theodorou

### Constructor Summary

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

### Method Summary

Methods
`VariableScope` `copy()`
`ClassNode` `getClassScope()` Non-null iff this scope corresponds to a class; as opposed to a method, "if" statement, block statement, etc.
`Variable` `getDeclaredVariable(String name)`
`VariableScope` `getParent()`
`Variable` `getReferencedClassVariable(String name)`
`Map<String,Variable>` `getReferencedClassVariables()` Gets a map containing the class variables referenced by this scope.
`Iterator<Variable>` `getReferencedClassVariablesIterator()` Gets an iterator for the referenced class variables.
`Variable` `getReferencedLocalVariable(String name)`
`int` `getReferencedLocalVariablesCount()`
`Iterator<Variable>` `getReferencedLocalVariablesIterator()`
`boolean` `isClassScope()` Returns true iff this scope corresponds to a class; as opposed to a method, "if" statement, block statement, etc.
`boolean` `isInStaticContext()`
`boolean` `isReferencedClassVariable(String name)`
`boolean` `isReferencedLocalVariable(String name)`
`boolean` `isResolvingDynamic()` Deprecated.
`boolean` `isRoot()`
`void` `putDeclaredVariable(Variable var)`
`void` `putReferencedClassVariable(Variable var)`
`void` `putReferencedLocalVariable(Variable var)`
`Object` `removeReferencedClassVariable(String name)`
`void` `setClassScope(ClassNode node)`
`void` `setDynamicResolving(boolean resolvesDynamic)` Deprecated.
`void` `setInStaticContext(boolean inStaticContext)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### VariableScope

    public VariableScope()

#### VariableScope

    public VariableScope(VariableScope parent)

### Method Detail

#### getDeclaredVariable

    public Variable getDeclaredVariable(String name)

#### isReferencedLocalVariable

    public boolean isReferencedLocalVariable(String name)

#### isReferencedClassVariable

    public boolean isReferencedClassVariable(String name)

#### getParent

    public VariableScope getParent()

#### isInStaticContext

    public boolean isInStaticContext()

#### setInStaticContext

    public void setInStaticContext(boolean inStaticContext)

#### isResolvingDynamic

    @Deprecated
    public boolean isResolvingDynamic()

Deprecated.

#### setDynamicResolving

    @Deprecated
    public void setDynamicResolving(boolean resolvesDynamic)

Deprecated.

#### setClassScope

    public void setClassScope(ClassNode node)

#### getClassScope

    public ClassNode getClassScope()

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

#### isClassScope

    public boolean isClassScope()

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

#### isRoot

    public boolean isRoot()

#### copy

    public VariableScope copy()

#### putDeclaredVariable

    public void putDeclaredVariable(Variable var)

#### getReferencedLocalVariablesIterator

    public Iterator<Variable> getReferencedLocalVariablesIterator()

#### getReferencedLocalVariablesCount

    public int getReferencedLocalVariablesCount()

#### getReferencedLocalVariable

    public Variable getReferencedLocalVariable(String name)

#### putReferencedLocalVariable

    public void putReferencedLocalVariable(Variable var)

#### putReferencedClassVariable

    public void putReferencedClassVariable(Variable var)

#### getReferencedClassVariable

    public Variable getReferencedClassVariable(String name)

#### removeReferencedClassVariable

    public Object removeReferencedClassVariable(String name)

#### getReferencedClassVariables

    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

#### getReferencedClassVariablesIterator

    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