Skip anonymous unions with less than 2 members.

This commit is contained in:
Benjamin Moir 2024-01-10 18:49:27 +10:00
parent 046ea15f36
commit 97fa992742
1 changed files with 6 additions and 0 deletions

View File

@ -1583,6 +1583,9 @@ pub fn struct_def_string(
}
}
for anon in &unions {
if anon.member_count < 2 {
continue;
}
if i == anon.member_index + anon.member_count {
indent -= 4;
out.push_str(&indent_all_by(indent, "};\n"));
@ -1590,6 +1593,9 @@ pub fn struct_def_string(
}
}
for anon in &unions {
if anon.member_count < 2 {
continue;
}
if i == anon.member_index {
out.push_str(&indent_all_by(indent, "union { // inferred\n"));
indent += 4;