src/share/classes/com/sun/tools/javac/comp/Enter.java

Print this page




 211         localEnv.info.scope = tree.namedImportScope;
 212         localEnv.info.lint = lint;
 213         return localEnv;
 214     }
 215 
 216     public Env<AttrContext> getTopLevelEnv(JCCompilationUnit tree) {
 217         Env<AttrContext> localEnv = new Env<AttrContext>(tree, new AttrContext());
 218         localEnv.toplevel = tree;
 219         localEnv.enclClass = predefClassDef;
 220         localEnv.info.scope = tree.namedImportScope;
 221         localEnv.info.lint = lint;
 222         return localEnv;
 223     }
 224 
 225     /** The scope in which a member definition in environment env is to be entered
 226      *  This is usually the environment's scope, except for class environments,
 227      *  where the local scope is for type variables, and the this and super symbol
 228      *  only, and members go into the class member scope.
 229      */
 230     Scope enterScope(Env<AttrContext> env) {
 231         return (env.tree.getTag() == JCTree.CLASSDEF)
 232             ? ((JCClassDecl) env.tree).sym.members_field
 233             : env.info.scope;
 234     }
 235 
 236 /* ************************************************************************
 237  * Visitor methods for phase 1: class enter
 238  *************************************************************************/
 239 
 240     /** Visitor argument: the current environment.
 241      */
 242     protected Env<AttrContext> env;
 243 
 244     /** Visitor result: the computed type.
 245      */
 246     Type result;
 247 
 248     /** Visitor method: enter all classes in given tree, catching any
 249      *  completion failure exceptions. Return the tree's type.
 250      *
 251      *  @param tree    The tree to be visited.




 211         localEnv.info.scope = tree.namedImportScope;
 212         localEnv.info.lint = lint;
 213         return localEnv;
 214     }
 215 
 216     public Env<AttrContext> getTopLevelEnv(JCCompilationUnit tree) {
 217         Env<AttrContext> localEnv = new Env<AttrContext>(tree, new AttrContext());
 218         localEnv.toplevel = tree;
 219         localEnv.enclClass = predefClassDef;
 220         localEnv.info.scope = tree.namedImportScope;
 221         localEnv.info.lint = lint;
 222         return localEnv;
 223     }
 224 
 225     /** The scope in which a member definition in environment env is to be entered
 226      *  This is usually the environment's scope, except for class environments,
 227      *  where the local scope is for type variables, and the this and super symbol
 228      *  only, and members go into the class member scope.
 229      */
 230     Scope enterScope(Env<AttrContext> env) {
 231         return (env.tree.getTag() == JCTree.Tag.CLASSDEF)
 232             ? ((JCClassDecl) env.tree).sym.members_field
 233             : env.info.scope;
 234     }
 235 
 236 /* ************************************************************************
 237  * Visitor methods for phase 1: class enter
 238  *************************************************************************/
 239 
 240     /** Visitor argument: the current environment.
 241      */
 242     protected Env<AttrContext> env;
 243 
 244     /** Visitor result: the computed type.
 245      */
 246     Type result;
 247 
 248     /** Visitor method: enter all classes in given tree, catching any
 249      *  completion failure exceptions. Return the tree's type.
 250      *
 251      *  @param tree    The tree to be visited.