Package org.codehaus.groovy.ast
Class VariableScope
- java.lang.Object
- 
- org.codehaus.groovy.ast.VariableScope
 
- 
 public class VariableScope extends Object Records declared and referenced variabes for a given scope. Helps determine variable sharing across closure and method boundaries.
- 
- 
Constructor SummaryConstructors Constructor Description VariableScope()VariableScope(VariableScope parent)
 - 
Method SummaryAll 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()Gets an iterator for the referenced local variables.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 classScope)voidsetInStaticContext(boolean inStaticContext)
 
- 
- 
- 
Constructor Detail- 
VariableScopepublic VariableScope() 
 - 
VariableScopepublic VariableScope(VariableScope parent) 
 
- 
 - 
Method Detail- 
getParentpublic VariableScope getParent() 
 - 
isRootpublic boolean isRoot() 
 - 
getClassScopepublic ClassNode getClassScope() Non-null iff this scope corresponds to a class; as opposed to a method, "if" statement, block statement, etc.
 - 
isClassScopepublic boolean isClassScope() Returns true iff this scope corresponds to a class; as opposed to a method, "if" statement, block statement, etc.
 - 
setClassScopepublic void setClassScope(ClassNode classScope) 
 - 
isInStaticContextpublic boolean isInStaticContext() 
 - 
setInStaticContextpublic void setInStaticContext(boolean inStaticContext) 
 - 
isReferencedLocalVariablepublic boolean isReferencedLocalVariable(String name) 
 - 
isReferencedClassVariablepublic boolean isReferencedClassVariable(String name) 
 - 
getDeclaredVariablespublic 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
 
 - 
getReferencedClassVariablespublic 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
 
 - 
getReferencedLocalVariablesCountpublic int getReferencedLocalVariablesCount() 
 - 
getDeclaredVariablesIteratorpublic Iterator<Variable> getDeclaredVariablesIterator() Gets an iterator for the declared class variables. The remove operation is not supported.- Returns:
- an iterator for the declared variables
 
 - 
getReferencedLocalVariablesIteratorpublic Iterator<Variable> getReferencedLocalVariablesIterator() Gets an iterator for the referenced local variables. The remove operation *is* supported.- Returns:
- an iterator for the referenced local variables
 
 - 
getReferencedClassVariablesIteratorpublic 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
 
 - 
putDeclaredVariablepublic void putDeclaredVariable(Variable var) 
 - 
putReferencedLocalVariablepublic void putReferencedLocalVariable(Variable var) 
 - 
putReferencedClassVariablepublic void putReferencedClassVariable(Variable var) 
 - 
copypublic VariableScope copy() 
 
- 
 
-