repr tree: create new VecBuffer in case attach_to() is called on Vec<EditTree>
This commit is contained in:
parent
508e716a6a
commit
ffeb4b8e73
1 changed files with 15 additions and 1 deletions
|
@ -186,10 +186,24 @@ 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 {
|
||||||
|
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 {
|
} else {
|
||||||
self.leaf = Some(ReprLeaf::from_view(src_port));
|
self.leaf = Some(ReprLeaf::from_view(src_port));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn detach(&mut self, ctx: &Arc<RwLock<Context>>) {
|
pub fn detach(&mut self, ctx: &Arc<RwLock<Context>>) {
|
||||||
if let Some(leaf) = self.leaf.as_mut() {
|
if let Some(leaf) = self.leaf.as_mut() {
|
||||||
|
|
Loading…
Reference in a new issue