implement super-type fields and methods

This commit is contained in:
Janis 2023-06-25 16:36:22 +02:00
parent ab003e4cdc
commit df4cc0677b

View file

@ -681,6 +681,29 @@ pub mod rust {
// TODO: impl super-type fields and methods.
let mut sup = class.super_class;
let super_traits = core::iter::from_fn(|| {
if let Some(key) = sup {
let next = self.sdk.get_object(&key);
sup = next.and_then(|next| next.super_class());
next
} else {
None
}
})
.map(|ty| ty.unique_name())
.map(|super_name| {
let fields = format_ident!("{super_name}Fields");
let methods = format_ident!("{super_name}Methods");
// FIXME: full path here? meaning I need the package name aswell.
quote! {
impl #fields for #name {}
impl #methods for #name {}
}
});
quote! {
#[repr(transparent)]
#[derive(Debug)]