本文整理汇总了Java中com.sun.tools.javac.tree.JCTree.JCInstanceOf类的典型用法代码示例。如果您正苦于以下问题:Java JCInstanceOf类的具体用法?Java JCInstanceOf怎么用?Java JCInstanceOf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JCInstanceOf类属于com.sun.tools.javac.tree.JCTree包,在下文中一共展示了JCInstanceOf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: diffTypeTest
import com.sun.tools.javac.tree.JCTree.JCInstanceOf; //导入依赖的package包/类
protected int diffTypeTest(JCInstanceOf oldT, JCInstanceOf newT, int[] bounds) {
int localPointer = bounds[0];
// expr
int[] exprBounds = getBounds(oldT.expr);
copyTo(localPointer, exprBounds[0]);
localPointer = diffTree(oldT.expr, newT.expr, exprBounds);
// clazz
int[] clazzBounds = getBounds(oldT.clazz);
clazzBounds[0] = copyUpTo(localPointer, clazzBounds[0]);
localPointer = diffTree(oldT.clazz, newT.clazz, clazzBounds);
localPointer = copyUpTo(localPointer, bounds[1]);
return localPointer;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:CasualDiff.java
示例2: visitTypeTest
import com.sun.tools.javac.tree.JCTree.JCInstanceOf; //导入依赖的package包/类
public void visitTypeTest(JCInstanceOf that) {
try {
print("JCInstanceOf:");
} catch (Exception e) {
}
super.visitTypeTest(that);
}
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:8,代码来源:PrintAstVisitor.java
示例3: visitTypeTest
import com.sun.tools.javac.tree.JCTree.JCInstanceOf; //导入依赖的package包/类
public void visitTypeTest(JCInstanceOf tree) {
try {
open(prec, TreeInfo.ordPrec);
printExpr(tree.expr, TreeInfo.ordPrec);
print(" instanceof ");
printExpr(tree.clazz, TreeInfo.ordPrec + 1);
close(prec, TreeInfo.ordPrec);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:12,代码来源:PrettyCommentsPrinter.java
示例4: visitInstanceOf
import com.sun.tools.javac.tree.JCTree.JCInstanceOf; //导入依赖的package包/类
@Override
public Choice<State<JCInstanceOf>> visitInstanceOf(final InstanceOfTree node, State<?> state) {
return chooseSubtrees(
state,
s -> unifyExpression(node.getExpression(), s),
expr -> maker().TypeTest(expr, (JCTree) node.getType()));
}
开发者ID:google,项目名称:error-prone,代码行数:8,代码来源:PlaceholderUnificationVisitor.java
示例5: visitTypeTest
import com.sun.tools.javac.tree.JCTree.JCInstanceOf; //导入依赖的package包/类
public void visitTypeTest(JCInstanceOf tree) {
try {
open(prec, TreeInfo.ordPrec);
printExpr(tree.expr, TreeInfo.ordPrec);
print(" instanceof ");
printExpr(tree.clazz, TreeInfo.ordPrec + 1);
close(prec, TreeInfo.ordPrec);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
开发者ID:sebastianoe,项目名称:s4j,代码行数:12,代码来源:Pretty.java
示例6: visitTypeTest
import com.sun.tools.javac.tree.JCTree.JCInstanceOf; //导入依赖的package包/类
public void visitTypeTest(JCInstanceOf tree) {
Type exprtype = chk.checkNullOrRefType(
tree.expr.pos(), attribExpr(tree.expr, env));
Type clazztype = chk.checkReifiableReferenceType(
tree.clazz.pos(), attribType(tree.clazz, env));
chk.validate(tree.clazz, env, false);
chk.checkCastable(tree.expr.pos(), exprtype, clazztype);
result = check(tree, syms.booleanType, VAL, pkind, pt);
}
开发者ID:sebastianoe,项目名称:s4j,代码行数:10,代码来源:Attr.java
示例7: matchTypeTest
import com.sun.tools.javac.tree.JCTree.JCInstanceOf; //导入依赖的package包/类
private boolean matchTypeTest(JCInstanceOf t1, JCInstanceOf t2) {
return treesMatch(t1.clazz, t2.clazz) && treesMatch(t1.expr, t2.expr);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:CasualDiff.java
示例8: TypeTest
import com.sun.tools.javac.tree.JCTree.JCInstanceOf; //导入依赖的package包/类
public JCInstanceOf TypeTest(JCExpression expr, JCTree clazz) {
return invoke(TypeTest, expr, clazz);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:4,代码来源:JavacTreeMaker.java
示例9: visitTypeTest
import com.sun.tools.javac.tree.JCTree.JCInstanceOf; //导入依赖的package包/类
@Override public void visitTypeTest(JCInstanceOf tree) {
print(tree.expr);
print(" instanceof ");
print(tree.clazz);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:6,代码来源:PrettyPrinter.java
示例10: AJCInstanceOf
import com.sun.tools.javac.tree.JCTree.JCInstanceOf; //导入依赖的package包/类
public AJCInstanceOf(JCInstanceOf ltree) {
super(ltree.expr, ltree.clazz);
}
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:4,代码来源:AJCInstanceOf.java
示例11: inline
import com.sun.tools.javac.tree.JCTree.JCInstanceOf; //导入依赖的package包/类
@Override
public JCInstanceOf inline(Inliner inliner) throws CouldNotResolveImportException {
return inliner.maker().TypeTest(getExpression().inline(inliner), getType().inline(inliner));
}
开发者ID:sivakumar-kailasam,项目名称:refactor-faster,代码行数:5,代码来源:UInstanceOf.java
示例12: getPrecedence
import com.sun.tools.javac.tree.JCTree.JCInstanceOf; //导入依赖的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
示例13: visitTypeTest
import com.sun.tools.javac.tree.JCTree.JCInstanceOf; //导入依赖的package包/类
@Override public void visitTypeTest(JCInstanceOf tree) {
printNode(tree);
child("expr", tree.expr);
child("clazz", tree.clazz);
indent--;
}
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:7,代码来源:JcTreePrinter.java
示例14: visitTypeTest
import com.sun.tools.javac.tree.JCTree.JCInstanceOf; //导入依赖的package包/类
@Override public void visitTypeTest(JCInstanceOf node) {
InstanceOf io = new InstanceOf();
io.rawTypeReference(toTree(node.getType(), FlagKey.TYPE_REFERENCE));
io.rawObjectReference(toTree(node.getExpression()));
set(node, io);
}
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:7,代码来源:JcTreeConverter.java
示例15: getPrecedence
import com.sun.tools.javac.tree.JCTree.JCInstanceOf; //导入依赖的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.JCInstanceOf类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论