当前位置: 首页>>代码示例>>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;未经允许,请勿转载。