Skip to content

Commit

Permalink
feat: Open up extensions in some builder methods
Browse files Browse the repository at this point in the history
  • Loading branch information
croyzor committed Aug 31, 2023
1 parent ba306fb commit 60f4292
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/builder/build_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,7 @@ pub trait Dataflow: Container {
signature: signature.clone(),
};
let nodetype = match &input_extensions {
// TODO: Make this NodeType::open_extensions
None => NodeType::pure(op),
None => NodeType::open_extensions(op),
Some(rs) => NodeType::new(op, rs.clone()),
};
let (dfg_n, _) = add_node_with_wires(self, nodetype, input_wires.into_iter().collect())?;
Expand Down
5 changes: 2 additions & 3 deletions src/builder/dataflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,15 @@ impl<T: AsMut<Hugr> + AsRef<Hugr>> DFGBuilder<T> {
base.as_mut().add_node_with_parent(
parent,
match &input_extensions {
// TODO: Make this NodeType::open_extensions
None => NodeType::pure(input),
None => NodeType::open_extensions(input),
Some(rs) => NodeType::new(input, rs.clone()),
},
)?;
base.as_mut().add_node_with_parent(
parent,
match input_extensions.map(|inp| inp.union(&signature.extension_reqs)) {
// TODO: Make this NodeType::open_extensions
None => NodeType::new(output, signature.extension_reqs),
None => NodeType::open_extensions(output),
Some(rs) => NodeType::new(output, rs),
},
)?;
Expand Down

0 comments on commit 60f4292

Please sign in to comment.