From 273dc83d68de9493aaf1cc6771f2bac5c0db30c4 Mon Sep 17 00:00:00 2001 From: Brummel Date: Thu, 26 Mar 2026 12:19:33 +0100 Subject: [PATCH] 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. --- src/ast/compiler/binder.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/ast/compiler/binder.rs b/src/ast/compiler/binder.rs index ac0f06f..355f3fd 100644 --- a/src/ast/compiler/binder.rs +++ b/src/ast/compiler/binder.rs @@ -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(