accept(x.getExpr());
jsSwitch.setExpr((JsExpression) pop()); // expr
List/* <JStatement> */bodyStmts = x.getBody().statements;
if (bodyStmts.size() > 0) {
JsStatements curStatements = null;
for (int i = 0; i < bodyStmts.size(); ++i) {
JStatement stmt = (JStatement) bodyStmts.get(i);
accept(stmt);
if (stmt instanceof JCaseStatement) {
// create a new switch member
JsSwitchMember switchMember = (JsSwitchMember) pop(); // stmt
jsSwitch.getCases().add(switchMember);
curStatements = switchMember.getStmts();
} else {
// add to statements for current case
assert (curStatements != null);
JsStatement newStmt = (JsStatement) pop(); // stmt
if (newStmt != null) {
// Empty JLocalDeclarationStatement produces a null
curStatements.add(newStmt);
}
}
}
}