Generate using declarations for anonymous structs in WASM bindings.
PiperOrigin-RevId: 832359379 Change-Id: Ie5913c584c5605f512dbe423524a829043179b6f
This commit is contained in:
committed by
Copybara-Service
parent
999344c998
commit
53e254b715
@@ -105,13 +105,12 @@ std::vector<WrapperType> InitWrapperArray(ArrayType* array, SizeType size) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Create the types for anonymous structs
|
||||
using mjVisualGlobal = decltype(::mjVisual::global);
|
||||
using mjVisualQuality = decltype(::mjVisual::quality);
|
||||
using mjVisualHeadlight = decltype(::mjVisual::headlight);
|
||||
using mjVisualMap = decltype(::mjVisual::map);
|
||||
using mjVisualScale = decltype(::mjVisual::scale);
|
||||
using mjVisualQuality = decltype(::mjVisual::quality);
|
||||
using mjVisualRgba = decltype(::mjVisual::rgba);
|
||||
using mjVisualScale = decltype(::mjVisual::scale);
|
||||
|
||||
struct MjContact {
|
||||
explicit MjContact(mjContact *ptr);
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -105,13 +105,7 @@ std::vector<WrapperType> InitWrapperArray(ArrayType* array, SizeType size) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Create the types for anonymous structs
|
||||
using mjVisualGlobal = decltype(::mjVisual::global);
|
||||
using mjVisualQuality = decltype(::mjVisual::quality);
|
||||
using mjVisualHeadlight = decltype(::mjVisual::headlight);
|
||||
using mjVisualMap = decltype(::mjVisual::map);
|
||||
using mjVisualScale = decltype(::mjVisual::scale);
|
||||
using mjVisualRgba = decltype(::mjVisual::rgba);
|
||||
// {{ ANONYMOUS_STRUCT_TYPEDEFS }}
|
||||
|
||||
// {{ AUTOGENNED_STRUCTS_HEADER }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user