com.sun.tools.javac.comp
Class Env<A>

java.lang.Object
  extended by com.sun.tools.javac.comp.Env<A>
All Implemented Interfaces:
java.lang.Iterable<Env<A>>
Direct Known Subclasses:
AttrContextEnv

public class Env<A>
extends java.lang.Object
implements java.lang.Iterable<Env<A>>

A class for environments, instances of which are passed as arguments to tree visitors. Environments refer to important ancestors of the subtree that's currently visited, such as the enclosing method, the enclosing class, or the enclosing toplevel node. They also contain a generic component, represented as a type parameter, to carry further information specific to individual passes.

This is NOT part of any API supported by Sun Microsystems. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.


Field Summary
 boolean baseClause
          Is this an environment for evaluating a base clause?
 List<JCTree.JCExpression> enclBrackets
          A list of all enclosing brackets, innermost to outermost
 JCTree.JCClassDecl enclClass
          The next enclosing class definition.
 JCTree.JCMethodDecl enclMethod
          The next enclosing method definition.
 JCTree escape
          The escape under which we are operating, or null if there was no escape or if we entered a bracket inside an escape.
 int escapeCount
           
 A info
          A generic field for further information.
 Env<A> next
          The next enclosing environment.
 Env<A> outer
          The environment enclosing the current class.
 JCTree.JCCompilationUnit toplevel
          The enclosing toplevel tree.
 JCTree tree
          The tree with which this environment is associated.
 
Constructor Summary
Env(JCTree tree, A info)
          Create an outermost environment for a given (toplevel)tree, with a given info field.
 
Method Summary
 Env<A> dup(JCTree tree)
          Duplicate this environment, updating with given tree, and copying all other fields.
 Env<A> dup(JCTree tree, A info)
          Duplicate this environment, updating with given tree and info, and copying all other fields.
 Env<A> dupBracket(JCTree tree, A info, JCTree.JCExpression bracket)
          Duplicate this environment, updating with given tree and info and adding a new bracket to enclBrackets, copying all other fields.
 Env<A> dupBracket(JCTree tree, JCTree.JCExpression bracket)
          Duplicate this environment, updating with given tree and adding a new bracket to enclBrackets, copying all other fields.
 Env<A> dupEscape(JCTree tree)
          Duplicate this environment, updating with given tree and removing the most recent bracket from enclBrackets, copying all other fields.
 Env<A> dupEscape(JCTree tree, A info)
          Duplicate this environment, updating with given tree and info and removing the most recent bracket from enclBrackets, copying all other fields.
 Env<A> dupto(Env<A> that)
          Duplicate this environment into a given Environment, using its tree and info, and copying all other fields.
 Env<A> enclosing(int tag)
          Return closest enclosing environment which points to a tree with given tag.
 int getLevel()
           
 boolean isEscapeSafe()
           
 java.util.Iterator<Env<A>> iterator()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

next

public Env<A> next
The next enclosing environment.


outer

public Env<A> outer
The environment enclosing the current class.


tree

public JCTree tree
The tree with which this environment is associated.


toplevel

public JCTree.JCCompilationUnit toplevel
The enclosing toplevel tree.


enclClass

public JCTree.JCClassDecl enclClass
The next enclosing class definition.


enclMethod

public JCTree.JCMethodDecl enclMethod
The next enclosing method definition.


enclBrackets

public List<JCTree.JCExpression> enclBrackets
A list of all enclosing brackets, innermost to outermost


escape

public JCTree escape
The escape under which we are operating, or null if there was no escape or if we entered a bracket inside an escape.


escapeCount

public int escapeCount

info

public A info
A generic field for further information.


baseClause

public boolean baseClause
Is this an environment for evaluating a base clause?

Constructor Detail

Env

public Env(JCTree tree,
           A info)
Create an outermost environment for a given (toplevel)tree, with a given info field.

Method Detail

dup

public Env<A> dup(JCTree tree,
                  A info)
Duplicate this environment, updating with given tree and info, and copying all other fields.


dupto

public Env<A> dupto(Env<A> that)
Duplicate this environment into a given Environment, using its tree and info, and copying all other fields.


dup

public Env<A> dup(JCTree tree)
Duplicate this environment, updating with given tree, and copying all other fields.


dupBracket

public Env<A> dupBracket(JCTree tree,
                         A info,
                         JCTree.JCExpression bracket)
Duplicate this environment, updating with given tree and info and adding a new bracket to enclBrackets, copying all other fields.


dupBracket

public Env<A> dupBracket(JCTree tree,
                         JCTree.JCExpression bracket)
Duplicate this environment, updating with given tree and adding a new bracket to enclBrackets, copying all other fields.


dupEscape

public Env<A> dupEscape(JCTree tree,
                        A info)
Duplicate this environment, updating with given tree and info and removing the most recent bracket from enclBrackets, copying all other fields.


dupEscape

public Env<A> dupEscape(JCTree tree)
Duplicate this environment, updating with given tree and removing the most recent bracket from enclBrackets, copying all other fields.


getLevel

public int getLevel()

isEscapeSafe

public boolean isEscapeSafe()

enclosing

public Env<A> enclosing(int tag)
Return closest enclosing environment which points to a tree with given tag.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

iterator

public java.util.Iterator<Env<A>> iterator()
Specified by:
iterator in interface java.lang.Iterable<Env<A>>