More properties upgrade fixes. Switch still broken.

This commit is contained in:
Samuel Guerra 2021-01-04 22:33:25 -03:00
parent 4d05fc1995
commit 1c8e0cb767
2 changed files with 16 additions and 22 deletions

View File

@ -25,6 +25,9 @@ use super::*;
/// ```
#[macro_export]
macro_rules! switch_var {
($index: expr $(, $v0: expr)? $(,)?) => {
compile_error!{"switch_var requires at least 2 variables"}
};
($index: expr, $v0: expr, $v1: expr) => {
$crate::var::RcSwitch2Var::new($index, ($v0, $v1))
};

View File

@ -1073,19 +1073,16 @@ mod output {
#[cfg(debug_assertions)]
if self.debug_enabled {
let crate_ = crate_core();
let p = &self.properties;
let p_names = p.iter().map(|p| p.to_string());
let p_locs = p.iter().map(|p| quote_spanned!(p.span()=> source_location!()));
let p_locs = p.iter().map(|p| quote_spanned!(p.span()=> #crate_::debug::source_location!()));
let p_assig = &self.properties_user_assigned;
let args = args.clone();
let crate_ = crate_core();
tokens.extend(quote! {
let mut debug_captured_new_child = {
use #crate_::debug::*;
vec![#(
#name::properties::#p::captured_debug(&#args, #p_names, #p_locs, #p_assig),
)*]
vec![#(#name::properties::#p::captured_debug(&#args, #p_names, #p_locs, #p_assig)),*]
};
});
}
@ -1214,26 +1211,20 @@ mod output {
let name_str = name.to_string();
let p = &self.properties;
let p_names = p.iter().map(|p| p.to_string());
let p_locs = p.iter().map(|p| quote_spanned!(p.span()=> source_location!()));
let p_locs = p.iter().map(|p| quote_spanned!(p.span()=> #crate_::debug::source_location!()));
let p_assig = &self.properties_user_assigned;
let args = args.clone();
tokens.extend(quote! {
let node = {
use #crate_::debug::*;
WidgetInstanceInfoNode::new_v1(
#crate_::UiNode::boxed(node),
#name_str,
#name::decl_location(),
source_location!(),
debug_captured_new_child,
vec![#(
#name::properties::#p::captured_debug(&#args, #p_names, #p_locs, #p_assig),
),*],
debug_whens
)
};
let node = #crate_::debug::WidgetInstanceInfoNode::new_v1(
#crate_::UiNode::boxed(node),
#name_str,
#name::decl_location(),
#crate_::debug::source_location!(),
debug_captured_new_child,
vec![#(#name::properties::#p::captured_debug(&#args, #p_names, #p_locs, #p_assig)),*],
debug_whens
);
});
}