Package org.codehaus.groovy.ast
Class VariableScope
- java.lang.Object
- 
- org.codehaus.groovy.ast.VariableScope
 
- 
 public class VariableScope extends java.lang.ObjectRepresents a variable scope. This is primarily used to determine variable sharing across method and closure 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(java.lang.String name)java.util.Map<java.lang.String,Variable>getDeclaredVariables()Gets a map containing the variables declared in this scope.java.util.Iterator<Variable>getDeclaredVariablesIterator()Gets an iterator for the declared class variables.VariableScopegetParent()VariablegetReferencedClassVariable(java.lang.String name)java.util.Map<java.lang.String,Variable>getReferencedClassVariables()Gets a map containing the class variables referenced by this scope.java.util.Iterator<Variable>getReferencedClassVariablesIterator()Gets an iterator for the referenced class variables.VariablegetReferencedLocalVariable(java.lang.String name)intgetReferencedLocalVariablesCount()java.util.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(java.lang.String name)booleanisReferencedLocalVariable(java.lang.String name)booleanisRoot()voidputDeclaredVariable(Variable var)voidputReferencedClassVariable(Variable var)voidputReferencedLocalVariable(Variable var)java.lang.ObjectremoveReferencedClassVariable(java.lang.String name)voidsetClassScope(ClassNode node)voidsetInStaticContext(boolean inStaticContext)
 
- 
- 
- 
Constructor Detail- 
VariableScopepublic VariableScope() 
 - 
VariableScopepublic VariableScope(VariableScope parent) 
 
- 
 - 
Method Detail- 
getDeclaredVariablepublic Variable getDeclaredVariable(java.lang.String name) 
 - 
isReferencedLocalVariablepublic boolean isReferencedLocalVariable(java.lang.String name) 
 - 
isReferencedClassVariablepublic boolean isReferencedClassVariable(java.lang.String name) 
 - 
getParentpublic VariableScope getParent() 
 - 
isInStaticContextpublic boolean isInStaticContext() 
 - 
setInStaticContextpublic void setInStaticContext(boolean inStaticContext) 
 - 
setClassScopepublic void setClassScope(ClassNode node) 
 - 
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.
 - 
isRootpublic boolean isRoot() 
 - 
copypublic VariableScope copy() 
 - 
putDeclaredVariablepublic void putDeclaredVariable(Variable var) 
 - 
getReferencedLocalVariablesIteratorpublic java.util.Iterator<Variable> getReferencedLocalVariablesIterator() 
 - 
getReferencedLocalVariablesCountpublic int getReferencedLocalVariablesCount() 
 - 
getReferencedLocalVariablepublic Variable getReferencedLocalVariable(java.lang.String name) 
 - 
putReferencedLocalVariablepublic void putReferencedLocalVariable(Variable var) 
 - 
putReferencedClassVariablepublic void putReferencedClassVariable(Variable var) 
 - 
getReferencedClassVariablepublic Variable getReferencedClassVariable(java.lang.String name) 
 - 
removeReferencedClassVariablepublic java.lang.Object removeReferencedClassVariable(java.lang.String name) 
 - 
getReferencedClassVariablespublic java.util.Map<java.lang.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
 
 - 
getReferencedClassVariablesIteratorpublic java.util.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
 
 - 
getDeclaredVariablespublic java.util.Map<java.lang.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
 
 - 
getDeclaredVariablesIteratorpublic java.util.Iterator<Variable> getDeclaredVariablesIterator() Gets an iterator for the declared class variables. The remove operation is not supported.- Returns:
- an iterator for the declared variables
 
 
- 
 
-