org.codehaus.groovy.ast
Class VariableScope

java.lang.Object
  extended byorg.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.

Version:
$Revision: 1.3 $
Author:
James Strachan

Field Summary
private  java.util.List children
           
private  java.util.Set declaredVariables
           
(package private) static int i
           
(package private)  java.lang.String name
           
private  VariableScope parent
           
private  java.util.Set referencedVariables
           
private  java.util.Set varsDeclaredHere
          br contain vars really declared and defined in the current scope.
 
Constructor Summary
VariableScope()
           
VariableScope(VariableScope parent)
           
 
Method Summary
protected  void append(VariableScope scope)
          Appends all of the references and declarations from the given scope to this one
protected  void appendRecursive(VariableScope scope)
          Appends all of the references and declarations from the given scope and all its children to this one
 void computeRealDeclares()
           
 VariableScope createCompositeChildScope()
          Creates a composite variable scope combining all the variable references and declarations from all the child scopes not including this scope
 VariableScope createRecursiveChildScope()
          Creates a scope including this scope and all nested scopes combined together
 VariableScope createRecursiveParentScope()
          Creates a scope including this scope and all parent scopes combined together
 java.util.List getChildren()
           
 java.util.Set getDeclaredVariables()
           
 java.util.Set getReferencedVariables()
           
 java.util.Set getVarsDeclaredHere()
           
 void setVarsDeclaredHere(java.util.Set varsDeclaredHere)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

i

static int i

declaredVariables

private java.util.Set declaredVariables

referencedVariables

private java.util.Set referencedVariables

varsDeclaredHere

private java.util.Set varsDeclaredHere
br contain vars really declared and defined in the current scope. to be filler later by comparing with parent scope all the ancestors.


parent

private VariableScope parent

children

private java.util.List children

name

java.lang.String name
Constructor Detail

VariableScope

public VariableScope()

VariableScope

public VariableScope(VariableScope parent)
Method Detail

getDeclaredVariables

public java.util.Set getDeclaredVariables()

getReferencedVariables

public java.util.Set getReferencedVariables()

getChildren

public java.util.List getChildren()
Returns:
all the child scopes

createCompositeChildScope

public VariableScope createCompositeChildScope()
Creates a composite variable scope combining all the variable references and declarations from all the child scopes not including this scope

Returns:

createRecursiveChildScope

public VariableScope createRecursiveChildScope()
Creates a scope including this scope and all nested scopes combined together

Returns:

createRecursiveParentScope

public VariableScope createRecursiveParentScope()
Creates a scope including this scope and all parent scopes combined together

Returns:

append

protected void append(VariableScope scope)
Appends all of the references and declarations from the given scope to this one

Parameters:
scope -

appendRecursive

protected void appendRecursive(VariableScope scope)
Appends all of the references and declarations from the given scope and all its children to this one

Parameters:
scope -

computeRealDeclares

public void computeRealDeclares()

getVarsDeclaredHere

public java.util.Set getVarsDeclaredHere()
Returns:
Returns the varsDeclaredHere.

setVarsDeclaredHere

public void setVarsDeclaredHere(java.util.Set varsDeclaredHere)
Parameters:
varsDeclaredHere - The varsDeclaredHere to set.


Copyright © 2003-2005 The Codehaus. All Rights Reserved.