This commit is contained in:
Folkert 2022-07-23 14:25:38 +02:00
parent 6c0217c6f6
commit 954a4fbe32
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
8 changed files with 146 additions and 10 deletions

View file

@ -111,9 +111,11 @@ pub fn occurring_variables(stmt: &Stmt<'_>) -> (MutSet<Symbol>, MutSet<Symbol>)
Expect {
condition,
remainder,
lookups,
..
} => {
result.insert(*condition);
result.extend(lookups.iter().copied());
stack.push(remainder);
}
@ -1180,7 +1182,7 @@ impl<'a> Context<'a> {
lookups,
layouts,
} => {
let (b, b_live_vars) = self.visit_stmt(codegen, remainder);
let (b, mut b_live_vars) = self.visit_stmt(codegen, remainder);
let expect = self.arena.alloc(Stmt::Expect {
condition: *condition,
@ -1190,6 +1192,10 @@ impl<'a> Context<'a> {
remainder: b,
});
let expect = self.add_inc_before_consume_all(lookups, expect, &b_live_vars);
b_live_vars.extend(lookups.iter().copied());
(expect, b_live_vars)
}
@ -1299,9 +1305,11 @@ pub fn collect_stmt(
Expect {
condition,
remainder,
lookups,
..
} => {
vars.insert(*condition);
vars.extend(lookups.iter().copied());
collect_stmt(remainder, jp_live_vars, vars)
}