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


Java JCArrayAccess类代码示例

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


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

示例1: diffIndexed

import com.sun.tools.javac.tree.JCTree.JCArrayAccess; //导入依赖的package包/类
protected int diffIndexed(JCArrayAccess oldT, JCArrayAccess newT, int[] bounds) {
    int localPointer = bounds[0];
    // indexed
    int[] indexedBounds = getBounds(oldT.indexed);
    copyTo(localPointer, indexedBounds[0]);
    localPointer = diffTree(oldT.indexed, newT.indexed, indexedBounds);
    // index
    int[] indexBounds = getBounds(oldT.index);
    indexBounds[0] = copyUpTo(localPointer, indexBounds[0]);
    localPointer = diffTree(oldT.index, newT.index, indexBounds);
    localPointer = copyUpTo(localPointer, bounds[1]);

    return localPointer;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:CasualDiff.java

示例2: visitIndexed

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

示例3: visitIndexed

import com.sun.tools.javac.tree.JCTree.JCArrayAccess; //导入依赖的package包/类
public void visitIndexed(JCArrayAccess tree) {
	try {
		printExpr(tree.indexed, TreeInfo.postfixPrec);
		print("[");
		printExpr(tree.index);
		print("]");
	} catch (IOException e) {
		throw new UncheckedIOException(e);
	}
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:11,代码来源:PrettyCommentsPrinter.java

示例4: visitArrayAccess

import com.sun.tools.javac.tree.JCTree.JCArrayAccess; //导入依赖的package包/类
@Override
public Choice<State<JCArrayAccess>> visitArrayAccess(final ArrayAccessTree node, State<?> state) {
  return chooseSubtrees(
      state,
      s -> unifyExpression(node.getExpression(), s),
      s -> unifyExpression(node.getIndex(), s),
      maker()::Indexed);
}
 
开发者ID:google,项目名称:error-prone,代码行数:9,代码来源:PlaceholderUnificationVisitor.java

示例5: visitIndexed

import com.sun.tools.javac.tree.JCTree.JCArrayAccess; //导入依赖的package包/类
public void visitIndexed(JCArrayAccess tree) {
    try {
        printExpr(tree.indexed, TreeInfo.postfixPrec);
        print("[");
        printExpr(tree.index);
        print("]");
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:11,代码来源:Pretty.java

示例6: visitIndexed

import com.sun.tools.javac.tree.JCTree.JCArrayAccess; //导入依赖的package包/类
public void visitIndexed(JCArrayAccess tree) {
    Type owntype = types.createErrorType(tree.type);
    Type atype = attribExpr(tree.indexed, env);
    attribExpr(tree.index, env, syms.intType);
    if (types.isArray(atype))
        owntype = types.elemtype(atype);
    else if (atype.tag != ERROR)
        log.error(tree.pos(), "array.req.but.found", atype);
    if ((pkind & VAR) == 0) owntype = capture(owntype);
    result = check(tree, owntype, VAR, pkind, pt);
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:12,代码来源:Attr.java

示例7: matchIndexed

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

示例8: Indexed

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

示例9: visitIndexed

import com.sun.tools.javac.tree.JCTree.JCArrayAccess; //导入依赖的package包/类
@Override public void visitIndexed(JCArrayAccess tree) {
	print(tree.indexed);
	print("[");
	print(tree.index);
	print("]");
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:7,代码来源:PrettyPrinter.java

示例10: AJCArrayAccess

import com.sun.tools.javac.tree.JCTree.JCArrayAccess; //导入依赖的package包/类
public AJCArrayAccess(JCArrayAccess ltree) {
    super(ltree.indexed, ltree.index);
}
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:4,代码来源:AJCArrayAccess.java

示例11: getPrecedence

import com.sun.tools.javac.tree.JCTree.JCArrayAccess; //导入依赖的package包/类
/**
 * Returns the precedence level appropriate for unambiguously printing
 * leaf as a subexpression of its parent.
 */
private static int getPrecedence(JCTree leaf, Context context) {
  JCCompilationUnit comp = context.get(JCCompilationUnit.class);
  JCTree parent = TreeInfo.pathFor(leaf, comp).get(1);

  // In general, this should match the logic in com.sun.tools.javac.tree.Pretty.
  //
  // TODO(mdempsky): There are probably cases where we could omit parentheses
  // by tweaking the returned precedence, but they need careful review.
  // For example, consider a template to replace "add(a, b)" with "a + b",
  // which applied to "x + add(y, z)" would result in "x + (y + z)".
  // In most cases, we'd likely prefer "x + y + z" instead, but those aren't
  // always equivalent: "0L + (Integer.MIN_VALUE + Integer.MIN_VALUE)" yields
  // a different value than "0L + Integer.MIN_VALUE + Integer.MIN_VALUE" due
  // to integer promotion rules.

  if (parent instanceof JCConditional) {
    // This intentionally differs from Pretty, because Pretty appears buggy:
    // http://mail.openjdk.java.net/pipermail/compiler-dev/2013-September/007303.html
    JCConditional conditional = (JCConditional) parent;
    return TreeInfo.condPrec + ((conditional.cond == leaf) ? 1 : 0);
  } else if (parent instanceof JCAssign) {
    JCAssign assign = (JCAssign) parent;
    return TreeInfo.assignPrec + ((assign.lhs == leaf) ? 1 : 0);
  } else if (parent instanceof JCAssignOp) {
    JCAssignOp assignOp = (JCAssignOp) parent;
    return TreeInfo.assignopPrec + ((assignOp.lhs == leaf) ? 1 : 0);
  } else if (parent instanceof JCUnary) {
    return TreeInfo.opPrec(parent.getTag());
  } else if (parent instanceof JCBinary) {
    JCBinary binary = (JCBinary) parent;
    return TreeInfo.opPrec(parent.getTag()) + ((binary.rhs == leaf) ? 1 : 0);
  } else if (parent instanceof JCTypeCast) {
    JCTypeCast typeCast = (JCTypeCast) parent;
    return (typeCast.expr == leaf) ? TreeInfo.prefixPrec : TreeInfo.noPrec;
  } else if (parent instanceof JCInstanceOf) {
    JCInstanceOf instanceOf = (JCInstanceOf) parent;
    return TreeInfo.ordPrec + ((instanceOf.clazz == leaf) ? 1 : 0);
  } else if (parent instanceof JCArrayAccess) {
    JCArrayAccess arrayAccess = (JCArrayAccess) parent;
    return (arrayAccess.indexed == leaf) ? TreeInfo.postfixPrec : TreeInfo.noPrec;
  } else if (parent instanceof JCFieldAccess) {
    JCFieldAccess fieldAccess = (JCFieldAccess) parent;
    return (fieldAccess.selected == leaf) ? TreeInfo.postfixPrec : TreeInfo.noPrec;
  } else {
    return TreeInfo.noPrec;
  }
}
 
开发者ID:sivakumar-kailasam,项目名称:refactor-faster,代码行数:52,代码来源:ExpressionTemplate.java

示例12: inline

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

示例13: visitIndexed

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

示例14: visitIndexed

import com.sun.tools.javac.tree.JCTree.JCArrayAccess; //导入依赖的package包/类
@Override public void visitIndexed(JCArrayAccess node) {
	ArrayAccess aa = new ArrayAccess();
	aa.rawIndexExpression(toTree(node.getIndex()));
	aa.rawOperand(toTree(node.getExpression()));
	set(node, aa);
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:7,代码来源:JcTreeConverter.java

示例15: getPrecedence

import com.sun.tools.javac.tree.JCTree.JCArrayAccess; //导入依赖的package包/类
/**
 * Returns the precedence level appropriate for unambiguously printing leaf as a subexpression of
 * its parent.
 */
private static int getPrecedence(JCTree leaf, Context context) {
  JCCompilationUnit comp = context.get(JCCompilationUnit.class);
  JCTree parent = TreeInfo.pathFor(leaf, comp).get(1);

  // In general, this should match the logic in com.sun.tools.javac.tree.Pretty.
  //
  // TODO(mdempsky): There are probably cases where we could omit parentheses
  // by tweaking the returned precedence, but they need careful review.
  // For example, consider a template to replace "add(a, b)" with "a + b",
  // which applied to "x + add(y, z)" would result in "x + (y + z)".
  // In most cases, we'd likely prefer "x + y + z" instead, but those aren't
  // always equivalent: "0L + (Integer.MIN_VALUE + Integer.MIN_VALUE)" yields
  // a different value than "0L + Integer.MIN_VALUE + Integer.MIN_VALUE" due
  // to integer promotion rules.

  if (parent instanceof JCConditional) {
    // This intentionally differs from Pretty, because Pretty appears buggy:
    // http://mail.openjdk.java.net/pipermail/compiler-dev/2013-September/007303.html
    JCConditional conditional = (JCConditional) parent;
    return TreeInfo.condPrec + ((conditional.cond == leaf) ? 1 : 0);
  } else if (parent instanceof JCAssign) {
    JCAssign assign = (JCAssign) parent;
    return TreeInfo.assignPrec + ((assign.lhs == leaf) ? 1 : 0);
  } else if (parent instanceof JCAssignOp) {
    JCAssignOp assignOp = (JCAssignOp) parent;
    return TreeInfo.assignopPrec + ((assignOp.lhs == leaf) ? 1 : 0);
  } else if (parent instanceof JCUnary) {
    return TreeInfo.opPrec(parent.getTag());
  } else if (parent instanceof JCBinary) {
    JCBinary binary = (JCBinary) parent;
    return TreeInfo.opPrec(parent.getTag()) + ((binary.rhs == leaf) ? 1 : 0);
  } else if (parent instanceof JCTypeCast) {
    JCTypeCast typeCast = (JCTypeCast) parent;
    return (typeCast.expr == leaf) ? TreeInfo.prefixPrec : TreeInfo.noPrec;
  } else if (parent instanceof JCInstanceOf) {
    JCInstanceOf instanceOf = (JCInstanceOf) parent;
    return TreeInfo.ordPrec + ((instanceOf.clazz == leaf) ? 1 : 0);
  } else if (parent instanceof JCArrayAccess) {
    JCArrayAccess arrayAccess = (JCArrayAccess) parent;
    return (arrayAccess.indexed == leaf) ? TreeInfo.postfixPrec : TreeInfo.noPrec;
  } else if (parent instanceof JCFieldAccess) {
    JCFieldAccess fieldAccess = (JCFieldAccess) parent;
    return (fieldAccess.selected == leaf) ? TreeInfo.postfixPrec : TreeInfo.noPrec;
  } else {
    return TreeInfo.noPrec;
  }
}
 
开发者ID:google,项目名称:error-prone,代码行数:52,代码来源:ExpressionTemplate.java


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