Refactor if-else binding scope management

The explicit scope management within the `if`/`else` binding logic was
redundant.
The `bind` function recursively handles scope creation and destruction
for
expressions, making manual scope manipulation here unnecessary and
error-prone.
This commit is contained in:
2026-03-26 12:19:33 +01:00
parent c0125216b4
commit 273dc83d68
-5
View File
@@ -243,16 +243,11 @@ impl Binder {
else_br,
} => {
let cond = self.bind(cond.as_ref(), ExprContext::Expression, diag);
self.functions.last_mut().unwrap().push_scope();
let then_br = self.bind(then_br.as_ref(), ctx, diag);
self.functions.last_mut().unwrap().pop_scope();
let mut else_br_bound = None;
if let Some(e) = else_br {
self.functions.last_mut().unwrap().push_scope();
else_br_bound = Some(Rc::new(self.bind(e, ctx, diag)));
self.functions.last_mut().unwrap().pop_scope();
}
self.make_node(