src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacScope.java
changeset 50287 64c880300d9b
parent 49197 cc2673fa8c20
equal deleted inserted replaced
50286:cbc4fca9171e 50287:64c880300d9b
    29 import javax.lang.model.element.Element;
    29 import javax.lang.model.element.Element;
    30 import javax.lang.model.element.ExecutableElement;
    30 import javax.lang.model.element.ExecutableElement;
    31 import javax.lang.model.element.TypeElement;
    31 import javax.lang.model.element.TypeElement;
    32 
    32 
    33 import com.sun.tools.javac.code.Kinds.Kind;
    33 import com.sun.tools.javac.code.Kinds.Kind;
       
    34 import com.sun.tools.javac.code.Scope.CompoundScope;
    34 import com.sun.tools.javac.code.Symbol;
    35 import com.sun.tools.javac.code.Symbol;
    35 import com.sun.tools.javac.comp.AttrContext;
    36 import com.sun.tools.javac.comp.AttrContext;
    36 import com.sun.tools.javac.comp.Env;
    37 import com.sun.tools.javac.comp.Env;
    37 import com.sun.tools.javac.util.DefinedBy;
    38 import com.sun.tools.javac.util.DefinedBy;
    38 import com.sun.tools.javac.util.DefinedBy.Api;
    39 import com.sun.tools.javac.util.DefinedBy.Api;
    61             //the "top-level" scope needs to return both imported and defined elements
    62             //the "top-level" scope needs to return both imported and defined elements
    62             //see test CheckLocalElements
    63             //see test CheckLocalElements
    63             return new JavacScope(env) {
    64             return new JavacScope(env) {
    64                 @Override @DefinedBy(Api.COMPILER_TREE)
    65                 @Override @DefinedBy(Api.COMPILER_TREE)
    65                 public Iterable<? extends Element> getLocalElements() {
    66                 public Iterable<? extends Element> getLocalElements() {
    66                     return env.toplevel.namedImportScope.getSymbols(VALIDATOR);
    67                     CompoundScope result = new CompoundScope(env.toplevel.packge);
       
    68                     result.prependSubScope(env.toplevel.toplevelScope);
       
    69                     result.prependSubScope(env.toplevel.namedImportScope);
       
    70                     return result.getSymbols(VALIDATOR);
    67                 }
    71                 }
    68             };
    72             };
    69         } else {
    73         } else {
    70             return new JavacScope(env);
    74             return new JavacScope(env);
    71         }
    75         }