Clean up merge conflicts

This commit is contained in:
Jonathan Kelley committed 2024-01-08 19:31:57 -08:00
1 parent 44a27bf8a3
commit 23f7a37b06
3 files changed
+16 -53

No files matched your search

+3 -3
View File
@@ -2,7 +2,7 @@
use dioxus::prelude::Props; use dioxus::prelude::Props;
use dioxus_core::{MountedAttribute, *}; use dioxus_core::{MountedAttribute, *};
use std::{cfg, collections::HashSet}; use std::{cell::Cell, cfg, collections::HashSet};
fn random_ns() -> Option<&'static str> { fn random_ns() -> Option<&'static str> {
let namespace = rand::random::<u8>() % 2; let namespace = rand::random::<u8>() % 2;
@@ -177,7 +177,7 @@ fn create_random_dynamic_node(cx: &ScopeState, depth: usize) -> DynamicNode {
// Template { // Template {
// ======= // =======
cx.vnode( cx.vnode(
None, None.into(),
Default::default(), Default::default(),
Cell::new(Template { Cell::new(Template {
// >>>>>>> 9fe172e9 (Fix leak in render macro) // >>>>>>> 9fe172e9 (Fix leak in render macro)
@@ -293,7 +293,7 @@ fn create_random_element(cx: Scope<DepthProps>) -> Element {
// ======= // =======
// println!("{template:#?}"); // println!("{template:#?}");
let node = cx.vnode( let node = cx.vnode(
None, None.into(),
None, None,
Cell::new(template), Cell::new(template),
bumpalo::collections::Vec::new_in(cx.bump()).into(), bumpalo::collections::Vec::new_in(cx.bump()).into(),
+12 -49
View File
@@ -1,3 +1,5 @@
use std::cell::Cell;
use dioxus::prelude::Props; use dioxus::prelude::Props;
use dioxus_core::*; use dioxus_core::*;
use dioxus_native_core::prelude::*; use dioxus_native_core::prelude::*;
@@ -178,27 +180,16 @@ fn create_random_dynamic_node(cx: &ScopeState, depth: usize) -> DynamicNode {
match rand::random::<u8>() % range { match rand::random::<u8>() % range {
0 => DynamicNode::Placeholder(Default::default()), 0 => DynamicNode::Placeholder(Default::default()),
1 => cx.make_node((0..(rand::random::<u8>() % 5)).map(|_| { 1 => cx.make_node((0..(rand::random::<u8>() % 5)).map(|_| {
// <<<<<<< HEAD
// VNode::new(
// None,
// Template {
// =======
cx.vnode( cx.vnode(
None, None.into(),
Default::default(), Default::default(),
Cell::new(Template { Cell::new(Template {
// >>>>>>> 9fe172e9 (Fix leak in render macro)
name: concat!(file!(), ":", line!(), ":", column!(), ":0"), name: concat!(file!(), ":", line!(), ":", column!(), ":0"),
roots: &[TemplateNode::Dynamic { id: 0 }], roots: &[TemplateNode::Dynamic { id: 0 }],
node_paths: &[&[0]], node_paths: &[&[0]],
attr_paths: &[], attr_paths: &[],
// <<<<<<< HEAD
// },
// dioxus::core::exports::bumpalo::collections::Vec::new_in(cx.bump()),
// =======
}), }),
dioxus::core::exports::bumpalo::collections::Vec::new_in(cx.bump()).into(), dioxus::core::exports::bumpalo::collections::Vec::new_in(cx.bump()).into(),
// >>>>>>> 9fe172e9 (Fix leak in render macro)
cx.bump().alloc([cx.component( cx.bump().alloc([cx.component(
create_random_element, create_random_element,
DepthProps { depth, root: false }, DepthProps { depth, root: false },
@@ -216,20 +207,6 @@ fn create_random_dynamic_node(cx: &ScopeState, depth: usize) -> DynamicNode {
} }
} }
fn create_random_dynamic_mounted_attr(cx: &ScopeState) -> MountedAttribute {
match rand::random::<u8>() % 2 {
0 => MountedAttribute::from(
&*cx.bump().alloc(
(0..(rand::random::<u8>() % 3) as usize)
.map(|_| create_random_dynamic_attr(cx))
.collect::<Vec<_>>(),
),
),
1 => MountedAttribute::from(create_random_dynamic_attr(cx)),
_ => unreachable!(),
}
}
fn create_random_dynamic_attr(cx: &ScopeState) -> Attribute { fn create_random_dynamic_attr(cx: &ScopeState) -> Attribute {
let value = match rand::random::<u8>() % 6 { let value = match rand::random::<u8>() % 6 {
0 => AttributeValue::Text(Box::leak( 0 => AttributeValue::Text(Box::leak(
@@ -242,6 +219,7 @@ fn create_random_dynamic_attr(cx: &ScopeState) -> Attribute {
5 => AttributeValue::None, 5 => AttributeValue::None,
_ => unreachable!(), _ => unreachable!(),
}; };
Attribute::new( Attribute::new(
Box::leak(format!("attr{}", rand::random::<usize>()).into_boxed_str()), Box::leak(format!("attr{}", rand::random::<usize>()).into_boxed_str()),
value, value,
@@ -278,18 +256,11 @@ fn create_random_element(cx: Scope<DepthProps>) -> Element {
.into_boxed_str(), .into_boxed_str(),
)); ));
println!("{template:#?}"); println!("{template:#?}");
// <<<<<<< HEAD
// let node = VNode::new(
// None,
// template,
// dioxus::core::exports::bumpalo::collections::Vec::new_in(cx.bump()),
// =======
let node = cx.vnode( let node = cx.vnode(
None, None.into(),
None, None,
Cell::new(template), Cell::new(template),
dioxus::core::exports::bumpalo::collections::Vec::new_in(cx.bump()).into(), dioxus::core::exports::bumpalo::collections::Vec::new_in(cx.bump()).into(),
// >>>>>>> 9fe172e9 (Fix leak in render macro)
{ {
let dynamic_nodes: Vec<_> = dynamic_node_types let dynamic_nodes: Vec<_> = dynamic_node_types
.iter() .iter()
@@ -304,21 +275,13 @@ fn create_random_element(cx: Scope<DepthProps>) -> Element {
.collect(); .collect();
cx.bump().alloc(dynamic_nodes) cx.bump().alloc(dynamic_nodes)
}, },
// <<<<<<< HEAD cx.bump()
// cx.bump() .alloc(
// .alloc( (0..template.attr_paths.len())
// (0..template.attr_paths.len()) .map(|_| create_random_dynamic_attr(cx).into())
// .map(|_| create_random_dynamic_mounted_attr(cx)) .collect::<Vec<_>>(),
// .collect::<Vec<_>>(), )
// ) .as_slice(),
// .as_slice(),
// =======
cx.bump().alloc(
(0..template.attr_paths.len())
.map(|_| create_random_dynamic_attr(cx))
.collect::<Vec<_>>(),
),
// >>>>>>> 9fe172e9 (Fix leak in render macro)
); );
Some(node) Some(node)
} }
+1 -1
View File
@@ -261,7 +261,7 @@ impl<'a> ToTokens for TemplateRenderer<'a> {
// dioxus::core::exports::bumpalo::collections::Vec::with_capacity_in(#root_count, __cx.bump()), // dioxus::core::exports::bumpalo::collections::Vec::with_capacity_in(#root_count, __cx.bump()),
// ======= // =======
__cx.vnode( __cx.vnode(
None, None.into(),
#key_tokens, #key_tokens,
std::cell::Cell::new(TEMPLATE), std::cell::Cell::new(TEMPLATE),
dioxus::core::exports::bumpalo::collections::Vec::with_capacity_in(#root_count, __cx.bump()).into(), dioxus::core::exports::bumpalo::collections::Vec::with_capacity_in(#root_count, __cx.bump()).into(),