Package org.codehaus.groovy.ast
Class VariableScope
java.lang.Object
org.codehaus.groovy.ast.VariableScope
Records declared and referenced variabes for a given scope. Helps determine
variable sharing across closure and method boundaries.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncopy()
Non-null iff this scope corresponds to a class; as opposed to a method, "if" statement, block statement, etc.getDeclaredVariable
(String name) Gets a map containing the variables declared in this scope.Gets an iterator for the declared class variables.Gets a map containing the class variables referenced by this scope.Gets an iterator for the referenced class variables.int
Gets an iterator for the referenced local variables.boolean
Returns true iff this scope corresponds to a class; as opposed to a method, "if" statement, block statement, etc.boolean
boolean
boolean
boolean
isRoot()
void
void
void
void
setClassScope
(ClassNode classScope) void
setInStaticContext
(boolean inStaticContext)
-
Constructor Details
-
VariableScope
public VariableScope() -
VariableScope
-
-
Method Details
-
getParent
-
isRoot
public boolean isRoot() -
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. -
setClassScope
-
isInStaticContext
public boolean isInStaticContext() -
setInStaticContext
public void setInStaticContext(boolean inStaticContext) -
getDeclaredVariable
-
getReferencedLocalVariable
-
getReferencedClassVariable
-
isReferencedLocalVariable
-
isReferencedClassVariable
-
getDeclaredVariables
Gets a map containing the variables declared in this scope. This map cannot be modified.- Returns:
- a map containing the declared variable references
-
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
-
getReferencedLocalVariablesCount
public int getReferencedLocalVariablesCount() -
getDeclaredVariablesIterator
Gets an iterator for the declared class variables. The remove operation is not supported.- Returns:
- an iterator for the declared variables
-
getReferencedLocalVariablesIterator
Gets an iterator for the referenced local variables. The remove operation *is* supported.- Returns:
- an iterator for the referenced local variables
-
getReferencedClassVariablesIterator
Gets an iterator for the referenced class variables. The remove operation is not supported.- Returns:
- an iterator for the referenced class variables
-
putDeclaredVariable
-
putReferencedLocalVariable
-
putReferencedClassVariable
-
removeReferencedClassVariable
-
copy
-