419 } 420 421 @DefinedBy(Api.LANGUAGE_MODEL) 422 public String getDocComment(Element e) { 423 // Our doc comment is contained in a map in our toplevel, 424 // indexed by our tree. Find our enter environment, which gives 425 // us our toplevel. It also gives us a tree that contains our 426 // tree: walk it to find our tree. This is painful. 427 Pair<JCTree, JCCompilationUnit> treeTop = getTreeAndTopLevel(e); 428 if (treeTop == null) 429 return null; 430 JCTree tree = treeTop.fst; 431 JCCompilationUnit toplevel = treeTop.snd; 432 if (toplevel.docComments == null) 433 return null; 434 return toplevel.docComments.getCommentText(tree); 435 } 436 437 @DefinedBy(Api.LANGUAGE_MODEL) 438 public PackageElement getPackageOf(Element e) { 439 return cast(Symbol.class, e).packge(); 440 } 441 442 @DefinedBy(Api.LANGUAGE_MODEL) 443 public ModuleElement getModuleOf(Element e) { 444 Symbol sym = cast(Symbol.class, e); 445 if (modules.getDefaultModule() == syms.noModule) 446 return null; 447 return (sym.kind == MDL) ? ((ModuleElement) e) : sym.packge().modle; 448 } 449 450 @DefinedBy(Api.LANGUAGE_MODEL) 451 public boolean isDeprecated(Element e) { 452 Symbol sym = cast(Symbol.class, e); 453 sym.apiComplete(); 454 return sym.isDeprecated(); 455 } 456 457 @Override @DefinedBy(Api.LANGUAGE_MODEL) 458 public Origin getOrigin(Element e) { | 419 } 420 421 @DefinedBy(Api.LANGUAGE_MODEL) 422 public String getDocComment(Element e) { 423 // Our doc comment is contained in a map in our toplevel, 424 // indexed by our tree. Find our enter environment, which gives 425 // us our toplevel. It also gives us a tree that contains our 426 // tree: walk it to find our tree. This is painful. 427 Pair<JCTree, JCCompilationUnit> treeTop = getTreeAndTopLevel(e); 428 if (treeTop == null) 429 return null; 430 JCTree tree = treeTop.fst; 431 JCCompilationUnit toplevel = treeTop.snd; 432 if (toplevel.docComments == null) 433 return null; 434 return toplevel.docComments.getCommentText(tree); 435 } 436 437 @DefinedBy(Api.LANGUAGE_MODEL) 438 public PackageElement getPackageOf(Element e) { 439 if (e.getKind() == ElementKind.MODULE) 440 return null; 441 else 442 return cast(Symbol.class, e).packge(); 443 } 444 445 @DefinedBy(Api.LANGUAGE_MODEL) 446 public ModuleElement getModuleOf(Element e) { 447 Symbol sym = cast(Symbol.class, e); 448 if (modules.getDefaultModule() == syms.noModule) 449 return null; 450 return (sym.kind == MDL) ? ((ModuleElement) e) : sym.packge().modle; 451 } 452 453 @DefinedBy(Api.LANGUAGE_MODEL) 454 public boolean isDeprecated(Element e) { 455 Symbol sym = cast(Symbol.class, e); 456 sym.apiComplete(); 457 return sym.isDeprecated(); 458 } 459 460 @Override @DefinedBy(Api.LANGUAGE_MODEL) 461 public Origin getOrigin(Element e) { |