void NodeVisitor::visitCase(const CaseStatementPtr& node) { for(auto condition : node->getConditions()) { ACCEPT(condition.condition); ACCEPT(condition.guard); } ACCEPT(node->getCodeBlock()); }
void Parser::parseSwitchStatements(const CaseStatementPtr& case_) { Token token; Flags flags(this); flags -= SUPPRESS_TRAILING_CLOSURE; CodeBlockPtr codeBlock = case_->getCodeBlock(); while(true) { expect_next(token); if(token.type == TokenType::Semicolon) continue; restore(token); Keyword::T k = token.getKeyword(); if(token.type == TokenType::CloseBrace || (k == Keyword::Case || k == Keyword::Default)) { break; } StatementPtr st = parseStatement(); codeBlock->addStatement(st); } }