Enhance error reporting in WASM codegen generators.

In `structs.py`, a `RuntimeError` is now raised when an anonymous struct is encountered but is not present in `STRUCTS_TO_BIND`.

PiperOrigin-RevId: 830978376
Change-Id: Id64720a12c3cce313bd513a40a74ddf57718a7d1
This commit is contained in:
Google DeepMind
2025-11-11 10:37:45 -08:00
committed by Copybara-Service
parent 8e4a5901c3
commit 6d261528e0
+6
View File
@@ -147,6 +147,12 @@ def _generate_field_data(
anonymous_struct_name = name
break
if not anonymous_struct_name:
raise RuntimeError(
f"Anonymous struct for field {f.name} in {w} not found in"
" ANONYMOUS_STRUCTS."
)
if anonymous_struct_name in constants.STRUCTS_TO_BIND:
return WrappedFieldData(
binding=_simple_property_binding(f, w, setter=False, reference=True),