mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Parse destructuring assignment
The only patterns we should parse are `..` in structs and `_`: the rest are either not supported or already valid expressions.
This commit is contained in:
parent
ab2af50655
commit
d9f0731bd2
18 changed files with 543 additions and 218 deletions
|
@ -593,7 +593,16 @@ pub(crate) fn record_expr_field_list(p: &mut Parser) {
|
|||
T![.] if p.at(T![..]) => {
|
||||
m.abandon(p);
|
||||
p.bump(T![..]);
|
||||
expr(p);
|
||||
|
||||
// test destructuring_assignment_struct_rest_pattern
|
||||
// fn foo() {
|
||||
// S { .. } = S {};
|
||||
// }
|
||||
|
||||
// We permit `.. }` on the left-hand side of a destructuring assignment.
|
||||
if !p.at(T!['}']) {
|
||||
expr(p);
|
||||
}
|
||||
}
|
||||
T!['{'] => {
|
||||
error_block(p, "expected a field");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue