diff options
| author | Vexu <git@vexu.eu> | 2020-03-09 15:51:51 +0200 |
|---|---|---|
| committer | Vexu <git@vexu.eu> | 2020-03-09 15:51:51 +0200 |
| commit | 03c1431f9c0b651f3f1853f11112edc07555883d (patch) | |
| tree | 4d87acafcb8b97bf99292559894205bdced12dc1 /src/parser.cpp | |
| parent | 3618256c97a9988f7d623eeabb667010ca30656f (diff) | |
| download | zig-03c1431f9c0b651f3f1853f11112edc07555883d.tar.gz zig-03c1431f9c0b651f3f1853f11112edc07555883d.zip | |
disallow resume and suspend in noasync scopes
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index 7ff24db184..cdd254962e 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -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; |
