2
1
Fork 0

typegen: check only for suffix matches on cname

This commit is contained in:
outfoxxed 2024-11-01 02:06:52 -07:00
parent c746569204
commit a8672e4eee
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E

View file

@ -100,16 +100,17 @@ pub fn resolve_types(
ctype = &ctype[0..ctype.len() - 1]; ctype = &ctype[0..ctype.len() - 1];
} }
// note: suffix is checked instead of == due to Q_PROPERTY using fully qualified names
let qtype = typespec let qtype = typespec
.typemap .typemap
.iter() .iter()
.find(|type_| &type_.cname == ctype) .find(|type_| !type_.cname.is_empty() && ctype.ends_with(&type_.cname))
.map(|type_| (&type_.module, &type_.name)) .map(|type_| (&type_.module, &type_.name))
.or_else(|| { .or_else(|| {
typespec typespec
.enums .enums
.iter() .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)) .map(|type_| (&type_.module, &type_.name))
}); });