public int getNumCases() { return node.getCases().size(); }
private void print(SwitchStatement node) throws IOException { writer.append("switch").ws().append('('); print(node.getExpression()); writer.append(')').ws().append('{').indent().softNewLine(); for (SwitchCase sc : node.getCases()) { if (sc.getExpression() == null) { writer.append("default:"); } else { writer.append("case "); print(sc.getExpression()); writer.append(':'); } writer.indent().softNewLine(); if (sc.getStatements() != null) { for (AstNode stmt : sc.getStatements()) { print(stmt); writer.softNewLine(); } } writer.outdent(); } writer.outdent().append('}'); }
/** Extract local variables from switch node* */ private void processSwitchNode(Node child, CodeBlock block, Set<Completion> set, String entered, int offset) { SwitchStatement switchStatement = (SwitchStatement) child; if (canProcessNode(switchStatement)) { List<SwitchCase> cases = switchStatement.getCases(); if(cases != null) { for (SwitchCase switchCase : cases) { iterateNode(switchCase, set, entered, block, offset); } } } }
/** * Visits this node, then the switch-expression, then the cases * in lexical order. */ @Override public void visit(NodeVisitor v) { if (v.visit(this)) { expression.visit(v); for (SwitchCase sc: getCases()) { sc.visit(v); } } } }
/** * Visits this node, then the switch-expression, then the cases * in lexical order. */ @Override public void visit(NodeVisitor v) { if (v.visit(this)) { expression.visit(v); for (SwitchCase sc: getCases()) { sc.visit(v); } } } }
/** * Visits this node, then the switch-expression, then the cases * in lexical order. */ @Override public void visit(NodeVisitor v) { if (v.visit(this)) { expression.visit(v); for (SwitchCase sc: getCases()) { sc.visit(v); } } } }
/** * Visits this node, then the switch-expression, then the cases * in lexical order. */ @Override public void visit(NodeVisitor v) { if (v.visit(this)) { expression.visit(v); for (SwitchCase sc: getCases()) { sc.visit(v); } } } }
private void print(SwitchStatement node) throws IOException { writer.append("switch").ws().append('('); print(node.getExpression()); writer.append(')').ws().append('{').indent().softNewLine(); for (SwitchCase sc : node.getCases()) { if (sc.getExpression() == null) { writer.append("default:"); } else { writer.append("case "); print(sc.getExpression()); writer.append(':'); } writer.indent().softNewLine(); if (sc.getStatements() != null) { for (AstNode stmt : sc.getStatements()) { print(stmt); writer.softNewLine(); } } writer.outdent(); } writer.append('}'); }
decompiler.addEOL(Token.LC); for (SwitchCase sc : node.getCases()) { AstNode expr = sc.getExpression(); Node caseExpr = null;
decompiler.addEOL(Token.LC); for (SwitchCase sc : node.getCases()) { AstNode expr = sc.getExpression(); Node caseExpr = null;
decompiler.addEOL(Token.LC); for (SwitchCase sc : node.getCases()) { AstNode expr = sc.getExpression(); Node caseExpr = null;
decompiler.addEOL(Token.LC); for (SwitchCase sc : node.getCases()) { AstNode expr = sc.getExpression(); Node caseExpr = null;