diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-10-10 17:40:44 +0200 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-10-10 18:14:47 +0200 |
commit | 278797ab7ac06d71548fb699678e6f727bc5673e (patch) | |
tree | 76a62a9fcdec5b1e0ea3a893441b5938a47767ba /libvaladoc | |
parent | 774f69bc659556e936cd2cd1bbf482da2c60d6e8 (diff) | |
download | vala-278797ab7ac06d71548fb699678e6f727bc5673e.tar.gz |
libvaladoc: Fix parameter and property ownership declarations
Diffstat (limited to 'libvaladoc')
-rw-r--r-- | libvaladoc/api/typereference.vala | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/libvaladoc/api/typereference.vala b/libvaladoc/api/typereference.vala index 285c7d734..669c05423 100644 --- a/libvaladoc/api/typereference.vala +++ b/libvaladoc/api/typereference.vala @@ -126,12 +126,28 @@ public class Valadoc.Api.TypeReference : Item { } Ownership get_type_reference_ownership (Vala.DataType? element) { - if (is_type_reference_owned (element)) { - return Ownership.OWNED; - } else if (is_type_reference_weak (element)) { - return Ownership.WEAK; - } else if (is_type_reference_unowned (element)) { - return Ownership.UNOWNED; + unowned Vala.DataType? type = element; + if (type != null) { + if (type.parent_node is Vala.Parameter) { + if (((Vala.Parameter) type.parent_node).direction == Vala.ParameterDirection.IN) { + if (type.value_owned) { + return Ownership.OWNED; + } + } else { + if (type.is_weak ()) { + return Ownership.UNOWNED; + } + } + return Ownership.DEFAULT; + } else if (type.parent_node is Vala.PropertyAccessor) { + if (((Vala.PropertyAccessor) type.parent_node).value_type.value_owned) { + return Ownership.OWNED; + } + return Ownership.DEFAULT; + } + if (type.is_weak ()) { + return Ownership.UNOWNED; + } } return Ownership.DEFAULT; |