repr tree: create new VecBuffer in case attach_to() is called on Vec<EditTree>

This commit is contained in:
Michael Sippel 2024-08-06 15:40:05 +02:00
parent 508e716a6a
commit ffeb4b8e73
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -187,7 +187,21 @@ impl ReprTree {
if let Some(leaf) = self.leaf.as_mut() { if let Some(leaf) = self.leaf.as_mut() {
leaf.attach_to(src_port); leaf.attach_to(src_port);
} else { } else {
self.leaf = Some(ReprLeaf::from_view(src_port)); if self.type_tag == TypeTerm::App(vec![
TypeTerm::TypeID(TypeID::Fun(11)),
TypeTerm::TypeID(TypeID::Fun(2))
]) {
let mut leaf = ReprLeaf::from_vec_buffer(
VecBuffer::<
Arc<RwLock<crate::edit_tree::EditTree>>
>::new()
);
leaf.attach_to(src_port);
self.leaf = Some(leaf);
} else {
self.leaf = Some(ReprLeaf::from_view(src_port));
}
} }
} }