summaryrefslogtreecommitdiff
path: root/vala/valamethod.vala
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2020-08-04 09:02:25 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2020-08-04 09:23:18 +0200
commit578a1294bb40cc6a0d0fd7c1a25e2da191a509ff (patch)
tree508fd1431f87935c76c54d1086a08391294f6b22 /vala/valamethod.vala
parent59b336179b3825183adc7591af990f77bd315e92 (diff)
downloadvala-578a1294bb40cc6a0d0fd7c1a25e2da191a509ff.tar.gz
vala: Inherit CCode.returns_floating_reference attribute from base method
Regression of 49a6d475052ec476140c545a26ac8d5abe35c849 Fixes https://gitlab.gnome.org/GNOME/vala/issues/1053
Diffstat (limited to 'vala/valamethod.vala')
-rw-r--r--vala/valamethod.vala9
1 files changed, 9 insertions, 0 deletions
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index ef8a48dae..152f6b3be 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -366,6 +366,13 @@ public class Vala.Method : Subroutine, Callable {
}
}
+ var return_type = this.return_type.copy ();
+ if (has_attribute_argument ("CCode", "returns_floating_reference")) {
+ return_type.floating_reference = returns_floating_reference;
+ } else {
+ return_type.floating_reference = base_method.returns_floating_reference;
+ }
+
var actual_base_type = base_method.return_type.get_actual_type (object_type, method_type_args, node_reference);
if (!return_type.equals (actual_base_type)) {
invalid_match = "Base method expected return type `%s', but `%s' was provided".printf (actual_base_type.to_prototype_string (), return_type.to_prototype_string ());
@@ -627,6 +634,7 @@ public class Vala.Method : Subroutine, Callable {
_base_method = base_method;
copy_attribute_double (base_method, "CCode", "instance_pos");
+ copy_attribute_bool (base_method, "CCode", "returns_floating_reference");
return;
}
}
@@ -686,6 +694,7 @@ public class Vala.Method : Subroutine, Callable {
if (base_match != null) {
_base_interface_method = base_match;
copy_attribute_double (base_match, "CCode", "instance_pos");
+ copy_attribute_bool (base_match, "CCode", "returns_floating_reference");
return;
} else if (!hides && invalid_base_match != null) {
error = true;