Implement noasync awaits

Note that there is not yet runtime safety for this.

See #3157
This commit is contained in:
Andrew Kelley
2020-02-16 01:32:15 -05:00
parent cb3a818699
commit 7f7d1fbe5a
6 changed files with 28 additions and 10 deletions

View File

@@ -2596,10 +2596,14 @@ static AstNode *ast_parse_prefix_op(ParseContext *pc) {
return res;
}
Token *noasync_token = eat_token_if(pc, TokenIdKeywordNoAsync);
Token *await = eat_token_if(pc, TokenIdKeywordAwait);
if (await != nullptr) {
AstNode *res = ast_create_node(pc, NodeTypeAwaitExpr, await);
res->data.await_expr.noasync_token = noasync_token;
return res;
} else if (noasync_token != nullptr) {
put_back_token(pc);
}
return nullptr;