190 return getPath(e, null, null);
191 }
192
193 public TreePath getPath(Element e, AnnotationMirror a) {
194 return getPath(e, a, null);
195 }
196
197 public TreePath getPath(Element e, AnnotationMirror a, AnnotationValue v) {
198 final Pair<JCTree, JCCompilationUnit> treeTopLevel = elements.getTreeAndTopLevel(e, a, v);
199 if (treeTopLevel == null)
200 return null;
201 return TreePath.getPath(treeTopLevel.snd, treeTopLevel.fst);
202 }
203
204 public Element getElement(TreePath path) {
205 JCTree tree = (JCTree) path.getLeaf();
206 Symbol sym = TreeInfo.symbolFor(tree);
207 if (sym == null && TreeInfo.isDeclaration(tree)) {
208 for (TreePath p = path; p != null; p = p.getParentPath()) {
209 JCTree t = (JCTree) p.getLeaf();
210 if (t.getTag() == JCTree.CLASSDEF) {
211 JCClassDecl ct = (JCClassDecl) t;
212 if (ct.sym != null) {
213 if ((ct.sym.flags_field & Flags.UNATTRIBUTED) != 0) {
214 attr.attribClass(ct.pos(), ct.sym);
215 sym = TreeInfo.symbolFor(tree);
216 }
217 break;
218 }
219 }
220 }
221 }
222 return sym;
223 }
224
225 public TypeMirror getTypeMirror(TreePath path) {
226 Tree t = path.getLeaf();
227 return ((JCTree)t).type;
228 }
229
230 public JavacScope getScope(TreePath path) {
|
190 return getPath(e, null, null);
191 }
192
193 public TreePath getPath(Element e, AnnotationMirror a) {
194 return getPath(e, a, null);
195 }
196
197 public TreePath getPath(Element e, AnnotationMirror a, AnnotationValue v) {
198 final Pair<JCTree, JCCompilationUnit> treeTopLevel = elements.getTreeAndTopLevel(e, a, v);
199 if (treeTopLevel == null)
200 return null;
201 return TreePath.getPath(treeTopLevel.snd, treeTopLevel.fst);
202 }
203
204 public Element getElement(TreePath path) {
205 JCTree tree = (JCTree) path.getLeaf();
206 Symbol sym = TreeInfo.symbolFor(tree);
207 if (sym == null && TreeInfo.isDeclaration(tree)) {
208 for (TreePath p = path; p != null; p = p.getParentPath()) {
209 JCTree t = (JCTree) p.getLeaf();
210 if (t.hasTag(JCTree.Tag.CLASSDEF)) {
211 JCClassDecl ct = (JCClassDecl) t;
212 if (ct.sym != null) {
213 if ((ct.sym.flags_field & Flags.UNATTRIBUTED) != 0) {
214 attr.attribClass(ct.pos(), ct.sym);
215 sym = TreeInfo.symbolFor(tree);
216 }
217 break;
218 }
219 }
220 }
221 }
222 return sym;
223 }
224
225 public TypeMirror getTypeMirror(TreePath path) {
226 Tree t = path.getLeaf();
227 return ((JCTree)t).type;
228 }
229
230 public JavacScope getScope(TreePath path) {
|