Skip to content
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
8 changes: 4 additions & 4 deletions binding_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2745,12 +2745,12 @@ def correct_typed_dictionary(type_name):
def correct_type(type_name, meta=None, use_alias=True):
type_conversion = {"float": "double", "int": "int64_t", "Nil": "Variant"}
if meta is not None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if meta is not None, but we don't handle it here (unexpected value)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will ignore it. That's actually the whole point of this PR: if there's an unexpected value in "meta", then we'll ignore it and not potentially generate invalid code.

PR godotengine/godot#86079 adds "required" as a potential value for "meta", and without this PR, it'll generate invalid code (attempting to use "required" as a type name).

if "int" in meta:
if meta in ["int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64"]:
return f"{meta}_t"
elif "char" in meta:
return f"{meta}_t"
else:
elif meta in ["float", "double"]:
return meta
elif meta in ["char16", "char32"]:
return f"{meta}_t"
if type_name in type_conversion:
return type_conversion[type_name]
if type_name.startswith("typedarray::"):
Expand Down
Loading