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:
committed by
Copybara-Service
parent
8e4a5901c3
commit
6d261528e0
@@ -147,6 +147,12 @@ def _generate_field_data(
|
|||||||
anonymous_struct_name = name
|
anonymous_struct_name = name
|
||||||
break
|
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:
|
if anonymous_struct_name in constants.STRUCTS_TO_BIND:
|
||||||
return WrappedFieldData(
|
return WrappedFieldData(
|
||||||
binding=_simple_property_binding(f, w, setter=False, reference=True),
|
binding=_simple_property_binding(f, w, setter=False, reference=True),
|
||||||
|
|||||||
Reference in New Issue
Block a user