mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Add support for parsing multiple if and while-let patterns
This commit is contained in:
parent
bbaf750b10
commit
1f4468a8da
3 changed files with 174 additions and 1 deletions
|
@ -281,10 +281,20 @@ fn for_expr(p: &mut Parser, m: Option<Marker>) -> CompletedMarker {
|
|||
|
||||
// test cond
|
||||
// fn foo() { if let Some(_) = None {} }
|
||||
// fn bar() {
|
||||
// if let Some(_) | Some(_) = None {}
|
||||
// if let | Some(_) = None {}
|
||||
// while let Some(_) | Some(_) = None {}
|
||||
// while let | Some(_) = None {}
|
||||
// }
|
||||
fn cond(p: &mut Parser) {
|
||||
let m = p.start();
|
||||
if p.eat(LET_KW) {
|
||||
p.eat(PIPE);
|
||||
patterns::pattern(p);
|
||||
while p.eat(PIPE) {
|
||||
patterns::pattern(p);
|
||||
}
|
||||
p.expect(EQ);
|
||||
}
|
||||
expr_no_struct(p);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue