Search in sources :

Example 1 with SwitchExpr

use of com.github.javaparser.ast.expr.SwitchExpr in project checker-framework by typetools.

the class JointJavacJavaParserVisitor method visitSwitchExpression17.

/**
 * Visit a switch expression.
 *
 * @param javacTree switch expression tree
 * @param javaParserNode java parser node
 * @return null
 */
public Void visitSwitchExpression17(Tree javacTree, Node javaParserNode) {
    SwitchExpr node = castNode(SwitchExpr.class, javaParserNode, javacTree);
    processSwitchExpression(javacTree, node);
    // Switch expressions are always parenthesized in javac but never in JavaParser.
    ExpressionTree expression = ((ParenthesizedTree) TreeUtils.switchExpressionTreeGetExpression(javacTree)).getExpression();
    expression.accept(this, node.getSelector());
    visitLists(TreeUtils.switchExpressionTreeGetCases(javacTree), node.getEntries());
    return null;
}
Also used : SwitchExpr(com.github.javaparser.ast.expr.SwitchExpr) ParenthesizedTree(com.sun.source.tree.ParenthesizedTree) LambdaExpressionTree(com.sun.source.tree.LambdaExpressionTree) ConditionalExpressionTree(com.sun.source.tree.ConditionalExpressionTree) ExpressionTree(com.sun.source.tree.ExpressionTree)

Example 2 with SwitchExpr

use of com.github.javaparser.ast.expr.SwitchExpr in project checker-framework by typetools.

the class DoubleJavaParserVisitor method visit.

@Override
public void visit(final SwitchExpr node1, final Node other) {
    SwitchExpr node2 = (SwitchExpr) other;
    defaultAction(node1, node2);
    visitLists(node1.getEntries(), node2.getEntries());
    node1.getSelector().accept(this, node2.getSelector());
}
Also used : SwitchExpr(com.github.javaparser.ast.expr.SwitchExpr)

Aggregations

SwitchExpr (com.github.javaparser.ast.expr.SwitchExpr)2 ConditionalExpressionTree (com.sun.source.tree.ConditionalExpressionTree)1 ExpressionTree (com.sun.source.tree.ExpressionTree)1 LambdaExpressionTree (com.sun.source.tree.LambdaExpressionTree)1 ParenthesizedTree (com.sun.source.tree.ParenthesizedTree)1