diff --git a/shared/yeast-macros/src/parse.rs b/shared/yeast-macros/src/parse.rs index e623c708726..eb3b161b295 100644 --- a/shared/yeast-macros/src/parse.rs +++ b/shared/yeast-macros/src/parse.rs @@ -437,7 +437,11 @@ fn parse_direct_node_inner(tokens: &mut Tokens, ctx: &Ident) -> Result::into) .collect(); }); - field_args.push(quote! { (#field_str, #temp) }); + // An empty splice means the field is absent — skip it + // entirely rather than emitting an empty named field. + field_args.push(quote! { + if !#temp.is_empty() { __fields.push((#field_str, #temp)); } + }); continue; } } @@ -445,7 +449,7 @@ fn parse_direct_node_inner(tokens: &mut Tokens, ctx: &Ident) -> Result Result)> = Vec::new(); + #(#field_args)* + #ctx.node(#kind_str, __fields) } }) }