Skip to main content

object_macro_replacement

Function object_macro_replacement 

Source
pub fn object_macro_replacement(replacement: &str) -> ObjectMacroReplacement
Expand description

Recover direct fields hidden in an object-like macro replacement.

A field-list macro is valid in more than one owner, so this helper returns only the declaration-shaped children of the synthetic field list. Nested aggregate promotion remains the owner’s normal structured aggregate logic; treating nested members as direct fields here would leak them across owners.

A replacement that ends in another field-list macro’s name is reported as composition rather than refused: the grammar has no member rule for a bare identifier, so tree-sitter marks it as one type_identifier with a MISSING ;. Every other malformed region still refuses the whole replacement, so an unsupported spelling stays unproven instead of donating partial members.