mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
Implement mono of crash
This commit is contained in:
parent
72ff0cc800
commit
c7ef1668d4
10 changed files with 84 additions and 7 deletions
|
@ -158,6 +158,10 @@ pub fn occurring_variables(stmt: &Stmt<'_>) -> (MutSet<Symbol>, MutSet<Symbol>)
|
|||
stack.push(default_branch.1);
|
||||
}
|
||||
|
||||
Crash(sym, _) => {
|
||||
result.insert(*sym);
|
||||
}
|
||||
|
||||
RuntimeError(_) => {}
|
||||
}
|
||||
}
|
||||
|
@ -1240,6 +1244,19 @@ impl<'a, 'i> Context<'a, 'i> {
|
|||
(expect, b_live_vars)
|
||||
}
|
||||
|
||||
Crash(x, _) => {
|
||||
let info = self.get_var_info(*x);
|
||||
|
||||
let mut live_vars = MutSet::default();
|
||||
live_vars.insert(*x);
|
||||
|
||||
if info.reference && !info.consume {
|
||||
(self.add_inc(*x, 1, stmt), live_vars)
|
||||
} else {
|
||||
(stmt, live_vars)
|
||||
}
|
||||
}
|
||||
|
||||
RuntimeError(_) | Refcounting(_, _) => (stmt, MutSet::default()),
|
||||
}
|
||||
}
|
||||
|
@ -1411,6 +1428,11 @@ pub fn collect_stmt(
|
|||
vars
|
||||
}
|
||||
|
||||
Crash(m, _) => {
|
||||
vars.insert(*m);
|
||||
vars
|
||||
}
|
||||
|
||||
RuntimeError(_) => vars,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue