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


Java JCAssignOp类代码示例

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


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

示例1: diffAssignop

import com.sun.tools.javac.tree.JCTree.JCAssignOp; //导入依赖的package包/类
protected int diffAssignop(JCAssignOp oldT, JCAssignOp newT, int[] bounds) {
    int localPointer = bounds[0];
    // lhs
    int[] lhsBounds = getBounds(oldT.lhs);
    copyTo(localPointer, lhsBounds[0]);
    localPointer = diffTree(oldT.lhs, newT.lhs, lhsBounds);
    if (oldT.getTag() != newT.getTag()) { // todo (#pf): operatorName() does not work
        copyTo(localPointer, oldT.pos);
        printer.print(getAssignementOperator(newT));
        localPointer = oldT.pos + getAssignementOperator(oldT).length();
    }
    // rhs
    int[] rhsBounds = getBounds(oldT.rhs);
    copyTo(localPointer, rhsBounds[0]);
    localPointer = diffTree(oldT.rhs, newT.rhs, rhsBounds);

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

示例2: visitAssignop

import com.sun.tools.javac.tree.JCTree.JCAssignOp; //导入依赖的package包/类
public void visitAssignop(JCAssignOp tree) {
    // Attribute arguments.
    Type owntype = attribTree(tree.lhs, env, VAR, Type.noType);
    Type operand = attribExpr(tree.rhs, env);
    // Find operator.
    Symbol operator = tree.operator = rs.resolveBinaryOperator(
        tree.pos(), tree.getTag() - JCTree.ASGOffset, env,
        owntype, operand);

    if (operator.kind == MTH &&
            !owntype.isErroneous() &&
            !operand.isErroneous()) {
        chk.checkOperator(tree.pos(),
                          (OperatorSymbol)operator,
                          tree.getTag() - JCTree.ASGOffset,
                          owntype,
                          operand);
        chk.checkDivZero(tree.rhs.pos(), operator, operand);
        chk.checkCastable(tree.rhs.pos(),
                          operator.type.getReturnType(),
                          owntype);
    }
    result = check(tree, owntype, VAL, pkind, pt);
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:25,代码来源:Attr.java

示例3: visitAssignop

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

示例4: visitAssignop

import com.sun.tools.javac.tree.JCTree.JCAssignOp; //导入依赖的package包/类
public void visitAssignop(JCAssignOp tree) {
	try {
		open(prec, TreeInfo.assignopPrec);
		printExpr(tree.lhs, TreeInfo.assignopPrec + 1);
		String opname = operatorName(treeTag(tree));
		print(" " + opname + " ");
		printExpr(tree.rhs, TreeInfo.assignopPrec);
		close(prec, TreeInfo.assignopPrec);
	} catch (IOException e) {
		throw new UncheckedIOException(e);
	}
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:13,代码来源:PrettyCommentsPrinter.java

示例5: visitAssignop

import com.sun.tools.javac.tree.JCTree.JCAssignOp; //导入依赖的package包/类
@Override public void visitAssignop(JCAssignOp tree) {
	printNode(tree);
	child("lhs", tree.lhs);
	property("(operator)", operatorName(getTag(tree) - JCTree.ASGOffset) + "=");
	child("rhs", tree.rhs);
	indent--;
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:8,代码来源:JcTreePrinter.java

示例6: visitAssignop

import com.sun.tools.javac.tree.JCTree.JCAssignOp; //导入依赖的package包/类
@Override public void visitAssignop(JCAssignOp node) {
	BinaryExpression expr = new BinaryExpression();
	expr.rawRight(toTree(node.getExpression()));
	expr.rawLeft(toTree(node.getVariable()));
	expr.astOperator(JcTreeBuilder.BINARY_OPERATORS.inverse().get(getTag(node)));
	set(node, expr);
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:8,代码来源:JcTreeConverter.java

示例7: visitCompoundAssignment

import com.sun.tools.javac.tree.JCTree.JCAssignOp; //导入依赖的package包/类
@Override
public Choice<State<JCAssignOp>> visitCompoundAssignment(
    final CompoundAssignmentTree node, State<?> state) {
  return chooseSubtrees(
          state,
          s -> unifyExpression(node.getVariable(), s),
          s -> unifyExpression(node.getExpression(), s),
          (var, expr) -> maker().Assignop(((JCAssignOp) node).getTag(), var, expr))
      .condition(assignOp -> !(assignOp.result().getVariable() instanceof PlaceholderParamIdent));
}
 
开发者ID:google,项目名称:error-prone,代码行数:11,代码来源:PlaceholderUnificationVisitor.java

示例8: inline

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

示例9: visitAssignop

import com.sun.tools.javac.tree.JCTree.JCAssignOp; //导入依赖的package包/类
public void visitAssignop(JCAssignOp tree) {
    try {
        open(prec, TreeInfo.assignopPrec);
        printExpr(tree.lhs, TreeInfo.assignopPrec + 1);
        print(" " + operatorName(tree.getTag() - JCTree.ASGOffset) + "= ");
        printExpr(tree.rhs, TreeInfo.assignopPrec);
        close(prec, TreeInfo.assignopPrec);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:12,代码来源:Pretty.java

示例10: visitAssignop

import com.sun.tools.javac.tree.JCTree.JCAssignOp; //导入依赖的package包/类
public void visitAssignop(JCAssignOp tree) {
    try {
        open(prec, TreeInfo.assignopPrec);
        printExpr(tree.lhs, TreeInfo.assignopPrec + 1);
        print(" " + operatorName(getTag(tree) - JCTree.ASGOffset) + "= ");
        printExpr(tree.rhs, TreeInfo.assignopPrec);
        close(prec, TreeInfo.assignopPrec);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
 
开发者ID:redundent,项目名称:lombok,代码行数:12,代码来源:PrettyCommentsPrinter.java

示例11: matchAssignop

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

示例12: Assignop

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

示例13: visitAssignop

import com.sun.tools.javac.tree.JCTree.JCAssignOp; //导入依赖的package包/类
@Override public void visitAssignop(JCAssignOp tree) {
	print(tree.lhs);
	String opname = operator(treeTag(tree));
	print(" " + opname + " ");
	print(tree.rhs);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:7,代码来源:PrettyPrinter.java

示例14: AJCAssignOp

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

示例15: getPrecedence

import com.sun.tools.javac.tree.JCTree.JCAssignOp; //导入依赖的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


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