disallow resume and suspend in noasync scopes
This commit is contained in:
@@ -876,6 +876,7 @@ static AstNode *ast_parse_container_field(ParseContext *pc) {
|
||||
// Statement
|
||||
// <- KEYWORD_comptime? VarDecl
|
||||
// / KEYWORD_comptime BlockExprStatement
|
||||
// / KEYWORD_noasync BlockExprStatement
|
||||
// / KEYWORD_suspend (SEMICOLON / BlockExprStatement)
|
||||
// / KEYWORD_defer BlockExprStatement
|
||||
// / KEYWORD_errdefer BlockExprStatement
|
||||
@@ -899,6 +900,14 @@ static AstNode *ast_parse_statement(ParseContext *pc) {
|
||||
return res;
|
||||
}
|
||||
|
||||
Token *noasync = eat_token_if(pc, TokenIdKeywordNoAsync);
|
||||
if (noasync != nullptr) {
|
||||
AstNode *statement = ast_expect(pc, ast_parse_block_expr_statement);
|
||||
AstNode *res = ast_create_node(pc, NodeTypeNoAsync, noasync);
|
||||
res->data.noasync_expr.expr = statement;
|
||||
return res;
|
||||
}
|
||||
|
||||
Token *suspend = eat_token_if(pc, TokenIdKeywordSuspend);
|
||||
if (suspend != nullptr) {
|
||||
AstNode *statement = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user