@@ -702,14 +702,16 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
702702
703703 vararg = method ["is_vararg" ]
704704 if vararg :
705- result .append ("\t template<typename... Args>" )
705+ result .append ("\t template <typename... Args>" )
706706
707707 method_signature = "\t "
708708 if "is_static" in method and method ["is_static" ]:
709709 method_signature += "static "
710710
711711 if "return_type" in method :
712- method_signature += f'{ correct_type (method ["return_type" ])} '
712+ method_signature += f'{ correct_type (method ["return_type" ])} '
713+ if not method_signature .endswith ("*" ):
714+ method_signature += " "
713715 else :
714716 method_signature += "void "
715717
@@ -1127,7 +1129,7 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
11271129 continue
11281130
11291131 method_signature = make_signature (class_name , method , for_builtin = True )
1130- result .append (method_signature + "{" )
1132+ result .append (method_signature + " {" )
11311133
11321134 method_call = "\t "
11331135 is_ref = False
@@ -1547,8 +1549,6 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
15471549 vararg = "is_vararg" in method and method ["is_vararg" ]
15481550
15491551 method_signature = "\t "
1550- if vararg :
1551- method_signature += "private: "
15521552 method_signature += make_signature (
15531553 class_name , method , for_header = True , use_template_get_node = use_template_get_node
15541554 )
@@ -1627,16 +1627,16 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
16271627 if class_name == "Object" :
16281628 result .append ("" )
16291629
1630- result .append ("\t template<typename T>" )
1630+ result .append ("\t template <typename T>" )
16311631 result .append ("\t static T *cast_to(Object *p_object);" )
16321632
1633- result .append ("\t template<typename T>" )
1633+ result .append ("\t template <typename T>" )
16341634 result .append ("\t static const T *cast_to(const Object *p_object);" )
16351635
16361636 result .append ("\t virtual ~Object() = default;" )
16371637
16381638 elif use_template_get_node and class_name == "Node" :
1639- result .append ("\t template<typename T>" )
1639+ result .append ("\t template <typename T>" )
16401640 result .append (
16411641 "\t T *get_node(const NodePath &p_path) const { return Object::cast_to<T>(get_node_internal(p_path)); }"
16421642 )
@@ -1678,7 +1678,7 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
16781678
16791679 vararg = "is_vararg" in method and method ["is_vararg" ]
16801680 if vararg :
1681- method_signature = "\t template<typename... Args> static "
1681+ method_signature = "\t template <typename... Args> static "
16821682 else :
16831683 method_signature = "\t static "
16841684
@@ -1692,7 +1692,9 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
16921692 False ,
16931693 )
16941694 if return_type is not None :
1695- method_signature += return_type + " "
1695+ method_signature += return_type
1696+ if not method_signature .endswith ("*" ):
1697+ method_signature += " "
16961698 else :
16971699 method_signature += "void "
16981700
@@ -2320,7 +2322,7 @@ def make_varargs_template(
23202322 if with_public_declare :
23212323 function_signature = "public: "
23222324
2323- function_signature += "template<typename... Args> "
2325+ function_signature += "template <typename... Args> "
23242326
23252327 if static :
23262328 function_signature += "static "
@@ -2374,7 +2376,7 @@ def make_varargs_template(
23742376 args_array += "Variant(p_args)... };"
23752377 result .append (args_array )
23762378 result .append (f"\t std::array<const Variant *, { len (method_arguments )} + sizeof...(Args)> call_args;" )
2377- result .append ("\t for(size_t i = 0; i < variant_args.size(); i++) {" )
2379+ result .append ("\t for (size_t i = 0; i < variant_args.size(); i++) {" )
23782380 result .append ("\t \t call_args[i] = &variant_args[i];" )
23792381 result .append ("\t }" )
23802382
@@ -2626,7 +2628,7 @@ def correct_type(type_name, meta=None, use_alias=True):
26262628 return f"Ref<{ type_name } >"
26272629 if type_name == "Object" or is_engine_class (type_name ):
26282630 return f"{ type_name } *"
2629- if type_name .endswith ("*" ):
2631+ if type_name .endswith ("*" ) and not type_name . endswith ( "**" ) and not type_name . endswith ( " *" ) :
26302632 return f"{ type_name [:- 1 ]} *"
26312633 return type_name
26322634
0 commit comments