From 33d78fbc52806690d13ef366188e9a920e51acc4 Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Mon, 28 Oct 2024 17:22:18 +0100 Subject: [PATCH] missing scoping --- lang/src/son.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lang/src/son.rs b/lang/src/son.rs index b2dd1b2..8095497 100644 --- a/lang/src/son.rs +++ b/lang/src/son.rs @@ -2971,6 +2971,7 @@ impl<'a> Codegen<'a> { } Expr::Block { stmts, .. } => { let base = self.ci.scope.vars.len(); + let aclass_base = self.ci.scope.aclasses.len(); let mut ret = Some(Value::VOID); for stmt in stmts { @@ -2986,6 +2987,10 @@ impl<'a> Codegen<'a> { var.remove(&mut self.ci.nodes); } + for aclass in self.ci.scope.aclasses.drain(aclass_base..) { + aclass.remove(&mut self.ci.nodes); + } + ret } Expr::Loop { body, .. } => { @@ -3481,6 +3486,10 @@ impl<'a> Codegen<'a> { .vars .drain(loob.scope.vars.len()..) .for_each(|v| v.remove(&mut self.ci.nodes)); + loob.ctrl_scope[id] + .aclasses + .drain(loob.scope.aclasses.len()..) + .for_each(|v| v.remove(&mut self.ci.nodes)); } None