Skip to content

Commit

Permalink
Merge pull request #352 from liamHowatt/fix/leading-underscore-structs
Browse files Browse the repository at this point in the history
fix: check structs for alternative name in JSON
  • Loading branch information
kisvegabor authored Sep 2, 2024
2 parents d582e85 + 1fa1479 commit 96d6d35
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 96d6d35

Please sign in to comment.