Add a ton of comments to rsx/hotreload, add snapshot testing, refactor a bit to simplify the crate (#2130)

Merge dynamic context and dynamic mapping, clean up the rsx hotreload logic, and add location data to the Rsx objects
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2024-03-24 13:31:26 -07:00
1 parent b19a546c0a
commit eb79e61642
31 files changed
+1413 -811

No files matched your search

+21
View File
@@ -8,7 +8,10 @@ use syn::{parse_quote, spanned::Spanned, Expr, ExprIf, Ident, LitStr};
#[derive(PartialEq, Eq, Clone, Debug, Hash)]
pub enum AttributeType {
/// An attribute that is known
Named(ElementAttrNamed),
/// An attribute that's being spread in via the `..` syntax
Spread(Expr),
}
@@ -68,6 +71,24 @@ impl AttributeType {
}
}
}
pub fn as_static_str_literal(&self) -> Option<(&ElementAttrName, &IfmtInput)> {
match self {
AttributeType::Named(ElementAttrNamed {
attr:
ElementAttr {
value: ElementAttrValue::AttrLiteral(value),
name,
},
..
}) if value.is_static() => Some((name, value)),
_ => None,
}
}
pub fn is_static_str_literal(&self) -> bool {
self.as_static_str_literal().is_some()
}
}
#[derive(Clone, Debug)]