missing scoping

This commit is contained in:
Jakub Doka 2024-10-28 17:22:18 +01:00
parent be2d38a6d2
commit 33d78fbc52
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143

View file

@ -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