[vala/wip/abi: 9/9] codegen: Add public/private separator comments to type/instance structs



commit db01fb8d4a165a96d58ba85037633c6008777708
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Jan 17 13:09:06 2018 +0100

    codegen: Add public/private separator comments to type/instance structs
    
    https://bugzilla.gnome.org/show_bug.cgi?id=789069

 codegen/valagtypemodule.vala |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 1a304ba..f5a7223 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -225,6 +225,11 @@ public class Vala.GTypeModule : GErrorModule {
                        instance_struct.add_field ("volatile int", "ref_count");
                }
 
+               if (context.abi_stability) {
+                       // add "/*< public >*/" separator
+                       instance_struct.add_comment ("< public >");
+               }
+
                if (is_gtypeinstance) {
                        decl_space.add_type_declaration (new CCodeTypeDefinition ("struct %sPrivate".printf 
(instance_struct.name), new CCodeVariableDeclarator ("%sPrivate".printf (get_ccode_name (cl)))));
 
@@ -237,6 +242,11 @@ public class Vala.GTypeModule : GErrorModule {
                                type_struct.add_field ("%sClass".printf (get_ccode_name (cl.base_class)), 
"parent_class");
                        }
 
+                       if (context.abi_stability) {
+                               // add "/*< public >*/" separator
+                               type_struct.add_comment ("< public >");
+                       }
+
                        if (is_fundamental) {
                                type_struct.add_field ("void", "(*finalize) (%s *self)".printf 
(get_ccode_name (cl)));
                        }
@@ -283,6 +293,12 @@ public class Vala.GTypeModule : GErrorModule {
                        }
                }
 
+               if (context.abi_stability) {
+                       // add "/*< private >*/" separator
+                       instance_struct.add_comment ("< private >");
+                       type_struct.add_comment ("< private >");
+               }
+
                if (cl.is_compact && cl.base_class == null && !has_struct_member) {
                        // add dummy member, C doesn't allow empty structs
                        instance_struct.add_field ("int", "dummy");
@@ -2075,6 +2091,11 @@ public class Vala.GTypeModule : GErrorModule {
 
                type_struct.add_field ("GTypeInterface", "parent_iface");
 
+               if (context.abi_stability) {
+                       // add "/*< public >*/" separator
+                       type_struct.add_comment ("< public >");
+               }
+
                if (iface.get_attribute ("GenericAccessors") != null) {
                        foreach (TypeParameter p in iface.get_type_parameters ()) {
                                string method_name = "get_%s_type".printf (p.name.down ());
@@ -2176,6 +2197,11 @@ public class Vala.GTypeModule : GErrorModule {
                        }
                }
 
+               if (context.abi_stability) {
+                       // add "/*< private >*/" separator
+                       type_struct.add_comment ("< private >");
+               }
+
                decl_space.add_type_definition (type_struct);
 
                var type_fun = new InterfaceRegisterFunction (iface);


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