[vala/staging: 11/22] libvaladoc: Clean up Api.Property/PropertyAccessor constructor



commit 9b3ace435f5810e25e763730c5980fafa456af4c
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Jun 12 15:41:41 2018 +0200

    libvaladoc: Clean up Api.Property/PropertyAccessor constructor

 libvaladoc/api/property.vala         |  8 ++++----
 libvaladoc/api/propertyaccessor.vala | 15 ++++++++++++---
 valadoc/treebuilder.vala             | 16 ----------------
 3 files changed, 16 insertions(+), 23 deletions(-)
---
diff --git a/libvaladoc/api/property.vala b/libvaladoc/api/property.vala
index 2a0182e4c..9c144c333 100644
--- a/libvaladoc/api/property.vala
+++ b/libvaladoc/api/property.vala
@@ -31,15 +31,15 @@ public class Valadoc.Api.Property : Symbol {
        private string? cname;
 
        public Property (Node parent, SourceFile file, string name, Vala.SymbolAccessibility accessibility,
-                                        SourceComment? comment, string? cname, string? dbus_name, bool 
is_dbus_visible,
+                                        SourceComment? comment,
                                         Vala.Property data)
        {
                base (parent, file, name, accessibility, comment, data);
 
-               this.is_dbus_visible = is_dbus_visible;
+               this.is_dbus_visible = Vala.GDBusModule.is_dbus_visible (data);
 
-               this.dbus_name = dbus_name;
-               this.cname = cname;
+               this.dbus_name = Vala.GDBusModule.get_dbus_name_for_member (data);
+               this.cname = Vala.get_ccode_name (data);
        }
 
        /**
diff --git a/libvaladoc/api/propertyaccessor.vala b/libvaladoc/api/propertyaccessor.vala
index 29ad225a9..56ad06719 100644
--- a/libvaladoc/api/propertyaccessor.vala
+++ b/libvaladoc/api/propertyaccessor.vala
@@ -31,12 +31,21 @@ public class Valadoc.Api.PropertyAccessor : Symbol {
        private string? cname;
 
        public PropertyAccessor (Property parent, SourceFile file, string name, Vala.SymbolAccessibility 
accessibility,
-                                                        string? cname, Ownership ownership, 
Vala.PropertyAccessor data)
+                                                        Vala.PropertyAccessor data)
        {
                base (parent, file, name, accessibility, null, data);
 
-               this.ownership = ownership;
-               this.cname = cname;
+               this.ownership = get_property_ownership (data);
+               this.cname = Vala.get_ccode_name (data);
+       }
+
+       Ownership get_property_ownership (Vala.PropertyAccessor element) {
+               if (element.value_type.value_owned) {
+                       return Ownership.OWNED;
+               }
+
+               // the exact type (weak, unowned) does not matter
+               return Ownership.UNOWNED;
        }
 
        /**
diff --git a/valadoc/treebuilder.vala b/valadoc/treebuilder.vala
index b0ef026e9..4f809bd97 100644
--- a/valadoc/treebuilder.vala
+++ b/valadoc/treebuilder.vala
@@ -488,15 +488,6 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
                return meta_data.get_namespace ((Vala.Namespace) namespace_symbol, file);
        }
 
-       private Ownership get_property_ownership (Vala.PropertyAccessor element) {
-               if (element.value_type.value_owned) {
-                       return Ownership.OWNED;
-               }
-
-               // the exact type (weak, unowned) does not matter
-               return Ownership.UNOWNED;
-       }
-
 
        //
        // Vala tree creation:
@@ -922,9 +913,6 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
                                                                          element.name,
                                                                          element.access,
                                                                          comment,
-                                                                         element.nick,
-                                                                         
Vala.GDBusModule.get_dbus_name_for_member (element),
-                                                                         Vala.GDBusModule.is_dbus_visible 
(element),
                                                                          element);
                node.property_type = create_type_reference (element.property_type, node, node);
                symbol_map.set (element, node);
@@ -937,8 +925,6 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
                                                                                                file,
                                                                                                element.name,
                                                                                                
accessor.access,
-                                                                                               get_cname 
(accessor),
-                                                                                               
get_property_ownership (accessor),
                                                                                                accessor);
                }
 
@@ -948,8 +934,6 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
                                                                                                file,
                                                                                                element.name,
                                                                                                
accessor.access,
-                                                                                               get_cname 
(accessor),
-                                                                                               
get_property_ownership (accessor),
                                                                                                accessor);
                }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]