public void visitForLoop(JCForLoop tree) { Env<AttrContext> loopEnv = env.dup(env.tree, env.info.dup(env.info.scope.dup())); attribStats(tree.init, loopEnv); if (tree.cond != null) attribExpr(tree.cond, loopEnv, syms.booleanType); loopEnv.tree = tree; // before, we were not in loop! attribStats(tree.step, loopEnv); attribStat(tree.body, loopEnv); loopEnv.info.scope.leave(); result = null; }
public void visitForLoop(JCForLoop tree) { Env<AttrContext> loopEnv = env.dup(env.tree, env.info.dup(env.info.scope.dup())); attribStats(tree.init, loopEnv); if (tree.cond != null) attribExpr(tree.cond, loopEnv, syms.booleanType); loopEnv.tree = tree; // before, we were not in loop! attribStats(tree.step, loopEnv); attribStat(tree.body, loopEnv); loopEnv.info.scope.leave(); result = null; }
public void visitForLoop(JCForLoop tree) { Env<AttrContext> loopEnv = env.dup(env.tree, env.info.dup(env.info.scope.dup())); try { attribStats(tree.init, loopEnv); if (tree.cond != null) attribExpr(tree.cond, loopEnv, syms.booleanType); loopEnv.tree = tree; // before, we were not in loop! attribStats(tree.step, loopEnv); attribStat(tree.body, loopEnv); result = null; } finally { loopEnv.info.scope.leave(); } }
public void visitForLoop(JCForLoop tree) { Env<AttrContext> loopEnv = env.dup(env.tree, env.info.dup(env.info.scope.dup())); try { attribStats(tree.init, loopEnv); if (tree.cond != null) attribExpr(tree.cond, loopEnv, syms.booleanType); loopEnv.tree = tree; // before, we were not in loop! attribStats(tree.step, loopEnv); attribStat(tree.body, loopEnv); result = null; } finally { loopEnv.info.scope.leave(); } }
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; }
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; }
attribStats(tree.stats, localEnv); } else { env.dup(tree, env.info.dup(env.info.scope.dup())); try { attribStats(tree.stats, localEnv); } finally { localEnv.info.scope.leave();
attr.attribStats(newTree.params, localEnv); attr.attribStats(body.stats, localEnv);
attribStats(tree.stats, localEnv); } else { env.dup(tree, env.info.dup(env.info.scope.dup())); try { attribStats(tree.stats, localEnv); } finally { localEnv.info.scope.leave();
/** * Attribute type variables (of generic classes or methods). * Compound types are attributed later in attribBounds. * @param typarams the type variables to enter * @param env the current environment */ void attribTypeVariables(List<JCTypeParameter> typarams, Env<AttrContext> env) { for (JCTypeParameter tvar : typarams) { TypeVar a = (TypeVar)tvar.type; if (!tvar.bounds.isEmpty()) { List<Type> bounds = List.of(attribType(tvar.bounds.head, env)); for (JCExpression bound : tvar.bounds.tail) bounds = bounds.prepend(attribType(bound, env)); types.setBounds(a, bounds.reverse()); } else { // if no bounds are given, assume a single bound of // java.lang.Object. types.setBounds(a, List.of(syms.objectType)); } } for (JCTypeParameter tvar : typarams) chk.checkNonCyclic(tvar.pos(), (TypeVar)tvar.type); attribStats(typarams, env); }
/** * Attribute type variables (of generic classes or methods). * Compound types are attributed later in attribBounds. * @param typarams the type variables to enter * @param env the current environment */ void attribTypeVariables(List<JCTypeParameter> typarams, Env<AttrContext> env) { for (JCTypeParameter tvar : typarams) { TypeVar a = (TypeVar)tvar.type; if (!tvar.bounds.isEmpty()) { List<Type> bounds = List.of(attribType(tvar.bounds.head, env)); for (JCExpression bound : tvar.bounds.tail) bounds = bounds.prepend(attribType(bound, env)); types.setBounds(a, bounds.reverse()); } else { // if no bounds are given, assume a single bound of // java.lang.Object. types.setBounds(a, List.of(syms.objectType)); } } for (JCTypeParameter tvar : typarams) chk.checkNonCyclic(tvar.pos(), (TypeVar)tvar.type); attribStats(typarams, env); }
hasDefault = true; attribStats(c.stats, caseEnv); caseEnv.info.scope.leave(); addVars(c.stats, switchEnv.info.scope);
hasDefault = true; attribStats(c.stats, caseEnv); caseEnv.info.scope.leave(); addVars(c.stats, switchEnv.info.scope);
hasDefault = true; attribStats(c.stats, caseEnv); } finally { caseEnv.info.scope.leave();
hasDefault = true; attribStats(c.stats, caseEnv); } finally { caseEnv.info.scope.leave();
if (that.paramKind == JCLambda.ParameterKind.EXPLICIT) { attribStats(that.params, localEnv); explicitParamTypes = TreeInfo.types(that.params); attribStats(that.params, localEnv); } else { JCBlock body = (JCBlock)that.body; attribStats(body.stats, localEnv);
if (that.paramKind == JCLambda.ParameterKind.EXPLICIT) { attribStats(that.params, localEnv); explicitParamTypes = TreeInfo.types(that.params); attribStats(that.params, localEnv); } else { JCBlock body = (JCBlock)that.body; attribStats(body.stats, localEnv);
attribStats(tree.typarams, env); if (!c.isAnonymous()) {
attribStats(tree.typarams, env); if (!c.isAnonymous()) {
localEnv.info.lint = lint; attribStats(tree.typarams, localEnv);