Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/parser/src/grammar/expressions.rs')
| -rw-r--r-- | crates/parser/src/grammar/expressions.rs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/crates/parser/src/grammar/expressions.rs b/crates/parser/src/grammar/expressions.rs index ba64f58e6d..30d3d4421a 100644 --- a/crates/parser/src/grammar/expressions.rs +++ b/crates/parser/src/grammar/expressions.rs @@ -27,11 +27,7 @@ pub(super) fn expr_with_attrs(p: &mut Parser) -> bool { let success = cm.is_some(); match (has_attrs, cm) { - (true, Some(cm)) => { - let kind = cm.kind(); - cm.undo_completion(p).abandon(p); - m.complete(p, kind); - } + (true, Some(cm)) => cm.extend_to(p, m), _ => m.abandon(p), } @@ -92,11 +88,9 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi, prefer_expr: bool) { // { #[A] bar!()? } // #[B] &() // } - if let Some(cm) = cm { - cm.undo_completion(p).abandon(p); - m.complete(p, kind); - } else { - m.abandon(p); + match cm { + Some(cm) => cm.extend_to(p, m), + None => m.abandon(p), } } else { // test no_semi_after_block |