mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-02 05:48:17 +00:00
WIP
This commit is contained in:
parent
6c0217c6f6
commit
954a4fbe32
8 changed files with 146 additions and 10 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue