Fix #[internal] fields needing IntoValue impl (#3103)

This commit is contained in:
Sébastien d'Herbais de Thun 2024-01-02 10:06:56 +01:00 committed by GitHub
parent 4bf16d7acb
commit a236e362db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -834,17 +834,21 @@ fn create_native_elem_impl(element: &Elem) -> TokenStream {
});
// Creation of the fields dictionary for inherent fields.
let field_dict = element.inherent_fields().clone().map(|field| {
let name = &field.name;
let field_ident = &field.ident;
let field_call = quote! { ::ecow::EcoString::from(#name).into() };
quote! {
fields.insert(
#field_call,
#foundations::IntoValue::into_value(self.#field_ident.clone())
);
}
});
let field_dict = element
.inherent_fields()
.filter(|field| !field.internal)
.clone()
.map(|field| {
let name = &field.name;
let field_ident = &field.ident;
let field_call = quote! { ::ecow::EcoString::from(#name).into() };
quote! {
fields.insert(
#field_call,
#foundations::IntoValue::into_value(self.#field_ident.clone())
);
}
});
// Creation of the fields dictionary for optional fields.
let field_opt_dict = element