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



commit 05d0d7bbc1f022c3f7fe8d67f99fccc737c3e286
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 |    6 +++---
 tests/Makefile.am            |    1 +
 tests/objects/bug788964.vala |   11 +++++++++++
 3 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 86a6474..e8ba036 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -554,7 +554,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);
@@ -620,7 +620,7 @@ public class Vala.GTypeModule : GErrorModule {
                        }
 
                        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);
 
@@ -2072,7 +2072,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 3f9f0c7..163c422 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -238,6 +238,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]