[vala/wip/dbusgen: 320/329] dbusgen: Make sure to name changes are reversible




commit e9b22e9ab550371f3990dba9c7e3d6df3c08e099
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 08450d90a..e265d08a8 100644
--- a/dbusgen/valadbusparser.vala
+++ b/dbusgen/valadbusparser.vala
@@ -293,7 +293,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;
@@ -357,7 +360,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;
@@ -475,7 +481,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]