Java Code Examples for com.sun.tools.javac.tree.JCTree#CLASSDEF

The following examples show how to use com.sun.tools.javac.tree.JCTree#CLASSDEF . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavacTrees.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: JavacTrees.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: Enter.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
/** 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;
}
 
Example 4
Source File: Enter.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
/** 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;
}