[vala/0.38] codegen: Avoid possible conflicts with internal property/signal defines



commit 3dd63f07287e99b5dc3d18e05f1d5d5a4eddf01c
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Oct 25 13:10:41 2017 +0200

    codegen: Avoid possible conflicts with internal property/signal defines
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788964

 codegen/valagtypemodule.vala |    8 ++++----
 tests/Makefile.am            |    1 +
 tests/objects/bug788964.vala |   11 +++++++++++
 3 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index e750360..aefcd08 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -553,7 +553,7 @@ public class Vala.GTypeModule : GErrorModule {
                }
 
                prop_enum = new CCodeEnum ();
-               prop_enum.add_value (new CCodeEnumValue ("%s_DUMMY_PROPERTY".printf 
(get_ccode_upper_case_name (cl, null))));
+               prop_enum.add_value (new CCodeEnumValue ("%s_0_PROPERTY".printf (get_ccode_upper_case_name 
(cl, null))));
                signal_enum = new CCodeEnum ();
                class_init_context = new EmitContext (cl);
                base_init_context = new EmitContext (cl);
@@ -565,7 +565,7 @@ public class Vala.GTypeModule : GErrorModule {
                generate_class_struct_declaration (cl, cfile);
                generate_class_private_declaration (cl, cfile);
 
-               var last_prop = "%s_LAST_PROPERTY".printf (get_ccode_upper_case_name (cl));
+               var last_prop = "%s_NUM_PROPERTIES".printf (get_ccode_upper_case_name (cl));
                if (is_gtypeinstance) {
                        cfile.add_type_declaration (prop_enum);
 
@@ -630,7 +630,7 @@ public class Vala.GTypeModule : GErrorModule {
                        prop_enum.add_value (new CCodeEnumValue (last_prop));
 
                        if (cl.get_signals ().size > 0) {
-                               var last_signal = "%s_LAST_SIGNAL".printf (get_ccode_upper_case_name (cl));
+                               var last_signal = "%s_NUM_SIGNALS".printf (get_ccode_upper_case_name (cl));
                                signal_enum.add_value (new CCodeEnumValue (last_signal));
                                cfile.add_type_declaration (signal_enum);
 
@@ -2094,7 +2094,7 @@ public class Vala.GTypeModule : GErrorModule {
                iface.accept_children (this);
 
                if (iface.get_signals ().size > 0) {
-                       var last_signal = "%s_LAST_SIGNAL".printf (get_ccode_upper_case_name (iface));
+                       var last_signal = "%s_NUM_SIGNALS".printf (get_ccode_upper_case_name (iface));
                        signal_enum.add_value (new CCodeEnumValue (last_signal));
                        cfile.add_type_declaration (signal_enum);
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9e5de12..80e1855 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -240,6 +240,7 @@ TESTS = \
        objects/bug779219.vala \
        objects/bug779955.vala \
        objects/bug783897.vala \
+       objects/bug788964.vala \
        errors/errors.vala \
        errors/bug567181.vala \
        errors/bug579101.vala \
diff --git a/tests/objects/bug788964.vala b/tests/objects/bug788964.vala
new file mode 100644
index 0000000..4865568
--- /dev/null
+++ b/tests/objects/bug788964.vala
@@ -0,0 +1,11 @@
+public class Foo : Object {
+       public signal void last ();
+}
+
+public class Bar : Object {
+       public string dummy { get; set; }
+       public string last { get; set; }
+}
+
+void main () {
+}


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