Skip to content

Commit

Permalink
Add pub type DivergeCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
acl-cqc committed Jan 29, 2025
1 parent cb7bf75 commit 60a5823
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hugr-passes/src/dead_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::validation::{ValidatePassError, ValidationLevel};
#[derive(Clone, Default)]
pub struct DeadCodeElimPass {
entry_points: Vec<Node>,
diverge_callback: Option<Arc<dyn Fn(&Hugr, Node) -> NodeDivergence>>,
diverge_callback: Option<Arc<DivergeCallback>>,
validation: ValidationLevel,
}

Expand All @@ -38,6 +38,8 @@ impl Debug for DeadCodeElimPass {
}
}

pub type DivergeCallback = dyn Fn(&Hugr, Node) -> NodeDivergence;

pub enum NodeDivergence {
#[allow(unused)]
MustKeep,
Expand Down Expand Up @@ -67,7 +69,7 @@ impl DeadCodeElimPass {
/// [Call]: hugr_core::ops::Call
/// [CFG]: hugr_core::ops::CFG
/// [TailLoop]: hugr_core::ops::TailLoop
pub fn set_diverge_callback(mut self, cb: Arc<dyn Fn(&Hugr, Node) -> NodeDivergence>) -> Self {
pub fn set_diverge_callback(mut self, cb: Arc<DivergeCallback>) -> Self {
self.diverge_callback = Some(cb);
self
}
Expand Down

0 comments on commit 60a5823

Please sign in to comment.