Merge pull request #1423 from AThousandShips/style_fix

Fix some style details in generation
pull/1497/head
David Snopek 2024-06-18 11:24:11 -05:00 committed by GitHub
commit 0efc6cddbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 13 deletions

View File

@ -805,6 +805,8 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
if "return_type" in method: if "return_type" in method:
method_signature += f'{correct_type(method["return_type"])}' method_signature += f'{correct_type(method["return_type"])}'
if not method_signature.endswith("*"):
method_signature += " "
else: else:
method_signature += "void " method_signature += "void "
@ -1642,8 +1644,6 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
vararg = "is_vararg" in method and method["is_vararg"] vararg = "is_vararg" in method and method["is_vararg"]
method_signature = "\t" method_signature = "\t"
if vararg:
method_signature += "private: "
method_signature += make_signature( method_signature += make_signature(
class_name, method, for_header=True, use_template_get_node=use_template_get_node class_name, method, for_header=True, use_template_get_node=use_template_get_node
) )
@ -1787,7 +1787,9 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
False, False,
) )
if return_type is not None: if return_type is not None:
method_signature += return_type + " " method_signature += return_type
if not method_signature.endswith("*"):
method_signature += " "
else: else:
method_signature += "void " method_signature += "void "
@ -2735,7 +2737,7 @@ def correct_type(type_name, meta=None, use_alias=True):
return f"Ref<{type_name}>" return f"Ref<{type_name}>"
if type_name == "Object" or is_engine_class(type_name): if type_name == "Object" or is_engine_class(type_name):
return f"{type_name} *" return f"{type_name} *"
if type_name.endswith("*"): if type_name.endswith("*") and not type_name.endswith("**") and not type_name.endswith(" *"):
return f"{type_name[:-1]} *" return f"{type_name[:-1]} *"
return type_name return type_name