Improve recovery for incomplete lambdas

This commit is contained in:
Aleksey Kladov 2019-12-17 12:11:01 +01:00
parent cb79e30d53
commit 3e2f4e4293
3 changed files with 94 additions and 1 deletions

View file

@ -248,7 +248,12 @@ fn lambda_expr(p: &mut Parser) -> CompletedMarker {
p.error("expected `{`");
}
}
expr(p);
if p.at_ts(EXPR_FIRST) {
expr(p);
} else {
p.error("expected expression");
}
m.complete(p, LAMBDA_EXPR)
}