Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows to doc vararg method return type as void #34745

Merged
merged 1 commit into from
Jan 2, 2020

Conversation

timothyqiu
Copy link
Member

@timothyqiu timothyqiu commented Jan 2, 2020

This fixes #34743

Parameter p_return_nil_is_variant is added to bind_vararg_method to opt-out the PROPERTY_USAGE_NIL_IS_VARIANT flag.

Before this fix, MethodBindVarArg always set PROPERTY_USAGE_NIL_IS_VARIANT for the return type.

godot/core/method_bind.h

Lines 365 to 367 in 1788b22

argument_types = at;
arguments = p_info;
arguments.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT;


Update: renamed p_return_nil_as_variant to p_return_nil_is_variant, to be consistent with the flag name.

@timothyqiu timothyqiu requested a review from a team as a code owner January 2, 2020 08:41
@timothyqiu timothyqiu force-pushed the vararg-return-nil-34743 branch from 8262e30 to cdeb8eb Compare January 2, 2020 08:48
@akien-mga akien-mga added this to the 3.2 milestone Jan 2, 2020
@akien-mga akien-mga requested a review from bojidar-bg January 2, 2020 09:47
core/object.cpp Outdated
@@ -1686,7 +1686,7 @@ void Object::_bind_methods() {
mi.name = "emit_signal";
mi.arguments.push_back(PropertyInfo(Variant::STRING, "signal"));

ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "emit_signal", &Object::_emit_signal, mi);
ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "emit_signal", &Object::_emit_signal, mi, Vector<Variant>(), false);
Copy link
Member

@akien-mga akien-mga Jan 2, 2020

Choose a reason for hiding this comment

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

Other similar methods seem to use varray() (see variant.h) as a shorthand for Vector<Variant>().

@akien-mga
Copy link
Member

For the reference, this also impacts the GDNative API in a compatibility breaking way, but I think this is OK to do before the 3.2 release (compat breakage between 3.1.x and 3.2 is expected). CC @godotengine/gdnative to confirm.

--- api.json    2020-01-02 13:51:41.400082712 +0100
+++ api2.json   2020-01-02 13:55:51.671606934 +0100
@@ -95424,7 +95424,7 @@
                        },
                        {
                                "name": "call_deferred",
-                               "return_type": "Variant",
+                               "return_type": "void",
                                "is_editor": false,
                                "is_noscript": false,
                                "is_const": false,
@@ -95555,7 +95555,7 @@
                        },
                        {
                                "name": "emit_signal",
-                               "return_type": "Variant",
+                               "return_type": "void",
                                "is_editor": false,
                                "is_noscript": false,
                                "is_const": false,
@@ -157300,7 +157300,7 @@
                "methods": [
                        {
                                "name": "add_do_method",
-                               "return_type": "Variant",
+                               "return_type": "void",
                                "is_editor": false,
                                "is_noscript": false,
                                "is_const": false,
@@ -157375,7 +157375,7 @@
                        },
                        {
                                "name": "add_undo_method",
-                               "return_type": "Variant",
+                               "return_type": "void",
                                "is_editor": false,
                                "is_noscript": false,
                                "is_const": false,

@timothyqiu timothyqiu force-pushed the vararg-return-nil-34743 branch from cdeb8eb to 4d727f1 Compare January 2, 2020 13:37
@akien-mga akien-mga merged commit a97b08e into godotengine:master Jan 2, 2020
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

will the call_deferred ( String method, … ) return value?
2 participants