From 6d261528e037524607eb2905d2ddab018f6d1d27 Mon Sep 17 00:00:00 2001 From: Google DeepMind Date: Tue, 11 Nov 2025 10:37:45 -0800 Subject: [PATCH] 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 --- wasm/codegen/generators/structs.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wasm/codegen/generators/structs.py b/wasm/codegen/generators/structs.py index c0f9f77f..6a1c148f 100644 --- a/wasm/codegen/generators/structs.py +++ b/wasm/codegen/generators/structs.py @@ -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),