Groovy Documentation

org.codehaus.groovy.ast
[Java] Class VariableScope

java.lang.Object
  org.codehaus.groovy.ast.VariableScope

public class VariableScope
extends java.lang.Object

Represents a variable scope. This is primarily used to determine variable sharing across method and closure boundaries.

Authors:
James Strachan
Jochen Theodorou
Version:
\$Revision\$


Constructor Summary
VariableScope()

VariableScope(VariableScope parent)

 
Method Summary
VariableScope copy()

ClassNode getClassScope()

Non-null iff this scope corresponds to a class; as opposed to a method, "if" statement, block statement, etc.

Variable getDeclaredVariable(java.lang.String name)

VariableScope getParent()

Variable getReferencedClassVariable(java.lang.String name)

java.util.Map getReferencedClassVariables()

Gets a map containing the class variables referenced by this scope.

java.util.Iterator getReferencedClassVariablesIterator()

Gets an iterator for the referenced class variables.

Variable getReferencedLocalVariable(java.lang.String name)

int getReferencedLocalVariablesCount()

java.util.Iterator getReferencedLocalVariablesIterator()

boolean isClassScope()

Returns true iff this scope corresponds to a class; as opposed to a method, "if" statement, block statement, etc.

boolean isInStaticContext()

boolean isReferencedClassVariable(java.lang.String name)

boolean isReferencedLocalVariable(java.lang.String name)

boolean isRoot()

void putDeclaredVariable(Variable var)

void putReferencedClassVariable(Variable var)

void putReferencedLocalVariable(Variable var)

java.lang.Object removeReferencedClassVariable(java.lang.String name)

void setClassScope(ClassNode node)

void setInStaticContext(boolean inStaticContext)

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Constructor Detail

VariableScope

public VariableScope()


VariableScope

public VariableScope(VariableScope parent)


 
Method Detail

copy

public VariableScope copy()


getClassScope

public ClassNode getClassScope()
Non-null iff this scope corresponds to a class; as opposed to a method, "if" statement, block statement, etc.


getDeclaredVariable

public Variable getDeclaredVariable(java.lang.String name)


getParent

public VariableScope getParent()


getReferencedClassVariable

public Variable getReferencedClassVariable(java.lang.String name)


getReferencedClassVariables

public java.util.Map 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 java.util.Iterator getReferencedClassVariablesIterator()
Gets an iterator for the referenced class variables. The remove operation is not supported.
Returns:
an iterator for the referenced class variables


getReferencedLocalVariable

public Variable getReferencedLocalVariable(java.lang.String name)


getReferencedLocalVariablesCount

public int getReferencedLocalVariablesCount()


getReferencedLocalVariablesIterator

public java.util.Iterator getReferencedLocalVariablesIterator()


isClassScope

public boolean isClassScope()
Returns true iff this scope corresponds to a class; as opposed to a method, "if" statement, block statement, etc.


isInStaticContext

public boolean isInStaticContext()


isReferencedClassVariable

public boolean isReferencedClassVariable(java.lang.String name)


isReferencedLocalVariable

public boolean isReferencedLocalVariable(java.lang.String name)


isRoot

public boolean isRoot()


putDeclaredVariable

public void putDeclaredVariable(Variable var)


putReferencedClassVariable

public void putReferencedClassVariable(Variable var)


putReferencedLocalVariable

public void putReferencedLocalVariable(Variable var)


removeReferencedClassVariable

public java.lang.Object removeReferencedClassVariable(java.lang.String name)


setClassScope

public void setClassScope(ClassNode node)


setInStaticContext

public void setInStaticContext(boolean inStaticContext)


 

Groovy Documentation