mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
Implement most of the recent round of PR feedback
This commit is contained in:
parent
03f83a0ba8
commit
6a2ffb2f5a
13 changed files with 67 additions and 116 deletions
|
@ -1280,8 +1280,11 @@ pub fn canonicalize_expr<'a>(
|
|||
);
|
||||
|
||||
if let Some(after_return) = after_return {
|
||||
let region_with_return =
|
||||
Region::span_across(&return_expr.region, &after_return.region);
|
||||
|
||||
env.problem(Problem::StatementsAfterReturn {
|
||||
region: after_return.region,
|
||||
region: region_with_return,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1649,6 +1652,17 @@ fn canonicalize_closure_body<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
let final_expr = match &loc_body_expr.value {
|
||||
Expr::LetRec(_, final_expr, _) | Expr::LetNonRec(_, final_expr) => &final_expr.value,
|
||||
_ => &loc_body_expr.value,
|
||||
};
|
||||
|
||||
if let Expr::Return { return_value, .. } = final_expr {
|
||||
env.problem(Problem::ReturnAtEndOfFunction {
|
||||
region: return_value.region,
|
||||
});
|
||||
}
|
||||
|
||||
// store the references of this function in the Env. This information is used
|
||||
// when we canonicalize a surrounding def (if it exists)
|
||||
env.closures.insert(symbol, output.references.clone());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue