Generate using declarations for anonymous structs in WASM bindings.

PiperOrigin-RevId: 832359379
Change-Id: Ie5913c584c5605f512dbe423524a829043179b6f
This commit is contained in:
Matias Manevi
2025-11-14 10:02:20 -08:00
committed by Copybara-Service
parent 999344c998
commit 53e254b715
3 changed files with 14 additions and 10 deletions
+11
View File
@@ -699,6 +699,17 @@ class Generator:
autogenned_struct_definitions = []
markers_and_content = []
typedefs = []
for type_name in sorted(constants.ANONYMOUS_STRUCTS):
s = constants.ANONYMOUS_STRUCTS[type_name]
typedefs.append(
f"using {type_name} = decltype(::{s['parent']}::{s['field_name']});"
)
markers_and_content.append((
"// {{ ANONYMOUS_STRUCT_TYPEDEFS }}",
typedefs,
))
# Sort by struct name by dependency to ensure deterministic output order
sorted_struct_names = sort_structs_by_dependency(self.structs_to_bind_data)