[vala/staging: 16/22] libvaladoc: Clean up Api.Struct constructor



commit 87a2881730f219f529a4c8ccbad2639be7491604
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Nov 14 15:47:24 2018 +0100

    libvaladoc: Clean up Api.Struct constructor

 libvaladoc/api/struct.vala | 23 +++++++++++++----------
 valadoc/treebuilder.vala   | 12 ------------
 2 files changed, 13 insertions(+), 22 deletions(-)
---
diff --git a/libvaladoc/api/struct.vala b/libvaladoc/api/struct.vala
index a05544a42..983eb2a84 100644
--- a/libvaladoc/api/struct.vala
+++ b/libvaladoc/api/struct.vala
@@ -35,21 +35,24 @@ public class Valadoc.Api.Struct : TypeSymbol {
        private string? cname;
 
        public Struct (Node parent, SourceFile file, string name, Vala.SymbolAccessibility accessibility,
-                                  SourceComment? comment, string? cname, string? type_macro_name,
-                                  string? type_function_name, string? type_id, string? dup_function_cname,
-                                  string? copy_function_cname, string? destroy_function_cname,
-                                  string? free_function_cname, bool is_basic_type, Vala.Struct data)
+                                  SourceComment? comment, string? type_macro_name,
+                                  string? type_function_name, Vala.Struct data)
        {
+               bool is_basic_type = data.base_type == null
+                       && (data.is_boolean_type ()
+                       || data.is_floating_type ()
+                       || data.is_integer_type ());
+
                base (parent, file, name, accessibility, comment, type_macro_name, null, null,
                        type_function_name, is_basic_type, data);
 
-               this.dup_function_cname = dup_function_cname;
-               this.copy_function_cname = copy_function_cname;
-               this.free_function_cname = free_function_cname;
-               this.destroy_function_cname = destroy_function_cname;
+               this.dup_function_cname = Vala.get_ccode_dup_function (data);
+               this.copy_function_cname = Vala.get_ccode_copy_function (data);
+               this.free_function_cname = Vala.get_ccode_free_function (data);
+               this.destroy_function_cname = Vala.get_ccode_destroy_function (data);
 
-               this.cname = cname;
-               this.type_id = type_id;
+               this.cname = Vala.get_ccode_name (data);
+               this.type_id = Vala.get_ccode_type_id (data);
        }
 
        /**
diff --git a/valadoc/treebuilder.vala b/valadoc/treebuilder.vala
index 1c1250f74..99ca31ffa 100644
--- a/valadoc/treebuilder.vala
+++ b/valadoc/treebuilder.vala
@@ -716,25 +716,13 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
                SourceFile? file = get_source_file (element);
                SourceComment? comment = create_comment (element.comment);
 
-               bool is_basic_type = element.base_type == null
-                       && (element.is_boolean_type ()
-                       || element.is_floating_type ()
-                       || element.is_integer_type ());
-
                Struct node = new Struct (parent,
                                                                  file,
                                                                  element.name,
                                                                  element.access,
                                                                  comment,
-                                                                 Vala.get_ccode_name (element),
                                                                  get_type_macro_name (element),
                                                                  get_type_function_name (element),
-                                                                 Vala.get_ccode_type_id (element),
-                                                                 Vala.get_ccode_dup_function (element),
-                                                                 Vala.get_ccode_copy_function (element),
-                                                                 Vala.get_ccode_destroy_function (element),
-                                                                 Vala.get_ccode_free_function (element),
-                                                                 is_basic_type,
                                                                  element);
                symbol_map.set (element, node);
                parent.add_child (node);


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