wip: bubbling reserves nodes

This commit is contained in:
Jonathan Kelley committed 2021-11-11 21:50:08 -05:00
1 parent a21020ea57
commit b6262edd53
6 files changed
+135 -137

No files matched your search

+2 -1
View File
@@ -244,7 +244,8 @@ impl<'bump> DiffState<'bump> {
let (old, new) = (self.scopes.wip_head(id), self.scopes.fin_head(id));
self.stack.push(DiffInstruction::Diff { old, new });
self.stack.scope_stack.push(*id);
self.stack.push_nodes_created(0);
let scope = self.scopes.get_scope(id).unwrap();
self.stack.element_stack.push(scope.container);
self.work(|| false);
}
-6
View File
@@ -219,9 +219,6 @@ fn round_to_words(len: usize) -> usize {
fn it_works() {
let bump = bumpalo::Bump::new();
#[cfg(not(miri))]
simple_logger::init().unwrap();
let factory = NodeFactory { bump: &bump };
let caller = NodeFactory::annotate_lazy(|f| {
@@ -240,9 +237,6 @@ fn it_drops() {
use std::rc::Rc;
let bump = bumpalo::Bump::new();
#[cfg(not(miri))]
simple_logger::init().unwrap();
let factory = NodeFactory { bump: &bump };
struct DropInner {
+6 -2
View File
@@ -446,10 +446,10 @@ impl VirtualDom {
self.scopes.wip_head(&scopeid),
self.scopes.fin_head(&scopeid),
);
diff_state.stack.push(DiffInstruction::Diff { new, old });
diff_state.stack.scope_stack.push(scopeid);
let scope = scopes.get_scope(&scopeid).unwrap();
diff_state.stack.element_stack.push(scope.container);
diff_state.stack.push(DiffInstruction::Diff { new, old });
}
}
}
@@ -576,6 +576,7 @@ impl VirtualDom {
pub fn diff_vnodes<'a>(&'a self, old: &'a VNode<'a>, new: &'a VNode<'a>) -> Mutations<'a> {
let mut machine = DiffState::new(&self.scopes);
machine.stack.push(DiffInstruction::Diff { new, old });
machine.stack.element_stack.push(ElementId(0));
machine.stack.scope_stack.push(self.base_scope);
machine.work(|| false);
machine.mutations
@@ -587,6 +588,7 @@ impl VirtualDom {
pub fn create_vnodes<'a>(&'a self, left: Option<LazyNodes<'a, '_>>) -> Mutations<'a> {
let nodes = self.render_vnodes(left);
let mut machine = DiffState::new(&self.scopes);
machine.stack.element_stack.push(ElementId(0));
machine.stack.create_node(nodes, MountType::Append);
machine.work(|| false);
machine.mutations
@@ -604,11 +606,13 @@ impl VirtualDom {
let mut create = DiffState::new(&self.scopes);
create.stack.scope_stack.push(self.base_scope);
create.stack.element_stack.push(ElementId(0));
create.stack.create_node(old, MountType::Append);
create.work(|| false);
let mut edit = DiffState::new(&self.scopes);
create.stack.scope_stack.push(self.base_scope);
edit.stack.scope_stack.push(self.base_scope);
edit.stack.element_stack.push(ElementId(0));
edit.stack.push(DiffInstruction::Diff { old, new });
edit.work(&mut || false);