| ... | ... | @@ -812,7 +812,7 @@ static AstNode *ast_parse_fn_proto(ParseContext *pc) { |
| 812 | 812 | AstNode *return_type = nullptr; |
| 813 | 813 | if (var == nullptr) { |
| 814 | 814 | exmark = eat_token_if(pc, TokenIdBang); |
| 815 | | return_type = ast_parse_type_expr(pc); |
| 815 | return_type = ast_expect(pc, ast_parse_type_expr); |
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | AstNode *res = ast_create_node(pc, NodeTypeFnProto, first); |
| ... | ... | @@ -1606,6 +1606,7 @@ static AstNode *ast_parse_suffix_expr(ParseContext *pc) { |
| 1606 | 1606 | // / FLOAT |
| 1607 | 1607 | // / FnProto |
| 1608 | 1608 | // / GroupedExpr |
| 1609 | // / LabeledTypeExpr |
| 1609 | 1610 | // / IDENTIFIER |
| 1610 | 1611 | // / IfTypeExpr |
| 1611 | 1612 | // / INTEGER |
| ... | ... | @@ -1618,7 +1619,6 @@ static AstNode *ast_parse_suffix_expr(ParseContext *pc) { |
| 1618 | 1619 | // / KEYWORD_true |
| 1619 | 1620 | // / KEYWORD_undefined |
| 1620 | 1621 | // / KEYWORD_unreachable |
| 1621 | | // / LabeledTypeExpr |
| 1622 | 1622 | // / STRINGLITERAL |
| 1623 | 1623 | // / SwitchExpr |
| 1624 | 1624 | static AstNode *ast_parse_primary_type_expr(ParseContext *pc) { |
| ... | ... | @@ -1682,6 +1682,10 @@ static AstNode *ast_parse_primary_type_expr(ParseContext *pc) { |
| 1682 | 1682 | if (grouped_expr != nullptr) |
| 1683 | 1683 | return grouped_expr; |
| 1684 | 1684 | |
| 1685 | AstNode *labeled_type_expr = ast_parse_labeled_type_expr(pc); |
| 1686 | if (labeled_type_expr != nullptr) |
| 1687 | return labeled_type_expr; |
| 1688 | |
| 1685 | 1689 | Token *identifier = eat_token_if(pc, TokenIdSymbol); |
| 1686 | 1690 | if (identifier != nullptr) |
| 1687 | 1691 | return token_symbol(pc, identifier); |
| ... | ... | @@ -1750,10 +1754,6 @@ static AstNode *ast_parse_primary_type_expr(ParseContext *pc) { |
| 1750 | 1754 | if (unreachable != nullptr) |
| 1751 | 1755 | return ast_create_node(pc, NodeTypeUnreachable, unreachable); |
| 1752 | 1756 | |
| 1753 | | AstNode *labeled_type_expr = ast_parse_labeled_type_expr(pc); |
| 1754 | | if (labeled_type_expr != nullptr) |
| 1755 | | return labeled_type_expr; |
| 1756 | | |
| 1757 | 1757 | Token *string_lit = eat_token_if(pc, TokenIdStringLiteral); |
| 1758 | 1758 | if (string_lit != nullptr) { |
| 1759 | 1759 | AstNode *res = ast_create_node(pc, NodeTypeStringLiteral, string_lit); |