本文整理汇总了Java中com.sun.tools.javac.tree.JCTree.JCConditional类的典型用法代码示例。如果您正苦于以下问题:Java JCConditional类的具体用法?Java JCConditional怎么用?Java JCConditional使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JCConditional类属于com.sun.tools.javac.tree.JCTree包,在下文中一共展示了JCConditional类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: diffConditional
import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
protected int diffConditional(JCConditional oldT, JCConditional newT, int[] bounds) {
int localPointer = bounds[0];
// cond
int[] condBounds = getBounds(oldT.cond);
copyTo(localPointer, condBounds[0]);
localPointer = diffTree(oldT.cond, newT.cond, condBounds);
// true
int[] trueBounds = getBounds(oldT.truepart);
copyTo(localPointer, trueBounds[0]);
localPointer = diffTree(oldT.truepart, newT.truepart, trueBounds);
// false
int[] falseBounds = getBounds(oldT.falsepart);
copyTo(localPointer, falseBounds[0]);
localPointer = diffTree(oldT.falsepart, newT.falsepart, falseBounds);
copyTo(localPointer, bounds[1]);
return bounds[1];
}
示例2: visitConditional
import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
@Override public void visitConditional(JCConditional tree) {
print(tree.cond);
print(" ? ");
print(tree.truepart);
print(" : ");
print(tree.falsepart);
}
示例3: visitConditional
import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
public void visitConditional(JCConditional that) {
try {
print("JCConditional:");
} catch (Exception e) {
}
super.visitConditional(that);
}
示例4: visitConditional
import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
public void visitConditional(JCConditional tree) {
try {
open(prec, TreeInfo.condPrec);
printExpr(tree.cond, TreeInfo.condPrec);
print(" ? ");
printExpr(tree.truepart, TreeInfo.condPrec);
print(" : ");
printExpr(tree.falsepart, TreeInfo.condPrec);
close(prec, TreeInfo.condPrec);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
示例5: inline
import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
@Override
public JCConditional inline(Inliner inliner) throws CouldNotResolveImportException {
return inliner.maker().Conditional(
getCondition().inline(inliner),
getTrueExpression().inline(inliner),
getFalseExpression().inline(inliner));
}
示例6: visitConditional
import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
@Override public void visitConditional(JCConditional tree) {
printNode(tree);
child("cond", tree.cond);
child("truepart", tree.truepart);
child("falsepart", tree.falsepart);
indent--;
}
示例7: visitConditional
import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
@Override public void visitConditional(JCConditional node) {
InlineIfExpression iie = new InlineIfExpression();
iie.rawCondition(toTree(node.getCondition()));
iie.rawIfTrue(toTree(node.getTrueExpression()));
iie.rawIfFalse(toTree(node.getFalseExpression()));
set(node, iie);
}
示例8: inline
import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
@Override
public JCConditional inline(Inliner inliner) throws CouldNotResolveImportException {
return inliner
.maker()
.Conditional(
getCondition().inline(inliner),
getTrueExpression().inline(inliner),
getFalseExpression().inline(inliner));
}
示例9: visitConditionalExpression
import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
@Override
public Choice<State<JCConditional>> visitConditionalExpression(
final ConditionalExpressionTree node, State<?> state) {
return chooseSubtrees(
state,
s -> unifyExpression(node.getCondition(), s),
s -> unifyExpression(node.getTrueExpression(), s),
s -> unifyExpression(node.getFalseExpression(), s),
maker()::Conditional);
}
示例10: visitConditional
import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
public void visitConditional(JCConditional tree) {
try {
open(prec, TreeInfo.condPrec);
printExpr(tree.cond, TreeInfo.condPrec);
print(" ? ");
printExpr(tree.truepart, TreeInfo.condPrec);
print(" : ");
printExpr(tree.falsepart, TreeInfo.condPrec);
close(prec, TreeInfo.condPrec);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
示例11: visitConditional
import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
public void visitConditional(JCConditional tree) {
attribExpr(tree.cond, env, syms.booleanType);
attribExpr(tree.truepart, env);
attribExpr(tree.falsepart, env);
result = check(tree,
capture(condType(tree.pos(), tree.cond.type,
tree.truepart.type, tree.falsepart.type)),
VAL, pkind, pt);
}
示例12: createSimpleGetterBody
import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
private List<JCStatement> createSimpleGetterBody(TreeMaker treeMaker, JavacNode field) {
JCVariableDecl fieldDecl = (JCVariableDecl) field.get();
JCExpression fieldRef = createFieldAccessor(treeMaker, field, FieldAccess.ALWAYS_FIELD);
JCStatement returnExpression = null;
String varTypeString = fieldDecl.vartype.toString();
boolean isMutable = false;
boolean isTypeCastNeeded = false;
if (Timestamp.class.getSimpleName().equals(varTypeString) || Timestamp.class.getName().equals(varTypeString)) {
isMutable = true;
isTypeCastNeeded = true;
} else if (varTypeString.endsWith("[]")) {
isMutable = true;
}
if (isMutable) {
JCExpression nullCheck = treeMaker.Binary(CTC_EQUAL, fieldRef, treeMaker.Literal(CTC_BOT, null));
JCExpression callClone = treeMaker.Apply(List.<JCExpression>nil(), treeMaker.Select(fieldRef, field.toName("clone")), List.<JCExpression>nil());
if (isTypeCastNeeded) {
callClone = treeMaker.TypeCast(
fieldDecl.vartype,
callClone
);
}
JCConditional conditional = treeMaker.Conditional(
nullCheck,
treeMaker.Literal(CTC_BOT, null),
callClone
);
returnExpression = treeMaker.Return(conditional);
} else {
returnExpression = treeMaker.Return(fieldRef);
}
return List.<JCStatement>of(returnExpression);
}
示例13: matchConditional
import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
private boolean matchConditional(JCConditional t1, JCConditional t2) {
return treesMatch(t1.cond, t2.cond) && treesMatch(t1.truepart, t2.truepart) &&
treesMatch(t1.falsepart, t2.falsepart);
}
示例14: visitConditional
import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
@Override
public void visitConditional(JCConditional that) {
processArg(that, speculativeTree -> new ConditionalType(that, env, speculativeTree));
}
示例15: ConditionalType
import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
ConditionalType(JCExpression tree, Env<AttrContext> env, JCConditional speculativeCond) {
this(tree, env, speculativeCond, new HashMap<>());
}