From 2ab6f6c91418abfcfffcd8bc3d07ce290951fa67 Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Sun, 13 Oct 2024 16:16:27 +0200 Subject: [PATCH] resolving shadoving in inlined functions correctly --- lang/src/codegen.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/src/codegen.rs b/lang/src/codegen.rs index c45a772..3dde448 100644 --- a/lang/src/codegen.rs +++ b/lang/src/codegen.rs @@ -1438,7 +1438,7 @@ impl Codegen { E::Ident { id, .. } if ident::is_null(id) => Some(Value::ty(id.into())), E::Ident { id, .. } if let Some((var_index, var)) = - self.ci.vars.iter_mut().enumerate().find(|(_, v)| v.id == id) => + self.ci.vars.iter_mut().enumerate().rfind(|(_, v)| v.id == id) => { let loc = var.value.loc.as_ref(); Some(Value { ty: self.ci.vars[var_index].value.ty, loc })