Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check structs for alternative name in JSON #352

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions gen/gen_mpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1871,6 +1871,12 @@ def get_user_data(func, func_name = None, containing_struct = None, containing_s
# print('/* --> callback: user_data=%s user_data_found=%s containing_struct=%s */' % (user_data, user_data_found, containing_struct))
if not user_data_found and lvgl_json is not None:
containing_struct_j = next((struct for struct in lvgl_json["structures"] if struct["name"] == struct_arg_type_name), None)
if (containing_struct_j is None
and struct_arg_type_name.startswith("lv_")
and None is not next((fwd_decl for fwd_decl in lvgl_json["forward_decls"] if fwd_decl["name"] == struct_arg_type_name), None)
):
struct_arg_type_name_with_underscore = "_" + struct_arg_type_name
containing_struct_j = next((struct for struct in lvgl_json["structures"] if struct["name"] == struct_arg_type_name_with_underscore), None)
if containing_struct_j is not None:
user_data_found = any(user_data == field["name"] for field in containing_struct_j["fields"])
return (user_data if user_data_found else None), *get_user_data_accessors(containing_struct, containing_struct_name)
Expand Down