stage1: Require a block after suspend

Closes #8603
This commit is contained in:
LemonBoy
2021-04-24 10:20:16 +02:00
parent 4ec6d174ad
commit 0aede1a8fc
10 changed files with 100 additions and 109 deletions

View File

@@ -946,10 +946,7 @@ static AstNode *ast_parse_statement(ParseContext *pc) {
Token *suspend = eat_token_if(pc, TokenIdKeywordSuspend);
if (suspend != nullptr) {
AstNode *statement = nullptr;
if (eat_token_if(pc, TokenIdSemicolon) == nullptr)
statement = ast_expect(pc, ast_parse_block_expr_statement);
AstNode *statement = ast_expect(pc, ast_parse_block_expr_statement);
AstNode *res = ast_create_node(pc, NodeTypeSuspend, suspend);
res->data.suspend.block = statement;
return res;