Package 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. 
- 
- 
Constructor Summary
Constructors Constructor Description VariableScope()VariableScope(VariableScope parent) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VariableScopecopy()ClassNodegetClassScope()Non-null iff this scope corresponds to a class; as opposed to a method, "if" statement, block statement, etc.VariablegetDeclaredVariable(String name)Map<String,Variable>getDeclaredVariables()Gets a map containing the variables declared in this scope.Iterator<Variable>getDeclaredVariablesIterator()Gets an iterator for the declared class variables.VariableScopegetParent()VariablegetReferencedClassVariable(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.VariablegetReferencedLocalVariable(String name)intgetReferencedLocalVariablesCount()Iterator<Variable>getReferencedLocalVariablesIterator()booleanisClassScope()Returns true iff this scope corresponds to a class; as opposed to a method, "if" statement, block statement, etc.booleanisInStaticContext()booleanisReferencedClassVariable(String name)booleanisReferencedLocalVariable(String name)booleanisRoot()voidputDeclaredVariable(Variable var)voidputReferencedClassVariable(Variable var)voidputReferencedLocalVariable(Variable var)ObjectremoveReferencedClassVariable(String name)voidsetClassScope(ClassNode node)voidsetInStaticContext(boolean inStaticContext) 
 - 
 
- 
- 
Constructor Detail
- 
VariableScope
public VariableScope()
 
- 
VariableScope
public VariableScope(VariableScope parent)
 
 - 
 
- 
Method Detail
- 
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)
 
- 
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)
 
- 
getReferencedLocalVariablesCount
public int getReferencedLocalVariablesCount()
 
- 
putReferencedLocalVariable
public void putReferencedLocalVariable(Variable var)
 
- 
putReferencedClassVariable
public void putReferencedClassVariable(Variable var)
 
- 
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
 
 
- 
getDeclaredVariables
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
 
 
 - 
 
 -