本文整理汇总了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;
}
示例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;
}