Implement mono of crash

This commit is contained in:
Ayaz Hafiz 2022-11-22 15:44:06 -06:00
parent 72ff0cc800
commit c7ef1668d4
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
10 changed files with 84 additions and 7 deletions

View file

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