1
Fork 0

Only initialize what is used

This commit is contained in:
Dániel Buga 2021-01-17 20:20:16 +01:00
parent f7534b566c
commit 3c1d792f49
2 changed files with 6 additions and 3 deletions

View file

@ -85,6 +85,10 @@ pub struct Dominators<N: Idx> {
}
impl<Node: Idx> Dominators<Node> {
pub fn dummy() -> Self {
Self { post_order_rank: IndexVec::new(), immediate_dominators: IndexVec::new() }
}
pub fn is_reachable(&self, node: Node) -> bool {
self.immediate_dominators[node].is_some()
}