@Override public Description matchConditionalExpression( ConditionalExpressionTree tree, VisitorState state) { if (!matchWithinClass) { return Description.NO_MATCH; } return doUnboxingCheck(state, tree.getCondition()); }
@Nullable @Override public Type visitConditionalExpression(ConditionalExpressionTree tree, Void unused) { return tree.getCondition().equals(current) ? state.getSymtab().booleanType : getType(tree); }
@Override public JCConditional visitConditionalExpression(ConditionalExpressionTree tree, Void v) { return maker.Conditional( (JCExpression) tree.getCondition(), copy((JCExpression) tree.getTrueExpression()), copy((JCExpression) tree.getFalseExpression())); } }.copy(expr);
@Override public Number visitConditionalExpression(ConditionalExpressionTree node, Void p) { Number ifTrue = node.getTrueExpression().accept(this, null); Number ifFalse = node.getFalseExpression().accept(this, null); Boolean condition = ASTHelpers.constValue(node.getCondition(), Boolean.class); if (condition == null) { return null; } return condition ? ifTrue : ifFalse; }
@Override public UExpression visitConditionalExpression(ConditionalExpressionTree tree, Void v) { return UConditional.create( template(tree.getCondition()), template(tree.getTrueExpression()), template(tree.getFalseExpression())); }
@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); }
@Override @Nullable public Choice<Unifier> visitConditionalExpression( ConditionalExpressionTree conditional, Unifier unifier) { return getCondition() .unify(conditional.getCondition(), unifier.fork()) .thenChoose(unifications(getTrueExpression(), conditional.getTrueExpression())) .thenChoose(unifications(getFalseExpression(), conditional.getFalseExpression())) .or( getCondition() .negate() .unify(conditional.getCondition(), unifier.fork()) .thenChoose(unifications(getFalseExpression(), conditional.getTrueExpression())) .thenChoose(unifications(getTrueExpression(), conditional.getFalseExpression()))); }
ConditionalExpressionTree condTree = (ConditionalExpressionTree) returnTree.getExpression(); ExpressionTree conditionExpr = condTree.getCondition(); conditionExpr = ASTHelpers.stripParentheses(conditionExpr); if (!(conditionExpr instanceof BinaryTree)) {
@Override public Void visitConditionalExpression(ConditionalExpressionTree expected, Tree actual) { Optional<ConditionalExpressionTree> other = checkTypeAndCast(expected, actual); if (!other.isPresent()) { addTypeMismatch(expected, actual); return null; } scan(expected.getCondition(), other.get().getCondition()); scan(expected.getTrueExpression(), other.get().getTrueExpression()); scan(expected.getFalseExpression(), other.get().getFalseExpression()); return null; }
@Override public Void visitConditionalExpression(ConditionalExpressionTree expected, Tree actual) { Optional<ConditionalExpressionTree> other = checkTypeAndCast(expected, actual); if (!other.isPresent()) { addTypeMismatch(expected, actual); return null; } scan(expected.getCondition(), other.get().getCondition()); scan(expected.getTrueExpression(), other.get().getTrueExpression()); scan(expected.getFalseExpression(), other.get().getFalseExpression()); return null; }
@Override public Void visitConditionalExpression(ConditionalExpressionTree expected, Tree actual) { Optional<ConditionalExpressionTree> other = checkTypeAndCast(expected, actual); if (!other.isPresent()) { addTypeMismatch(expected, actual); return null; } scan(expected.getCondition(), other.get().getCondition()); scan(expected.getTrueExpression(), other.get().getTrueExpression()); scan(expected.getFalseExpression(), other.get().getFalseExpression()); return null; }
public Boolean visitConditionalExpression(ConditionalExpressionTree node, TreePath p) { if (p == null) { super.visitConditionalExpression(node, p); return false; } ConditionalExpressionTree t = (ConditionalExpressionTree) p.getLeaf(); if (!scan(node.getCondition(), t.getCondition(), p)) return false; if (!scan(node.getFalseExpression(), t.getFalseExpression(), p)) return false; return scan(node.getTrueExpression(), t.getTrueExpression(), p); }
@Override public JCConditional visitConditionalExpression(ConditionalExpressionTree tree, Void v) { return maker.Conditional( (JCExpression) tree.getCondition(), copy((JCExpression) tree.getTrueExpression()), copy((JCExpression) tree.getFalseExpression())); } }.copy(expr);
public R visitConditionalExpression(ConditionalExpressionTree node, P p) { R r = scan(node.getCondition(), p); r = scanAndReduce(node.getTrueExpression(), p, r); r = scanAndReduce(node.getFalseExpression(), p, r); return r; }
@Override public Number visitConditionalExpression(ConditionalExpressionTree node, Void p) { Number ifTrue = node.getTrueExpression().accept(this, null); Number ifFalse = node.getFalseExpression().accept(this, null); Boolean condition = ASTHelpers.constValue(node.getCondition(), Boolean.class); if (condition == null) { return null; } return condition ? ifTrue : ifFalse; }
public R visitConditionalExpression(ConditionalExpressionTree node, P p) { R r = scan(node.getCondition(), p); r = scanAndReduce(node.getTrueExpression(), p, r); r = scanAndReduce(node.getFalseExpression(), p, r); return r; }
@Override public UExpression visitConditionalExpression(ConditionalExpressionTree tree, Void v) { return UConditional.create( template(tree.getCondition()), template(tree.getTrueExpression()), template(tree.getFalseExpression())); }
@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); }
@Override public Tree visitConditionalExpression(ConditionalExpressionTree tree, Void p) { ConditionalExpressionTree n = make.ConditionalExpression(tree.getCondition(), tree.getTrueExpression(), tree.getFalseExpression()); model.setType(n, model.getType(tree)); comments.copyComments(tree, n); model.setPos(n, model.getPos(tree)); return n; }
@Override public JExpression visitConditionalExpression(ConditionalExpressionTree ct, Void __) { return $b.invoke("ternaryOp") .arg(visit(ct.getCondition())) .arg(visit(ct.getTrueExpression())) .arg(visit(ct.getFalseExpression())); }