当前位置: 首页>>代码示例>>Java>>正文


Java JCEnhancedForLoop类代码示例

本文整理汇总了Java中com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop的典型用法代码示例。如果您正苦于以下问题:Java JCEnhancedForLoop类的具体用法?Java JCEnhancedForLoop怎么用?Java JCEnhancedForLoop使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JCEnhancedForLoop类属于com.sun.tools.javac.tree.JCTree包,在下文中一共展示了JCEnhancedForLoop类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: diffForeachLoop

import com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop; //导入依赖的package包/类
protected int diffForeachLoop(JCEnhancedForLoop oldT, JCEnhancedForLoop newT, int[] bounds) {
    int localPointer = bounds[0];
    // variable
    int[] varBounds = getBounds(oldT.var);
    copyTo(localPointer, varBounds[0]);
    localPointer = diffTree(oldT.var, newT.var, varBounds);
    // expression
    int[] exprBounds = getBounds(oldT.expr);
    copyTo(localPointer, exprBounds[0]);
    localPointer = diffTree(oldT.expr, newT.expr, exprBounds);
    // body
    int[] bodyBounds = new int[] { localPointer, endPos(oldT.body) };
    int oldIndent = newT.body.hasTag(Tag.BLOCK) ? -1 : printer.indent();
    localPointer = diffTree(oldT.body, newT.body, bodyBounds, oldT.getKind());
    if (!newT.body.hasTag(Tag.BLOCK))
        printer.undent(oldIndent);
    copyTo(localPointer, bounds[1]);

    return bounds[1];
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:CasualDiff.java

示例2: visitForeachLoop

import com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop; //导入依赖的package包/类
@Override public void visitForeachLoop(JCEnhancedForLoop tree) {
	aPrint("for (");
	printVarDefInline(tree.var);
	print(" : ");
	print(tree.expr);
	print(") ");
	print(tree.body);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:9,代码来源:PrettyPrinter.java

示例3: visitForeachLoop

import com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop; //导入依赖的package包/类
public void visitForeachLoop(JCEnhancedForLoop that) {
    try {
        print("JCEnhancedForLoop:");
    } catch (Exception e) {
    }
    super.visitForeachLoop(that);
}
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:8,代码来源:PrintAstVisitor.java

示例4: visitForeachLoop

import com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop; //导入依赖的package包/类
public void visitForeachLoop(JCEnhancedForLoop tree) {
	try {
		print("for (");
		printExpr(tree.var);
		print(" : ");
		printExpr(tree.expr);
		print(") ");
		printStat(tree.body);
	} catch (IOException e) {
		throw new UncheckedIOException(e);
	}
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:13,代码来源:PrettyCommentsPrinter.java

示例5: inline

import com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop; //导入依赖的package包/类
@Override
public JCEnhancedForLoop inline(Inliner inliner) throws CouldNotResolveImportException {
  return inliner.maker().ForeachLoop(
      getVariable().inline(inliner),
      getExpression().inline(inliner),
      getStatement().inline(inliner));
}
 
开发者ID:sivakumar-kailasam,项目名称:refactor-faster,代码行数:8,代码来源:UEnhancedForLoop.java

示例6: visitForeachLoop

import com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop; //导入依赖的package包/类
@Override public void visitForeachLoop(JCEnhancedForLoop tree) {
	printNode(tree);
	child("var", tree.var);
	child("expr", tree.expr);
	child("body", tree.body);
	indent--;
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:8,代码来源:JcTreePrinter.java

示例7: visitForeachLoop

import com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop; //导入依赖的package包/类
@Override public void visitForeachLoop(JCEnhancedForLoop node) {
	ForEach fe = new ForEach();
	fe.rawIterable(toTree(node.getExpression()));
	fe.rawStatement(toTree(node.getStatement()));
	fe.rawVariable(toTree(node.getVariable(), FlagKey.VARDEF_IS_DEFINITION));
	set(node, fe);
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:8,代码来源:JcTreeConverter.java

示例8: inline

import com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop; //导入依赖的package包/类
@Override
public JCEnhancedForLoop inline(Inliner inliner) throws CouldNotResolveImportException {
  return inliner
      .maker()
      .ForeachLoop(
          getVariable().inline(inliner),
          getExpression().inline(inliner),
          getStatement().inline(inliner));
}
 
开发者ID:google,项目名称:error-prone,代码行数:10,代码来源:UEnhancedForLoop.java

示例9: visitEnhancedForLoop

import com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop; //导入依赖的package包/类
@Override
public Choice<State<JCEnhancedForLoop>> visitEnhancedForLoop(
    final EnhancedForLoopTree node, State<?> state) {
  return chooseSubtrees(
      state,
      s -> unifyExpression(node.getExpression(), s),
      s -> unifyStatement(node.getStatement(), s),
      (expr, stmt) -> maker().ForeachLoop((JCVariableDecl) node.getVariable(), expr, stmt));
}
 
开发者ID:google,项目名称:error-prone,代码行数:10,代码来源:PlaceholderUnificationVisitor.java

示例10: visitForeachLoop

import com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop; //导入依赖的package包/类
public void visitForeachLoop(JCEnhancedForLoop tree) {
    try {
        print("for (");
        printExpr(tree.var);
        print(" : ");
        printExpr(tree.expr);
        print(") ");
        printStat(tree.body);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:13,代码来源:Pretty.java

示例11: visitForeachLoop

import com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop; //导入依赖的package包/类
public void visitForeachLoop(JCEnhancedForLoop tree) {
    Env<AttrContext> loopEnv =
        env.dup(env.tree, env.info.dup(env.info.scope.dup()));
    attribStat(tree.var, loopEnv);
    Type exprType = types.upperBound(attribExpr(tree.expr, loopEnv));
    chk.checkNonVoid(tree.pos(), exprType);
    Type elemtype = types.elemtype(exprType); // perhaps expr is an array?
    if (elemtype == null) {
        // or perhaps expr implements Iterable<T>?
        Type base = types.asSuper(exprType, syms.iterableType.tsym);
        if (base == null) {
            log.error(tree.expr.pos(),
                    "foreach.not.applicable.to.type",
                    exprType,
                    diags.fragment("type.req.array.or.iterable"));
            elemtype = types.createErrorType(exprType);
        } else {
            List<Type> iterableParams = base.allparams();
            elemtype = iterableParams.isEmpty()
                ? syms.objectType
                : types.upperBound(iterableParams.head);
        }
    }
    chk.checkType(tree.expr.pos(), elemtype, tree.var.sym.type);
    loopEnv.tree = tree; // before, we were not in loop!
    attribStat(tree.body, loopEnv);
    loopEnv.info.scope.leave();
    result = null;
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:30,代码来源:Attr.java

示例12: matchForeachLoop

import com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop; //导入依赖的package包/类
private boolean matchForeachLoop(JCEnhancedForLoop t1, JCEnhancedForLoop t2) {
    return treesMatch(t1.var, t2.var) && treesMatch(t1.expr, t2.expr) &&
           treesMatch(t1.body, t2.body);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:CasualDiff.java

示例13: visitForeachLoop

import com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop; //导入依赖的package包/类
@Override
public void visitForeachLoop(JCEnhancedForLoop tree) {
    //skip body (to prevents same statements to be analyzed twice)
    scan(tree.getExpression());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:Analyzer.java

示例14: visitForeachLoop

import com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop; //导入依赖的package包/类
@Override
public void visitForeachLoop(JCEnhancedForLoop tree) {
    scan(tree.getExpression());
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:5,代码来源:Analyzer.java

示例15: ForeachLoop

import com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop; //导入依赖的package包/类
public JCEnhancedForLoop ForeachLoop(JCVariableDecl var, JCExpression expr, JCStatement body) {
	return invoke(ForeachLoop, var, expr, body);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:4,代码来源:JavacTreeMaker.java


注:本文中的com.sun.tools.javac.tree.JCTree.JCEnhancedForLoop类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。