@@ -797,14 +797,16 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
797
797
798
798
vararg = method ["is_vararg" ]
799
799
if vararg :
800
- result .append ("\t template<typename... Args>" )
800
+ result .append ("\t template <typename... Args>" )
801
801
802
802
method_signature = "\t "
803
803
if "is_static" in method and method ["is_static" ]:
804
804
method_signature += "static "
805
805
806
806
if "return_type" in method :
807
- method_signature += f'{ correct_type (method ["return_type" ])} '
807
+ method_signature += f'{ correct_type (method ["return_type" ])} '
808
+ if not method_signature .endswith ("*" ):
809
+ method_signature += " "
808
810
else :
809
811
method_signature += "void "
810
812
@@ -1222,7 +1224,7 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl
1222
1224
continue
1223
1225
1224
1226
method_signature = make_signature (class_name , method , for_builtin = True )
1225
- result .append (method_signature + "{" )
1227
+ result .append (method_signature + " {" )
1226
1228
1227
1229
method_call = "\t "
1228
1230
is_ref = False
@@ -1642,8 +1644,6 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
1642
1644
vararg = "is_vararg" in method and method ["is_vararg" ]
1643
1645
1644
1646
method_signature = "\t "
1645
- if vararg :
1646
- method_signature += "private: "
1647
1647
method_signature += make_signature (
1648
1648
class_name , method , for_header = True , use_template_get_node = use_template_get_node
1649
1649
)
@@ -1722,16 +1722,16 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
1722
1722
if class_name == "Object" :
1723
1723
result .append ("" )
1724
1724
1725
- result .append ("\t template<typename T>" )
1725
+ result .append ("\t template <typename T>" )
1726
1726
result .append ("\t static T *cast_to(Object *p_object);" )
1727
1727
1728
- result .append ("\t template<typename T>" )
1728
+ result .append ("\t template <typename T>" )
1729
1729
result .append ("\t static const T *cast_to(const Object *p_object);" )
1730
1730
1731
1731
result .append ("\t virtual ~Object() = default;" )
1732
1732
1733
1733
elif use_template_get_node and class_name == "Node" :
1734
- result .append ("\t template<typename T>" )
1734
+ result .append ("\t template <typename T>" )
1735
1735
result .append (
1736
1736
"\t T *get_node(const NodePath &p_path) const { return Object::cast_to<T>(get_node_internal(p_path)); }"
1737
1737
)
@@ -1773,7 +1773,7 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
1773
1773
1774
1774
vararg = "is_vararg" in method and method ["is_vararg" ]
1775
1775
if vararg :
1776
- method_signature = "\t template<typename... Args> static "
1776
+ method_signature = "\t template <typename... Args> static "
1777
1777
else :
1778
1778
method_signature = "\t static "
1779
1779
@@ -1787,7 +1787,9 @@ def generate_engine_class_header(class_api, used_classes, fully_used_classes, us
1787
1787
False ,
1788
1788
)
1789
1789
if return_type is not None :
1790
- method_signature += return_type + " "
1790
+ method_signature += return_type
1791
+ if not method_signature .endswith ("*" ):
1792
+ method_signature += " "
1791
1793
else :
1792
1794
method_signature += "void "
1793
1795
@@ -2415,7 +2417,7 @@ def make_varargs_template(
2415
2417
if with_public_declare :
2416
2418
function_signature = "public: "
2417
2419
2418
- function_signature += "template<typename... Args> "
2420
+ function_signature += "template <typename... Args> "
2419
2421
2420
2422
if static :
2421
2423
function_signature += "static "
@@ -2469,7 +2471,7 @@ def make_varargs_template(
2469
2471
args_array += "Variant(p_args)... };"
2470
2472
result .append (args_array )
2471
2473
result .append (f"\t std::array<const Variant *, { len (method_arguments )} + sizeof...(Args)> call_args;" )
2472
- result .append ("\t for(size_t i = 0; i < variant_args.size(); i++) {" )
2474
+ result .append ("\t for (size_t i = 0; i < variant_args.size(); i++) {" )
2473
2475
result .append ("\t \t call_args[i] = &variant_args[i];" )
2474
2476
result .append ("\t }" )
2475
2477
@@ -2735,7 +2737,7 @@ def correct_type(type_name, meta=None, use_alias=True):
2735
2737
return f"Ref<{ type_name } >"
2736
2738
if type_name == "Object" or is_engine_class (type_name ):
2737
2739
return f"{ type_name } *"
2738
- if type_name .endswith ("*" ):
2740
+ if type_name .endswith ("*" ) and not type_name . endswith ( "**" ) and not type_name . endswith ( " *" ) :
2739
2741
return f"{ type_name [:- 1 ]} *"
2740
2742
return type_name
2741
2743
0 commit comments