mbe: Return Bindings from build_inner

This commit is contained in:
Jonas Platte 2022-09-14 23:22:38 +02:00
parent dbb8fedf8b
commit 5e2f9e322f
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -203,12 +203,11 @@ fn push_default(&mut self, idx: &mut BindingsIdx) {
}
fn build(self, idx: &BindingsIdx) -> Bindings {
let mut bindings = Bindings::default();
self.build_inner(&mut bindings, &self.nodes[idx.0]);
bindings
self.build_inner(&self.nodes[idx.0])
}
fn build_inner(&self, bindings: &mut Bindings, link_nodes: &[LinkNode<Rc<BindingKind>>]) {
fn build_inner(&self, link_nodes: &[LinkNode<Rc<BindingKind>>]) -> Bindings {
let mut bindings = Bindings::default();
let mut nodes = Vec::new();
self.collect_nodes(link_nodes, &mut nodes);
@ -246,6 +245,8 @@ fn build_inner(&self, bindings: &mut Bindings, link_nodes: &[LinkNode<Rc<Binding
}
}
}
bindings
}
fn collect_nested_ref<'a>(
@ -270,8 +271,7 @@ fn collect_nested(&self, idx: usize, nested_idx: usize, nested: &mut Vec<Binding
nested_refs.push(last);
nested_refs.into_iter().for_each(|iter| {
let mut child_bindings = Bindings::default();
self.build_inner(&mut child_bindings, iter);
let child_bindings = self.build_inner(iter);
nested.push(child_bindings)
})
}