mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Add async keyword
This commit is contained in:
parent
a9d09b7ec0
commit
ad72699553
8 changed files with 40 additions and 3 deletions
|
@ -93,6 +93,11 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar
|
|||
}
|
||||
}
|
||||
|
||||
ASYNC_KW if la == L_CURLY => {
|
||||
let m = p.start();
|
||||
p.bump();
|
||||
block_expr(p, Some(m))
|
||||
}
|
||||
MATCH_KW => match_expr(p),
|
||||
UNSAFE_KW if la == L_CURLY => {
|
||||
let m = p.start();
|
||||
|
|
|
@ -86,9 +86,14 @@ pub(super) fn maybe_item(p: &mut Parser, flavor: ItemFlavor) -> MaybeItem {
|
|||
}
|
||||
|
||||
let mut has_mods = false;
|
||||
// modifiers
|
||||
has_mods |= p.eat(CONST_KW);
|
||||
|
||||
// modifiers
|
||||
|
||||
has_mods |= p.eat(CONST_KW);
|
||||
if p.at(ASYNC_KW) && p.nth(1) != L_CURLY {
|
||||
p.eat(ASYNC_KW);
|
||||
has_mods = true;
|
||||
}
|
||||
// test_err unsafe_block_in_mod
|
||||
// fn foo(){} unsafe { } fn bar(){}
|
||||
if p.at(UNSAFE_KW) && p.nth(1) != L_CURLY {
|
||||
|
@ -110,6 +115,9 @@ pub(super) fn maybe_item(p: &mut Parser, flavor: ItemFlavor) -> MaybeItem {
|
|||
|
||||
// items
|
||||
let kind = match p.current() {
|
||||
// test async_fn
|
||||
// async fn foo() {}
|
||||
|
||||
// test extern_fn
|
||||
// extern fn foo() {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue