| ... | @@ -1598,8 +1598,6 @@ static AstNode *ast_parse_variable_declaration_expr(ParseContext *pc, size_t *to | ... | @@ -1598,8 +1598,6 @@ static AstNode *ast_parse_variable_declaration_expr(ParseContext *pc, size_t *to |
| 1598 | *token_index += 1; | 1598 | *token_index += 1; |
| 1599 | if (eq_or_colon->id == TokenIdEq) { | 1599 | if (eq_or_colon->id == TokenIdEq) { |
| 1600 | node->data.variable_declaration.expr = ast_parse_expression(pc, token_index, true); | 1600 | node->data.variable_declaration.expr = ast_parse_expression(pc, token_index, true); |
| 1601 | | | |
| 1602 | return node; | | |
| 1603 | } else if (eq_or_colon->id == TokenIdColon) { | 1601 | } else if (eq_or_colon->id == TokenIdColon) { |
| 1604 | node->data.variable_declaration.type = ast_parse_type_expr(pc, token_index, true); | 1602 | node->data.variable_declaration.type = ast_parse_type_expr(pc, token_index, true); |
| 1605 | Token *eq_token = &pc->tokens->at(*token_index); | 1603 | Token *eq_token = &pc->tokens->at(*token_index); |
| ... | @@ -1608,11 +1606,15 @@ static AstNode *ast_parse_variable_declaration_expr(ParseContext *pc, size_t *to | ... | @@ -1608,11 +1606,15 @@ static AstNode *ast_parse_variable_declaration_expr(ParseContext *pc, size_t *to |
| 1608 | | 1606 | |
| 1609 | node->data.variable_declaration.expr = ast_parse_expression(pc, token_index, true); | 1607 | node->data.variable_declaration.expr = ast_parse_expression(pc, token_index, true); |
| 1610 | } | 1608 | } |
| 1611 | | | |
| 1612 | return node; | | |
| 1613 | } else { | 1609 | } else { |
| 1614 | ast_invalid_token_error(pc, eq_or_colon); | 1610 | ast_invalid_token_error(pc, eq_or_colon); |
| 1615 | } | 1611 | } |
| | 1612 | |
| | 1613 | // peek ahead and ensure that all variable declarations are followed by a semicolon |
| | 1614 | Token *semicolon_token = &pc->tokens->at(*token_index); |
| | 1615 | ast_expect_token(pc, semicolon_token, TokenIdSemicolon); |
| | 1616 | |
| | 1617 | return node; |
| 1616 | } | 1618 | } |
| 1617 | | 1619 | |
| 1618 | /* | 1620 | /* |