basic support for switch expression

This commit is contained in:
Andrew Kelley
2016-01-20 02:12:24 -07:00
parent 3eca42c17b
commit ad9759bc8e
7 changed files with 209 additions and 21 deletions

View File

@@ -2255,8 +2255,8 @@ static AstNode *ast_parse_switch_expr(ParseContext *pc, int *token_index, bool m
break;
}
Token *arrow_or_comma = &pc->tokens->at(*token_index);
if (arrow_or_comma->id == TokenIdComma) {
Token *arrow_or_colon = &pc->tokens->at(*token_index);
if (arrow_or_colon->id == TokenIdColon) {
*token_index += 1;
ast_eat_token(pc, token_index, TokenIdLParen);
prong_node->data.switch_prong.var_symbol = ast_parse_symbol(pc, token_index);