diff options
| author | Sébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com> | 2024-01-02 10:06:56 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-02 09:06:56 +0000 |
| commit | a236e362db8be16d64da26eba73c46d8cc8bb04e (patch) | |
| tree | b2fe637aec2ca3c73884259f99e56715bcbdfc6c /crates | |
| parent | 4bf16d7acb1407325d95e24aa237af04c341ee2c (diff) | |
Fix `#[internal]` fields needing `IntoValue` impl (#3103)
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/typst-macros/src/elem.rs | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/crates/typst-macros/src/elem.rs b/crates/typst-macros/src/elem.rs index 34c54737..2199ec92 100644 --- a/crates/typst-macros/src/elem.rs +++ b/crates/typst-macros/src/elem.rs @@ -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 |
