Search in sources :

Example 16 with CaseTree

use of com.sun.source.tree.CaseTree in project j2objc by google.

the class TreeConverter method convertSwitch.

private TreeNode convertSwitch(SwitchTree node, TreePath parent) {
    TreePath path = getTreePath(parent, node);
    SwitchStatement newNode = new SwitchStatement().setExpression(convertWithoutParens(node.getExpression(), path));
    for (CaseTree switchCase : node.getCases()) {
        newNode.addStatement((SwitchCase) convert(switchCase, path));
        TreePath switchCasePath = getTreePath(path, switchCase);
        for (StatementTree s : switchCase.getStatements()) {
            newNode.addStatement((Statement) convert(s, switchCasePath));
        }
    }
    return newNode;
}
Also used : ExpressionStatementTree(com.sun.source.tree.ExpressionStatementTree) LabeledStatementTree(com.sun.source.tree.LabeledStatementTree) StatementTree(com.sun.source.tree.StatementTree) CaseTree(com.sun.source.tree.CaseTree) SwitchStatement(com.google.devtools.j2objc.ast.SwitchStatement) TreePath(com.sun.source.util.TreePath)

Aggregations

CaseTree (com.sun.source.tree.CaseTree)16 Tree (com.sun.source.tree.Tree)6 CompilationUnitTree (com.sun.source.tree.CompilationUnitTree)4 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Iterables.getLast (com.google.common.collect.Iterables.getLast)3 BugPattern (com.google.errorprone.BugPattern)3 VisitorState (com.google.errorprone.VisitorState)3 SuggestedFix (com.google.errorprone.fixes.SuggestedFix)3 Description (com.google.errorprone.matchers.Description)3 NO_MATCH (com.google.errorprone.matchers.Description.NO_MATCH)3 BlockTree (com.sun.source.tree.BlockTree)3 ExpressionTree (com.sun.source.tree.ExpressionTree)3 IdentifierTree (com.sun.source.tree.IdentifierTree)3 ImportTree (com.sun.source.tree.ImportTree)3 MemberSelectTree (com.sun.source.tree.MemberSelectTree)3 StatementTree (com.sun.source.tree.StatementTree)3 VariableTree (com.sun.source.tree.VariableTree)3 SwitchTreeMatcher (com.google.errorprone.bugpatterns.BugChecker.SwitchTreeMatcher)2 Reachability (com.google.errorprone.util.Reachability)2