Skip to content

Commit

Permalink
Remove add_node_before(?!)
Browse files Browse the repository at this point in the history
  • Loading branch information
acl-cqc committed Oct 24, 2023
1 parent 3998b8e commit 78ddb4a
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/hugr/hugrmut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,6 @@ pub trait HugrMut: HugrMutInternals {
self.hugr_mut().add_op_before(sibling, op)
}

/// A generalisation of [`HugrMut::add_op_before`], needed temporarily until
/// add_op type methods all default to creating nodes with open extensions.
/// See issue #424
#[inline]
fn add_node_before(&mut self, sibling: Node, nodetype: NodeType) -> Result<Node, HugrError> {
self.valid_non_root(sibling)?;
self.hugr_mut().add_node_before(sibling, nodetype)
}

/// Add a node to the graph as the next sibling of another node.
///
/// The sibling node's parent becomes the new node's parent.
Expand Down Expand Up @@ -215,11 +206,7 @@ impl<T: RootTagged<RootHandle = Node> + AsMut<Hugr>> HugrMut for T {
}

fn add_op_before(&mut self, sibling: Node, op: impl Into<OpType>) -> Result<Node, HugrError> {
self.add_node_before(sibling, NodeType::open_extensions(op))
}

fn add_node_before(&mut self, sibling: Node, nodetype: NodeType) -> Result<Node, HugrError> {
let node = self.as_mut().add_node(nodetype);
let node = self.as_mut().add_node(NodeType::open_extensions(op));
self.as_mut()
.hierarchy
.insert_before(node.index, sibling.index)?;
Expand Down

0 comments on commit 78ddb4a

Please sign in to comment.