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 | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/crates/parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs index 3214fd90f2..cabdd74b09 100644 --- a/crates/parser/src/grammar/expressions/atom.rs +++ b/crates/parser/src/grammar/expressions/atom.rs @@ -216,16 +216,19 @@ fn tuple_expr(p: &mut Parser<'_>) -> CompletedMarker { let mut saw_comma = false; let mut saw_expr = false; - // test_err tuple_expr_leading_comma - // fn foo() { - // (,); - // } - if p.eat(T![,]) { - p.error("expected expression"); - saw_comma = true; - } - while !p.at(EOF) && !p.at(T![')']) { + // test_err tuple_expr_empty_expr + // fn foo() { + // (,); + // (a, , b); + // } + if p.current() == T![,] { + p.error("expected expression"); + p.bump(T![,]); + saw_comma = true; + continue; + } + saw_expr = true; // test tuple_attrs @@ -888,6 +891,10 @@ fn return_expr(p: &mut Parser<'_>) -> CompletedMarker { let m = p.start(); p.bump(T![return]); if p.at_ts(EXPR_FIRST) { + // test return_attr + // fn foo() { + // return #[attr] 1; + // } expr(p); } m.complete(p, RETURN_EXPR) |