[vala/wip/dbusgen: 132/137] dbusgen: Set DBus.name on symbols as needed



commit 2e200b4d2dd50cc079629d0d47ec948f7b608a37
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Mar 26 17:45:05 2019 +0100

    dbusgen: Set DBus.name on symbols as needed

 dbusgen/valadbusparser.vala | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
---
diff --git a/dbusgen/valadbusparser.vala b/dbusgen/valadbusparser.vala
index ae44ba280..816913fbe 100644
--- a/dbusgen/valadbusparser.vala
+++ b/dbusgen/valadbusparser.vala
@@ -299,16 +299,24 @@ public class Vala.DBusParser : CodeVisitor {
                        return;
                }
 
+               var needs_name = false;
                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;
+               } else {
+                       needs_name = true;
                }
+
                current_node = current_method = new Method (name, dbus_module.void_type.copy (), 
get_current_src ());
                ((Method)current_method).is_abstract = true;
                ((Method)current_method).access = SymbolAccessibility.PUBLIC;
                ((Method)current_method).add_error_type (dbus_module.gio_error_type);
                ((Method)current_method).add_error_type (dbus_module.gdbus_error_type);
 
+               if (needs_name) {
+                       current_node.set_attribute_string ("DBus", "name", name);
+               }
+
                next ();
 
                parse_method_body ();
@@ -363,14 +371,22 @@ public class Vala.DBusParser : CodeVisitor {
                        needs_signature = true;
                }
 
+               var needs_name = false;
                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;
+               } else {
+                       needs_name = true;
                }
+
                current_node = current_property = new Property (name, data_type, null, null, get_current_src 
());
                current_property.is_abstract = true;
                current_property.access = SymbolAccessibility.PUBLIC;
 
+               if (needs_name) {
+                       current_node.set_attribute_string ("DBus", "name", name);
+               }
+
                next ();
 
                while (current_token == MarkupTokenType.START_ELEMENT) {
@@ -509,13 +525,21 @@ public class Vala.DBusParser : CodeVisitor {
                        return;
                }
 
+               var needs_name = false;
                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;
+               } else {
+                       needs_name = true;
                }
+
                current_node = current_method = new Signal (name, dbus_module.void_type.copy ());
                ((Signal)current_node).access = SymbolAccessibility.PUBLIC;
 
+               if (needs_name) {
+                       current_node.set_attribute_string ("DBus", "name", name);
+               }
+
                next ();
 
                parse_method_body ();


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