Package org.codehaus.groovy.ast
Class VariableScope
java.lang.Object
org.codehaus.groovy.ast.VariableScope
Represents a variable scope. This is primarily used to determine variable sharing
across method and closure boundaries.
- Author:
- James Strachan, Jochen Theodorou
-
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
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 node) void
setInStaticContext
(boolean inStaticContext)
-
Constructor Details
-
VariableScope
public VariableScope() -
VariableScope
-
-
Method Details
-
getDeclaredVariable
-
isReferencedLocalVariable
-
isReferencedClassVariable
-
getParent
-
isInStaticContext
public boolean isInStaticContext() -
setInStaticContext
public void setInStaticContext(boolean inStaticContext) -
setClassScope
-
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
-
putDeclaredVariable
-
getReferencedLocalVariablesIterator
-
getReferencedLocalVariablesCount
public int getReferencedLocalVariablesCount() -
getReferencedLocalVariable
-
putReferencedLocalVariable
-
putReferencedClassVariable
-
getReferencedClassVariable
-
removeReferencedClassVariable
-
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
Gets an iterator for the referenced class variables. The remove operation is not supported.- Returns:
- an iterator for the referenced class variables
-
getDeclaredVariables
Gets a map containing the variables declared in this scope. This map cannot be modified.- Returns:
- a map containing the declared variable references
-
getDeclaredVariablesIterator
Gets an iterator for the declared class variables. The remove operation is not supported.- Returns:
- an iterator for the declared variables
-