From a8672e4eeef1a7886ac33aa9f154dbcbcffc70bc Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Fri, 1 Nov 2024 02:06:52 -0700 Subject: [PATCH] typegen: check only for suffix matches on cname --- typegen/src/resolver.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/typegen/src/resolver.rs b/typegen/src/resolver.rs index 5d8bc9f..e49408a 100644 --- a/typegen/src/resolver.rs +++ b/typegen/src/resolver.rs @@ -100,16 +100,17 @@ pub fn resolve_types( ctype = &ctype[0..ctype.len() - 1]; } + // note: suffix is checked instead of == due to Q_PROPERTY using fully qualified names let qtype = typespec .typemap .iter() - .find(|type_| &type_.cname == ctype) + .find(|type_| !type_.cname.is_empty() && ctype.ends_with(&type_.cname)) .map(|type_| (&type_.module, &type_.name)) .or_else(|| { typespec .enums .iter() - .find(|type_| type_.cname.as_ref().map(|v| v as &str) == Some(ctype)) + .find(|type_| type_.cname.as_ref().map(|v| v as &str).map(|v| !v.is_empty() && ctype.ends_with(v) ).unwrap_or(false)) .map(|type_| (&type_.module, &type_.name)) });