Unwrap expr in loop

This commit is contained in:
Kiryl Dziamura 2023-07-03 15:38:59 +02:00
parent 29592ddb9b
commit 3ccb6114b2
No known key found for this signature in database
GPG key ID: FB539501A4561ACF

View file

@ -2272,10 +2272,11 @@ fn canonicalize_pending_body<'a>(
opt_loc_annotation: Option<Loc<crate::annotation::Annotation>>,
) -> DefOutput {
let loc_value = match &loc_expr.value {
ast::Expr::ParensAround(loc_value) => loc_value,
_ => &loc_expr.value,
};
let mut loc_value = &loc_expr.value;
while let ast::Expr::ParensAround(value) = loc_value {
loc_value = value;
}
// We treat closure definitions `foo = \a, b -> ...` differently from other body expressions,
// because they need more bookkeeping (for tail calls, closure captures, etc.)