Skip to content

Commit

Permalink
Fix object return value of builtin types' methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daylily-Zeleen committed Jan 18, 2024
1 parent 0ddef6e commit ca2da27
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions binding_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,8 +964,21 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
result.append(method_signature + "{")

method_call = "\t"
need_additional_right_bracke = False
if "return_type" in method:
method_call += f'return internal::_call_builtin_method_ptr_ret<{correct_type(method["return_type"])}>('
return_type = method["return_type"]
if not is_variant(return_type) and\
not is_pod_type(return_type):
if is_refcounted(return_type):
# RefCounted
method_call += f"return Ref<{return_type}>::_gde_internal_constructor("
else:
# Object
method_call += f"return internal::get_object_instance_binding("
method_call += f"internal::_call_builtin_method_ptr_ret<{correct_type(return_type)}>("
need_additional_right_bracke = True
else:
method_call += f"return internal::_call_builtin_method_ptr_ret<{correct_type(return_type)}>("
else:
method_call += "internal::_call_builtin_method_ptr_no_ret("
method_call += f'_method_bindings.method_{method["name"]}, '
Expand All @@ -986,7 +999,10 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
result += encode
arguments.append(arg_name)
method_call += ", ".join(arguments)
method_call += ");"
if need_additional_right_bracke:
method_call += "));"
else:
method_call += ");"

result.append(method_call)
result.append("}")
Expand Down

0 comments on commit ca2da27

Please sign in to comment.