fn analyze_reachability(&self, flow: &FlowAnalysis, root: Index) -> HashSet<Index> {
        let mut stack = vec![root];
        let mut reachable = HashSet::new();

        while let Some(node_index) = stack.pop() {
            if !reachable.insert(node_index) {
                continue;
            }

            let node = &self[node_index];

            match &node.expr {
                Ir::Loop(child) | Ir::Call(child) => {
                    stack.extend(child);

                    if flow.is_passable(node_index) {
                        stack.extend(node.next);
                    }
                }
                Ir::Split { tx_only, rx_only } => {
                    stack.extend(tx_only.iter().chain(rx_only));

                    if flow.is_passable(node_index) {
                        stack.extend(node.next);
                    }
                }
                Ir::Choose(choices) | Ir::Offer(choices) => {
                    stack.extend(choices.iter().filter_map(Option::as_ref));

                    assert!(node.next.is_none(), "at this point in the compiler, all continuations of \
                        `Choose` and `Offer` nodes should have been eliminated by the resolve_scopes pass.");
                }
                Ir::Send(_)
                | Ir::Recv(_)
                | Ir::Type(_)
                | Ir::Break(_)
                | Ir::Continue(_)
                | Ir::Error => {
                    if flow.is_passable(node_index) {
                        stack.extend(node.next);
                    }
                }
            }
        }

        reachable
    }
/// Compute the set of nodes which are reachable from the root of the [`Cfg`], using the results
/// of the [`FlowAnalysis`] to determine whether nodes can be passed through.
Compute the set of nodes which are reachable from the root of the [`Cfg`], using the results
of the [`FlowAnalysis`] to determine whether nodes can be passed through.
Compute the set of nodes which are reachable from the root of the [ ` Cfg ` ] using the results of the [ ` FlowAnalysis ` ] to determine whether nodes can be passed through .
fn analyze_reachability(&self, flow: &FlowAnalysis, root: Index) -> HashSet<Index> {
        let mut stack = vec![root];
        let mut reachable = HashSet::new();
        while let Some(node_index) = stack.pop() {
            if !reachable.insert(node_index) {
                continue;
            }
            let node = &self[node_index];
            match &node.expr {
                Ir::Loop(child) | Ir::Call(child) => {
                    stack.extend(child);
                    if flow.is_passable(node_index) {
                        stack.extend(node.next);
                    }
                }
                Ir::Split { tx_only, rx_only } => {
                    stack.extend(tx_only.iter().chain(rx_only));
                    if flow.is_passable(node_index) {
                        stack.extend(node.next);
                    }
                }
                Ir::Choose(choices) | Ir::Offer(choices) => {
                    stack.extend(choices.iter().filter_map(Option::as_ref));
                    assert!(node.next.is_none(), "at this point in the compiler, all continuations of \
                        `Choose` and `Offer` nodes should have been eliminated by the resolve_scopes pass.");
                }
                Ir::Send(_)
                | Ir::Recv(_)
                | Ir::Type(_)
                | Ir::Break(_)
                | Ir::Continue(_)
                | Ir::Error => {
                    if flow.is_passable(node_index) {
                        stack.extend(node.next);
                    }
                }
            }
        }
        reachable
    }
fn analyze_reachability ( & self , flow : & FlowAnalysis , root : Index ) -> HashSet < Index > { let mut stack = vec ! [ root ] ; let mut reachable = HashSet :: new ( ) ; while let Some ( node_index ) = stack . pop ( ) { if ! reachable . insert ( node_index ) { continue ; } let node = & self [ node_index ] ; match & node . expr { Ir :: Loop ( child ) | Ir :: Call ( child ) => { stack . extend ( child ) ; if flow . is_passable ( node_index ) { stack . extend ( node . next ) ; } } Ir :: Split { tx_only , rx_only } => { stack . extend ( tx_only . iter ( ) . chain ( rx_only ) ) ; if flow . is_passable ( node_index ) { stack . extend ( node . next ) ; } } Ir :: Choose ( choices ) | Ir :: Offer ( choices ) => { stack . extend ( choices . iter ( ) . filter_map ( Option :: as_ref ) ) ; assert ! ( node next is_none ( ) " \
 " ) ; } Ir :: Send ( _ ) | Ir :: Recv ( _ ) | Ir :: Type ( _ ) | Ir :: Break ( _ ) | Ir :: Continue ( _ ) | Ir :: Error => { if flow . is_passable ( node_index ) { stack . extend ( node . next ) ; } } } } reachable }
Compute the set of nodes which are reachable from the root of the [`Cfg`], using the results
of the [`FlowAnalysis`] to determine whether nodes can be passed through.
Compute the set of nodes which are reachable from the root of the [ ` Cfg ` ] using the results of the [ ` FlowAnalysis ` ] to determine whether nodes can be passed through .
&self
flow
&FlowAnalysis
root
Index