[vala/0.42] girwriter: Support transfer-ownership="container" for arrays
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.42] girwriter: Support transfer-ownership="container" for arrays
- Date: Thu, 28 Feb 2019 07:28:52 +0000 (UTC)
commit ceb0176baf2614381aad2cab50473aaf259ec0b9
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Feb 26 14:10:35 2019 +0100
girwriter: Support transfer-ownership="container" for arrays
codegen/valagirwriter.vala | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 6a6a7d6f8..98758e2fe 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -1240,7 +1240,8 @@ public class Vala.GIRWriter : CodeVisitor {
buffer.append_printf (" direction=\"out\"");
}
- DelegateType delegate_type = type as DelegateType;
+ unowned DelegateType? delegate_type = type as DelegateType;
+ unowned ArrayType? array_type = type as ArrayType;
if (type != null && ((type.value_owned && delegate_type == null) || (constructor &&
!type.data_type.is_subtype_of (ginitiallyunowned_type)))) {
var any_owned = false;
@@ -1249,6 +1250,8 @@ public class Vala.GIRWriter : CodeVisitor {
}
if (type.has_type_arguments () && !any_owned) {
buffer.append_printf (" transfer-ownership=\"container\"");
+ } else if (array_type != null && !array_type.element_type.value_owned) {
+ buffer.append_printf (" transfer-ownership=\"container\"");
} else {
buffer.append_printf (" transfer-ownership=\"full\"");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]