本文整理汇总了Java中com.sun.tools.javac.tree.JCTree.JCUnary.getTag方法的典型用法代码示例。如果您正苦于以下问题:Java JCUnary.getTag方法的具体用法?Java JCUnary.getTag怎么用?Java JCUnary.getTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.javac.tree.JCTree.JCUnary
的用法示例。
在下文中一共展示了JCUnary.getTag方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: diffUnary
import com.sun.tools.javac.tree.JCTree.JCUnary; //导入方法依赖的package包/类
protected int diffUnary(JCUnary oldT, JCUnary newT, int[] bounds) {
int[] argBounds = getBounds(oldT.arg);
boolean newOpOnLeft = newT.getKind() != Kind.POSTFIX_DECREMENT && newT.getKind() != Kind.POSTFIX_INCREMENT;
if (newOpOnLeft) {
if (oldT.getTag() != newT.getTag()) {
printer.print(operatorName(newT.getTag()));
} else {
copyTo(bounds[0], argBounds[0]);
}
}
int localPointer = diffTree(oldT.arg, newT.arg, argBounds);
localPointer = copyUpTo(localPointer, argBounds[1]);
if (!newOpOnLeft) {
if (oldT.getTag() != newT.getTag()) {
printer.print(operatorName(newT.getTag()));
} else {
copyUpTo(localPointer, bounds[1]);
}
}
return bounds[1];
}
示例2: visitUnary
import com.sun.tools.javac.tree.JCTree.JCUnary; //导入方法依赖的package包/类
public void visitUnary(JCUnary tree) {
try {
int ownprec = TreeInfo.opPrec(tree.getTag());
String opname = operatorName(tree.getTag());
open(prec, ownprec);
if (tree.getTag() <= JCTree.PREDEC) {
print(opname);
printExpr(tree.arg, ownprec);
} else {
printExpr(tree.arg, ownprec);
print(opname);
}
close(prec, ownprec);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
示例3: visitUnary
import com.sun.tools.javac.tree.JCTree.JCUnary; //导入方法依赖的package包/类
public void visitUnary(JCUnary tree) {
// Attribute arguments.
Type argtype = (JCTree.PREINC <= tree.getTag() && tree.getTag() <= JCTree.POSTDEC)
? attribTree(tree.arg, env, VAR, Type.noType)
: chk.checkNonVoid(tree.arg.pos(), attribExpr(tree.arg, env));
// Find operator.
Symbol operator = tree.operator =
rs.resolveUnaryOperator(tree.pos(), tree.getTag(), env, argtype);
Type owntype = types.createErrorType(tree.type);
if (operator.kind == MTH &&
!argtype.isErroneous()) {
owntype = (JCTree.PREINC <= tree.getTag() && tree.getTag() <= JCTree.POSTDEC)
? tree.arg.type
: operator.type.getReturnType();
int opc = ((OperatorSymbol)operator).opcode;
// If the argument is constant, fold it.
if (argtype.constValue() != null) {
Type ctype = cfolder.fold1(opc, argtype);
if (ctype != null) {
owntype = cfolder.coerce(ctype, owntype);
// Remove constant types from arguments to
// conserve space. The parser will fold concatenations
// of string literals; the code here also
// gets rid of intermediate results when some of the
// operands are constant identifiers.
if (tree.arg.type.tsym == syms.stringType.tsym) {
tree.arg.type = syms.stringType;
}
}
}
}
result = check(tree, owntype, VAL, pkind, pt);
}
示例4: AJCUnary
import com.sun.tools.javac.tree.JCTree.JCUnary; //导入方法依赖的package包/类
public AJCUnary(JCUnary ltree) {
super(ltree.getTag(), ltree.arg);
}