[vala/staging: 18/22] libvaladoc: Clean up Api.ErrorDomain/ErrorCode constructor



commit 5c6fe7ffec3ddb47a6ee0aeebb56a2ceb63b5f08
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sat Nov 17 21:50:28 2018 +0100

    libvaladoc: Clean up Api.ErrorDomain/ErrorCode constructor

 libvaladoc/api/errorcode.vala   |  6 +++---
 libvaladoc/api/errordomain.vala | 19 +++++++++++++------
 valadoc/treebuilder.vala        | 16 +---------------
 3 files changed, 17 insertions(+), 24 deletions(-)
---
diff --git a/libvaladoc/api/errorcode.vala b/libvaladoc/api/errorcode.vala
index 6994f87a7..496af1f55 100644
--- a/libvaladoc/api/errorcode.vala
+++ b/libvaladoc/api/errorcode.vala
@@ -31,12 +31,12 @@ public class Valadoc.Api.ErrorCode : Symbol {
        private string? cname;
 
        public ErrorCode (ErrorDomain parent, SourceFile file, string name, SourceComment? comment,
-                                         string? cname, string? dbus_name, Vala.ErrorCode data)
+                                         Vala.ErrorCode data)
        {
                base (parent, file, name, parent.accessibility, comment, 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/errordomain.vala b/libvaladoc/api/errordomain.vala
index 8e4eb480d..905c2317e 100644
--- a/libvaladoc/api/errordomain.vala
+++ b/libvaladoc/api/errordomain.vala
@@ -33,15 +33,22 @@ public class Valadoc.Api.ErrorDomain : TypeSymbol {
        private string? cname;
 
        public ErrorDomain (Node parent, SourceFile file, string name, Vala.SymbolAccessibility accessibility,
-                                               SourceComment? comment, string? cname, string? 
quark_macro_name,
-                                               string? quark_function_name, string? dbus_name, 
Vala.ErrorDomain data)
+                                               SourceComment? comment, Vala.ErrorDomain data)
        {
                base (parent, file, name, accessibility, comment, null, null, null, null, false, data);
 
-               this.quark_function_name = quark_function_name;
-               this.quark_macro_name = quark_macro_name;
-               this.dbus_name = dbus_name;
-               this.cname = cname;
+               this.quark_function_name = _get_quark_function_name (data);
+               this.quark_macro_name = _get_quark_macro_name (data);
+               this.dbus_name = Vala.GDBusModule.get_dbus_name (data);
+               this.cname = Vala.get_ccode_name (data);
+       }
+
+       string _get_quark_function_name (Vala.ErrorDomain element) {
+               return Vala.get_ccode_lower_case_prefix (element) + "quark";
+       }
+
+       string? _get_quark_macro_name (Vala.ErrorDomain element) {
+               return Vala.get_ccode_upper_case_name (element, null);
        }
 
        /**
diff --git a/valadoc/treebuilder.vala b/valadoc/treebuilder.vala
index 018174351..cfe04edc3 100644
--- a/valadoc/treebuilder.vala
+++ b/valadoc/treebuilder.vala
@@ -274,10 +274,6 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
                return element.name;
        }
 
-       private string? get_quark_macro_name (Vala.ErrorDomain element) {
-               return Vala.get_ccode_upper_case_name (element, null);
-       }
-
        private string? get_is_type_macro_name (Vala.TypeSymbol element) {
                string? name = Vala.get_ccode_type_check_function (element);
                return (name != null && name != "")? name : null;
@@ -318,10 +314,6 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
                }
        }
 
-       private string get_quark_function_name (Vala.ErrorDomain element) {
-               return Vala.get_ccode_lower_case_prefix (element) + "quark";
-       }
-
        private PackageMetaData? get_package_meta_data (Package pkg) {
                foreach (PackageMetaData data in packages) {
                        if (data.package == pkg) {
@@ -977,11 +969,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
                                                                           element.name,
                                                                           element.access,
                                                                           comment,
-                                                                          Vala.get_ccode_name (element),
-                                                                          get_quark_macro_name (element),
-                                                                          get_quark_function_name (element),
-                                                                          Vala.GDBusModule.get_dbus_name 
(element),
-                                                                         element);
+                                                                          element);
                symbol_map.set (element, node);
                parent.add_child (node);
 
@@ -1005,8 +993,6 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
                                                                                 file,
                                                                                 element.name,
                                                                                 comment,
-                                                                                Vala.get_ccode_name 
(element),
-                                                                                
Vala.GDBusModule.get_dbus_name_for_member (element),
                                                                                 element);
                symbol_map.set (element, node);
                parent.add_child (node);


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