Skip to content

Commit

Permalink
feat: Default more builder methods to open extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
croyzor committed Sep 4, 2023
1 parent 38a2eed commit 9dfc995
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
6 changes: 2 additions & 4 deletions src/builder/build_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,7 @@ pub trait Dataflow: Container {

let (cfg_node, _) = add_node_with_wires(
self,
// TODO: Make input extensions a parameter
NodeType::pure(ops::CFG {
NodeType::open_extensions(ops::CFG {
inputs: inputs.clone(),
outputs: output_types.clone(),
}),
Expand Down Expand Up @@ -606,8 +605,7 @@ fn add_op_with_wires<T: Dataflow + ?Sized>(
optype: impl Into<OpType>,
inputs: Vec<Wire>,
) -> Result<(Node, usize), BuildError> {
// TODO: Make this NodeType::open_extensions
add_node_with_wires(data_builder, NodeType::pure(optype), inputs)
add_node_with_wires(data_builder, NodeType::open_extensions(optype), inputs)
}

fn add_node_with_wires<T: Dataflow + ?Sized>(
Expand Down
4 changes: 2 additions & 2 deletions src/builder/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl CFGBuilder<Hugr> {
};

// TODO: Allow input extensions to be specified
let base = Hugr::new(NodeType::pure(cfg_op));
let base = Hugr::new(NodeType::open_extensions(cfg_op));
let cfg_node = base.root();
CFGBuilder::create(base, cfg_node, input, output)
}
Expand Down Expand Up @@ -280,7 +280,7 @@ impl BlockBuilder<Hugr> {
};

// TODO: Allow input extensions to be specified
let base = Hugr::new(NodeType::pure(op));
let base = Hugr::new(NodeType::open_extensions(op));
let root = base.root();
Self::create(base, root, predicate_variants, other_outputs, inputs)
}
Expand Down
4 changes: 2 additions & 2 deletions src/builder/conditional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ impl ConditionalBuilder<Hugr> {
extension_delta,
};
// TODO: Allow input extensions to be specified
let base = Hugr::new(NodeType::pure(op));
let base = Hugr::new(NodeType::open_extensions(op));
let conditional_node = base.root();

Ok(ConditionalBuilder {
Expand All @@ -197,7 +197,7 @@ impl CaseBuilder<Hugr> {
signature: signature.clone(),
};
// TODO: Allow input extensions to be specified
let base = Hugr::new(NodeType::pure(op));
let base = Hugr::new(NodeType::open_extensions(op));
let root = base.root();
let dfg_builder = DFGBuilder::create_with_io(base, root, signature, None)?;

Expand Down
2 changes: 1 addition & 1 deletion src/builder/tail_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl TailLoopBuilder<Hugr> {
rest: inputs_outputs.into(),
};
// TODO: Allow input extensions to be specified
let base = Hugr::new(NodeType::pure(tail_loop.clone()));
let base = Hugr::new(NodeType::open_extensions(tail_loop.clone()));
let root = base.root();
Self::create_with_io(base, root, &tail_loop)
}
Expand Down

0 comments on commit 9dfc995

Please sign in to comment.