add await to syntax, parser for await_expr

This commit is contained in:
Unreal Hoang 2019-07-20 17:41:31 +09:00
parent e18f8495d6
commit 3a7f07c62d
No known key found for this signature in database
GPG key ID: F66217BDC6F37CFA
5 changed files with 93 additions and 0 deletions

View file

@ -393,6 +393,18 @@ fn postfix_expr(
T![.] if p.nth(1) == IDENT && (p.nth(2) == T!['('] || p.nth(2) == T![::]) => {
method_call_expr(p, lhs)
}
T![.] if p.nth(1) == AWAIT_KW => {
// test await_expr
// fn foo() {
// x.await;
// x.0.await;
// x.0().await?.hello();
// }
let m = lhs.precede(p);
p.bump();
p.bump();
m.complete(p, AWAIT_EXPR)
}
T![.] => field_expr(p, lhs),
// test postfix_range
// fn foo() { let x = 1..; }