wip: debugging

This commit is contained in:
Jonathan Kelley committed 2022-01-30 14:08:03 -05:00
1 parent 875977f5a6
commit 3edf3e367f
11 files changed
+367 -128

No files matched your search

+13 -5
View File
@@ -4,7 +4,7 @@
//! cheap and *very* fast to construct - building a full tree should be quick.
use crate::{
innerlude::{Element, Properties, Scope, ScopeId, ScopeState},
innerlude::{Element, FcSlot, Properties, Scope, ScopeId, ScopeState},
lazynodes::LazyNodes,
AnyEvent, Component,
};
@@ -177,11 +177,19 @@ impl Debug for VNode<'_> {
.field("children", &el.children)
.finish(),
VNode::Text(t) => write!(s, "VNode::VText {{ text: {} }}", t.text),
VNode::Placeholder(_) => write!(s, "VNode::VPlaceholder"),
VNode::Placeholder(t) => write!(s, "VNode::VPlaceholder {{ id: {:?} }}", t.id),
VNode::Fragment(frag) => {
write!(s, "VNode::VFragment {{ children: {:?} }}", frag.children)
}
VNode::Component(comp) => write!(s, "VNode::VComponent {{ fc: {:?}}}", comp.user_fc),
VNode::Component(comp) => {
s.debug_struct("VNode::VComponent")
.field("fnptr", &comp.user_fc)
.field("key", &comp.key)
.field("scope", &comp.scope)
.field("originator", &comp.originator)
.finish()
//write!(s, "VNode::VComponent {{ fc: {:?}}}", comp.user_fc)
}
}
}
}
@@ -384,7 +392,7 @@ pub struct VComponent<'src> {
pub originator: ScopeId,
pub scope: Cell<Option<ScopeId>>,
pub can_memoize: bool,
pub user_fc: *const (),
pub user_fc: FcSlot,
pub props: RefCell<Option<Box<dyn AnyProps + 'src>>>,
}
@@ -557,7 +565,7 @@ impl<'a> NodeFactory<'a> {
key: key.map(|f| self.raw_text(f).0),
scope: Default::default(),
can_memoize: P::IS_STATIC,
user_fc: component as *const (),
user_fc: component as *mut std::os::raw::c_void,
originator: self.scope.scope_id(),
props: RefCell::new(Some(Box::new(VComponentProps {
// local_props: RefCell::new(Some(props)),