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

changeset 1127
ca49d50318dc
parent 581
f2fdd52e4e87
child 1409
33abf479f202
equal deleted inserted replaced
1126:11c184155128 1127:ca49d50318dc
1 /* 1 /*
2 * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
114 return dup(tree, this.info); 114 return dup(tree, this.info);
115 } 115 }
116 116
117 /** Return closest enclosing environment which points to a tree with given tag. 117 /** Return closest enclosing environment which points to a tree with given tag.
118 */ 118 */
119 public Env<A> enclosing(int tag) { 119 public Env<A> enclosing(JCTree.Tag tag) {
120 Env<A> env1 = this; 120 Env<A> env1 = this;
121 while (env1 != null && env1.tree.getTag() != tag) env1 = env1.next; 121 while (env1 != null && !env1.tree.hasTag(tag)) env1 = env1.next;
122 return env1; 122 return env1;
123 } 123 }
124 124
125 public String toString() { 125 public String toString() {
126 return "Env[" + info + (outer == null ? "" : ",outer=" + outer) + "]"; 126 return "Env[" + info + (outer == null ? "" : ",outer=" + outer) + "]";

mercurial