Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/parser/src/grammar/expressions/atom.rs')
| -rw-r--r-- | crates/parser/src/grammar/expressions/atom.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/crates/parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs index 76d9b39d38..b4d88f8d0e 100644 --- a/crates/parser/src/grammar/expressions/atom.rs +++ b/crates/parser/src/grammar/expressions/atom.rs @@ -74,7 +74,14 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar T![|] => closure_expr(p), T![move] if la == T![|] => closure_expr(p), T![async] if la == T![|] || (la == T![move] && p.nth(2) == T![|]) => closure_expr(p), - T![static] if la == T![|] || (la == T![move] && p.nth(2) == T![|]) => closure_expr(p), + T![static] + if la == T![|] + || (la == T![move] && p.nth(2) == T![|]) + || (la == T![async] && p.nth(2) == T![|]) + || (la == T![async] && p.nth(2) == T![move] && p.nth(3) == T![|]) => + { + closure_expr(p) + } T![if] => if_expr(p), T![loop] => loop_expr(p, None), @@ -237,6 +244,8 @@ fn array_expr(p: &mut Parser) -> CompletedMarker { // async move || {}; // static || {}; // static move || {}; +// static async || {}; +// static async move || {}; // } fn closure_expr(p: &mut Parser) -> CompletedMarker { assert!( @@ -246,10 +255,15 @@ fn closure_expr(p: &mut Parser) -> CompletedMarker { || (p.at(T![async]) && p.nth(1) == T![move] && p.nth(2) == T![|]) || (p.at(T![static]) && p.nth(1) == T![|]) || (p.at(T![static]) && p.nth(1) == T![move] && p.nth(2) == T![|]) + || (p.at(T![static]) && p.nth(1) == T![async] && p.nth(2) == T![|]) + || (p.at(T![static]) + && p.nth(1) == T![async] + && p.nth(2) == T![move] + && p.nth(3) == T![|]) ); let m = p.start(); - p.eat(T![async]); p.eat(T![static]); + p.eat(T![async]); p.eat(T![move]); params::param_list_closure(p); if opt_ret_type(p) { @@ -257,6 +271,7 @@ fn closure_expr(p: &mut Parser) -> CompletedMarker { // fn main() { || -> i32 { 92 }(); } block_expr(p); } else if p.at_ts(EXPR_FIRST) { + println!("gg"); expr(p); } else { p.error("expected expression"); |