swc_ecma_transforms_react/jsx/
static_check.rs1use swc_ecma_ast::*;
2
3pub(super) fn should_use_create_element(attrs: &[JSXAttrOrSpread]) -> bool {
9 let mut seen_prop_spread = false;
10 for attr in attrs {
11 if seen_prop_spread
12 && match attr {
13 JSXAttrOrSpread::JSXAttr(attr) => match &attr.name {
14 JSXAttrName::Ident(i) => i.sym == "key",
15 JSXAttrName::JSXNamespacedName(_) => false,
16 #[cfg(swc_ast_unknown)]
17 _ => panic!("unable to access unknown nodes"),
18 },
19 _ => false,
20 }
21 {
22 return true;
23 }
24
25 if let JSXAttrOrSpread::SpreadElement(_) = attr {
26 seen_prop_spread = true;
27 }
28 }
29
30 false
31}