[vala/wip/dbusgen: 145/152] dbusgen: Make sure to name changes are reversible



commit 5ed910802356de2538af6990d967ad64ebaef342
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Sep 19 18:41:47 2018 +0200

    dbusgen: Make sure to name changes are reversible

 dbusgen/valadbusparser.vala | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/dbusgen/valadbusparser.vala b/dbusgen/valadbusparser.vala
index b97b464be..b6dd359f1 100644
--- a/dbusgen/valadbusparser.vala
+++ b/dbusgen/valadbusparser.vala
@@ -295,7 +295,10 @@ public class Vala.DBusParser : CodeVisitor {
                        return;
                }
 
-               name = Vala.Symbol.camel_case_to_lower_case (name);
+               var vala_name = Vala.Symbol.camel_case_to_lower_case (name);
+               if (name == Vala.Symbol.lower_case_to_camel_case (vala_name)) {
+                       name = vala_name;
+               }
                current_node = current_method = new Method (name, dbus_module.void_type.copy (), 
get_current_src ());
                current_iface.add_method ((Method)current_method);
                ((Method)current_method).is_abstract = true;
@@ -359,7 +362,10 @@ public class Vala.DBusParser : CodeVisitor {
                        set_access = new PropertyAccessor (false, true, false, data_type, null, 
get_current_src ());
                }
 
-               name = Vala.Symbol.camel_case_to_lower_case (name);
+               var vala_name = Vala.Symbol.camel_case_to_lower_case (name);
+               if (name == Vala.Symbol.lower_case_to_camel_case (vala_name)) {
+                       name = vala_name;
+               }
                current_node = current_property = new Property (name, data_type, get_access, set_access, 
get_current_src ());
                current_property.is_abstract = true;
                current_property.access = SymbolAccessibility.PUBLIC;
@@ -477,7 +483,10 @@ public class Vala.DBusParser : CodeVisitor {
                        return;
                }
 
-               name = Vala.Symbol.camel_case_to_lower_case (name);
+               var vala_name = Vala.Symbol.camel_case_to_lower_case (name);
+               if (name == Vala.Symbol.lower_case_to_camel_case (vala_name)) {
+                       name = vala_name;
+               }
                current_node = current_method = new Signal (name, dbus_module.void_type.copy ());
                current_iface.add_signal ((Signal)current_node);
                ((Signal)current_node).access = SymbolAccessibility.PUBLIC;


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