/** Create a fresh environment for method bodies. * @param tree The method definition. * @param env The environment current outside of the method definition. */ Env<AttrContext> methodEnv(JCMethodDecl tree, Env<AttrContext> env) { Env<AttrContext> localEnv = env.dup(tree, env.info.dup(env.info.scope.dupUnshared())); localEnv.enclMethod = tree; localEnv.info.scope.owner = tree.sym; if ((tree.mods.flags & STATIC) != 0) localEnv.info.staticLevel++; return localEnv; }
/** Create a fresh environment for method bodies. * @param tree The method definition. * @param env The environment current outside of the method definition. */ Env<AttrContext> methodEnv(JCMethodDecl tree, Env<AttrContext> env) { Env<AttrContext> localEnv = env.dup(tree, env.info.dup(env.info.scope.dupUnshared())); localEnv.enclMethod = tree; localEnv.info.scope.owner = tree.sym; if ((tree.mods.flags & STATIC) != 0) localEnv.info.staticLevel++; return localEnv; }
/** Create a fresh environment for method bodies. * @param tree The method definition. * @param env The environment current outside of the method definition. */ Env<AttrContext> methodEnv(JCMethodDecl tree, Env<AttrContext> env) { Env<AttrContext> localEnv = env.dup(tree, env.info.dup(env.info.scope.dupUnshared())); localEnv.enclMethod = tree; localEnv.info.scope.owner = tree.sym; if (tree.sym.type != null) { //when this is called in the enter stage, there's no type to be set localEnv.info.returnResult = attr.new ResultInfo(VAL, tree.sym.type.getReturnType()); } if ((tree.mods.flags & STATIC) != 0) localEnv.info.staticLevel++; return localEnv; }
/** Create a fresh environment for method bodies. * @param tree The method definition. * @param env The environment current outside of the method definition. */ Env<AttrContext> methodEnv(JCMethodDecl tree, Env<AttrContext> env) { Env<AttrContext> localEnv = env.dup(tree, env.info.dup(env.info.scope.dupUnshared())); localEnv.enclMethod = tree; localEnv.info.scope.owner = tree.sym; if (tree.sym.type != null) { //when this is called in the enter stage, there's no type to be set localEnv.info.returnResult = attr.new ResultInfo(VAL, tree.sym.type.getReturnType()); } if ((tree.mods.flags & STATIC) != 0) localEnv.info.staticLevel++; return localEnv; }
/** Create a fresh environment for a variable's initializer. * If the variable is a field, the owner of the environment's scope * is be the variable itself, otherwise the owner is the method * enclosing the variable definition. * * @param tree The variable definition. * @param env The environment current outside of the variable definition. */ Env<AttrContext> initEnv(JCVariableDecl tree, Env<AttrContext> env) { Env<AttrContext> localEnv = env.dupto(new AttrContextEnv(tree, env.info.dup())); if (tree.sym.owner.kind == TYP) { localEnv.info.scope = env.info.scope.dupUnshared(); localEnv.info.scope.owner = tree.sym; } if ((tree.mods.flags & STATIC) != 0 || ((env.enclClass.sym.flags() & INTERFACE) != 0 && env.enclMethod == null)) localEnv.info.staticLevel++; return localEnv; }
/** Create a fresh environment for a variable's initializer. * If the variable is a field, the owner of the environment's scope * is be the variable itself, otherwise the owner is the method * enclosing the variable definition. * * @param tree The variable definition. * @param env The environment current outside of the variable definition. */ Env<AttrContext> initEnv(JCVariableDecl tree, Env<AttrContext> env) { Env<AttrContext> localEnv = env.dupto(new AttrContextEnv(tree, env.info.dup())); if (tree.sym.owner.kind == TYP) { localEnv.info.scope = env.info.scope.dupUnshared(); localEnv.info.scope.owner = tree.sym; } if ((tree.mods.flags & STATIC) != 0 || ((env.enclClass.sym.flags() & INTERFACE) != 0 && env.enclMethod == null)) localEnv.info.staticLevel++; return localEnv; }
/** * {@inheritDoc} */ public FilteredMemberList getAllMembers(TypeElement element) { Symbol sym = cast(Symbol.class, element); Scope scope = sym.members().dupUnshared(); List<Type> closure = types.closure(sym.asType()); for (Type t : closure) addMembers(scope, t); return new FilteredMemberList(scope); } // where
/** * {@inheritDoc} */ public FilteredMemberList getAllMembers(TypeElement element) { Symbol sym = cast(Symbol.class, element); Scope scope = sym.members().dupUnshared(); List<Type> closure = types.closure(sym.asType()); for (Type t : closure) addMembers(scope, t); return new FilteredMemberList(scope); } // where
/** * {@inheritDoc} */ public FilteredMemberList getAllMembers(TypeElement element) { Symbol sym = cast(Symbol.class, element); Scope scope = sym.members().dupUnshared(); List<Type> closure = types.closure(sym.asType()); for (Type t : closure) addMembers(scope, t); return new FilteredMemberList(scope); } // where
/** * {@inheritDoc} */ public FilteredMemberList getAllMembers(TypeElement element) { Symbol sym = cast(Symbol.class, element); Scope scope = sym.members().dupUnshared(); List<Type> closure = types.closure(sym.asType()); for (Type t : closure) addMembers(scope, t); return new FilteredMemberList(scope); } // where
if (owner.kind == VAR && owner.owner.kind == TYP) { lambdaEnv = env.dup(that, env.info.dup(env.info.scope.dupUnshared())); ClassSymbol enclClass = owner.enclClass();
public void visitBlock(JCBlock tree) { if (env.info.scope.owner.kind == TYP) { // Block is a static or instance initializer; // let the owner of the environment be a freshly // created BLOCK-method. Env<AttrContext> localEnv = env.dup(tree, env.info.dup(env.info.scope.dupUnshared())); localEnv.info.scope.owner = new MethodSymbol(tree.flags | BLOCK, names.empty, null, env.info.scope.owner); if ((tree.flags & STATIC) != 0) localEnv.info.staticLevel++; attribStats(tree.stats, localEnv); } else { // Create a new local environment with a local scope. Env<AttrContext> localEnv = env.dup(tree, env.info.dup(env.info.scope.dup())); attribStats(tree.stats, localEnv); localEnv.info.scope.leave(); } result = null; }
if (owner.kind == VAR && owner.owner.kind == TYP) { lambdaEnv = env.dup(that, env.info.dup(env.info.scope.dupUnshared())); ClassSymbol enclClass = owner.enclClass();
public void visitBlock(JCBlock tree) { if (env.info.scope.owner.kind == TYP) { // Block is a static or instance initializer; // let the owner of the environment be a freshly // created BLOCK-method. Env<AttrContext> localEnv = env.dup(tree, env.info.dup(env.info.scope.dupUnshared())); localEnv.info.scope.owner = new MethodSymbol(tree.flags | BLOCK, names.empty, null, env.info.scope.owner); if ((tree.flags & STATIC) != 0) localEnv.info.staticLevel++; attribStats(tree.stats, localEnv); } else { // Create a new local environment with a local scope. Env<AttrContext> localEnv = env.dup(tree, env.info.dup(env.info.scope.dup())); attribStats(tree.stats, localEnv); localEnv.info.scope.leave(); } result = null; }
Env<AttrContext> speculativeEnv = env.dup(newTree, env.info.dup(env.info.scope.dupUnshared())); speculativeEnv.info.scope.owner = env.info.scope.owner; Log.DeferredDiagnosticHandler deferredDiagnosticHandler =
Env<AttrContext> speculativeEnv = env.dup(newTree, env.info.dup(env.info.scope.dupUnshared())); speculativeEnv.info.scope.owner = env.info.scope.owner; Log.DeferredDiagnosticHandler deferredDiagnosticHandler =
env.dup(tree, env.info.dup(env.info.scope.dupUnshared())); localEnv.info.scope.owner = new MethodSymbol(tree.flags | BLOCK |
env.dup(tree, env.info.dup(env.info.scope.dupUnshared())); localEnv.info.scope.owner = new MethodSymbol(tree.flags | BLOCK |