Support let...else

This commit is contained in:
Jonas Schievink 2021-10-07 17:05:50 +02:00
parent 4675410f07
commit f8acae7895
13 changed files with 162 additions and 8 deletions

View file

@ -102,6 +102,16 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi, prefer_expr: bool) {
expressions::expr(p);
}
if p.at(T![else]) {
// test let_else
// fn f() { let Some(x) = opt else { return }; }
let m = p.start();
p.bump(T![else]);
block_expr(p);
m.complete(p, LET_ELSE);
}
match with_semi {
StmtWithSemi::No => (),
StmtWithSemi::Optional => {