src/share/classes/com/sun/tools/javac/comp/Env.java

Print this page




  99      *  using its tree and info, and copying all other fields.
 100      */
 101     public Env<A> dupto(Env<A> that) {
 102         that.next = this;
 103         that.outer = this.outer;
 104         that.toplevel = this.toplevel;
 105         that.enclClass = this.enclClass;
 106         that.enclMethod = this.enclMethod;
 107         return that;
 108     }
 109 
 110     /** Duplicate this environment, updating with given tree,
 111      *  and copying all other fields.
 112      */
 113     public Env<A> dup(JCTree tree) {
 114         return dup(tree, this.info);
 115     }
 116 
 117     /** Return closest enclosing environment which points to a tree with given tag.
 118      */
 119     public Env<A> enclosing(int tag) {
 120         Env<A> env1 = this;
 121         while (env1 != null && env1.tree.getTag() != tag) env1 = env1.next;
 122         return env1;
 123     }
 124 
 125     public String toString() {
 126         return "Env[" + info + (outer == null ? "" : ",outer=" + outer) + "]";
 127     }
 128 
 129     public Iterator<Env<A>> iterator() {
 130         return new Iterator<Env<A>>() {
 131             Env<A> next = Env.this;
 132             public boolean hasNext() {
 133                 return next.outer != null;
 134             }
 135             public Env<A> next() {
 136                 if (hasNext()) {
 137                     Env<A> current = next;
 138                     next = current.outer;
 139                     return current;
 140                 }
 141                 throw new NoSuchElementException();


  99      *  using its tree and info, and copying all other fields.
 100      */
 101     public Env<A> dupto(Env<A> that) {
 102         that.next = this;
 103         that.outer = this.outer;
 104         that.toplevel = this.toplevel;
 105         that.enclClass = this.enclClass;
 106         that.enclMethod = this.enclMethod;
 107         return that;
 108     }
 109 
 110     /** Duplicate this environment, updating with given tree,
 111      *  and copying all other fields.
 112      */
 113     public Env<A> dup(JCTree tree) {
 114         return dup(tree, this.info);
 115     }
 116 
 117     /** Return closest enclosing environment which points to a tree with given tag.
 118      */
 119     public Env<A> enclosing(JCTree.Tag tag) {
 120         Env<A> env1 = this;
 121         while (env1 != null && !env1.tree.hasTag(tag)) env1 = env1.next;
 122         return env1;
 123     }
 124 
 125     public String toString() {
 126         return "Env[" + info + (outer == null ? "" : ",outer=" + outer) + "]";
 127     }
 128 
 129     public Iterator<Env<A>> iterator() {
 130         return new Iterator<Env<A>>() {
 131             Env<A> next = Env.this;
 132             public boolean hasNext() {
 133                 return next.outer != null;
 134             }
 135             public Env<A> next() {
 136                 if (hasNext()) {
 137                     Env<A> current = next;
 138                     next = current.outer;
 139                     return current;
 140                 }
 141                 throw new NoSuchElementException();