當前位置: 首頁>>代碼示例>>Java>>正文


Java JCTree.CLASSDEF屬性代碼示例

本文整理匯總了Java中com.sun.tools.javac.tree.JCTree.CLASSDEF屬性的典型用法代碼示例。如果您正苦於以下問題:Java JCTree.CLASSDEF屬性的具體用法?Java JCTree.CLASSDEF怎麽用?Java JCTree.CLASSDEF使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.sun.tools.javac.tree.JCTree的用法示例。


在下文中一共展示了JCTree.CLASSDEF屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getElement

public Element getElement(TreePath path) {
    JCTree tree = (JCTree) path.getLeaf();
    Symbol sym = TreeInfo.symbolFor(tree);
    if (sym == null && TreeInfo.isDeclaration(tree)) {
        for (TreePath p = path; p != null; p = p.getParentPath()) {
            JCTree t = (JCTree) p.getLeaf();
            if (t.getTag() == JCTree.CLASSDEF) {
                JCClassDecl ct = (JCClassDecl) t;
                if (ct.sym != null) {
                    if ((ct.sym.flags_field & Flags.UNATTRIBUTED) != 0) {
                        attr.attribClass(ct.pos(), ct.sym);
                        sym = TreeInfo.symbolFor(tree);
                    }
                    break;
                }
            }
        }
    }
    return sym;
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:20,代碼來源:JavacTrees.java

示例2: enterScope

/** The scope in which a member definition in environment env is to be entered
 *  This is usually the environment's scope, except for class environments,
 *  where the local scope is for type variables, and the this and super symbol
 *  only, and members go into the class member scope.
 */
Scope enterScope(Env<AttrContext> env) {
    return (env.tree.getTag() == JCTree.CLASSDEF)
        ? ((JCClassDecl) env.tree).sym.members_field
        : env.info.scope;
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:10,代碼來源:Enter.java


注:本文中的com.sun.tools.javac.tree.JCTree.CLASSDEF屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。