Skip to content

Commit

Permalink
check structs for alternative name
Browse files Browse the repository at this point in the history
  • Loading branch information
liamHowatt committed Aug 28, 2024
1 parent d582e85 commit 1fa1479
Showing 1 changed file with 6 additions and 0 deletions.
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

0 comments on commit 1fa1479

Please sign in to comment.