summaryrefslogtreecommitdiff
path: root/libvaladoc
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2019-10-10 17:40:44 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2019-10-10 18:14:47 +0200
commit278797ab7ac06d71548fb699678e6f727bc5673e (patch)
tree76a62a9fcdec5b1e0ea3a893441b5938a47767ba /libvaladoc
parent774f69bc659556e936cd2cd1bbf482da2c60d6e8 (diff)
downloadvala-278797ab7ac06d71548fb699678e6f727bc5673e.tar.gz
libvaladoc: Fix parameter and property ownership declarations
Diffstat (limited to 'libvaladoc')
-rw-r--r--libvaladoc/api/typereference.vala28
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;