[vala/wip/dbusgen: 366/390] Reuse retrieved attributes




commit 90fe8b871ddf7b3c4ee8bb878127e088ebbbfe58
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Nov 23 18:50:04 2017 +0100

    Reuse retrieved attributes

 dbusgen/valadbusparser.vala | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/dbusgen/valadbusparser.vala b/dbusgen/valadbusparser.vala
index b7dc93293..3b0ddef3b 100644
--- a/dbusgen/valadbusparser.vala
+++ b/dbusgen/valadbusparser.vala
@@ -256,31 +256,32 @@ public class Vala.DBusParser : CodeVisitor {
 
                start_element ("property");
 
-               Map<string,string> attribs = reader.get_attributes ();
-
-               if (attribs["name"] == null) {
+               string? name = reader.get_attribute ("name");
+               if (name == null) {
                        Report.error (get_current_src (), "Interface property declarations require a name 
attribute");
                        return;
                }
 
-               if (attribs["type"] == null) {
+               string? type = reader.get_attribute ("type");
+               if (type == null) {
                        Report.error (get_current_src (), "Interface property declarations require a type 
attribute");
                        return;
                }
 
-               DataType type = dbus_module.get_dbus_type (attribs["type"]);
+               DataType date_type = dbus_module.get_dbus_type (type);
 
                PropertyAccessor get_access = null;
                PropertyAccessor set_access = null;
 
-               if (attribs["access"] == "read" || attribs["access"] == "readwrite") {
-                       get_access = new PropertyAccessor (true, false, false, type, null, get_current_src 
());
+               string? access = reader.get_attribute ("access");
+               if (access == "read" || access == "readwrite") {
+                       get_access = new PropertyAccessor (true, false, false, date_type, null, 
get_current_src ());
                }
-               if (attribs["access"] == "write" || attribs["access"] == "readwrite") {
-                       set_access = new PropertyAccessor (false, true, false, type, null, get_current_src 
());
+               if (access == "write" || access == "readwrite") {
+                       set_access = new PropertyAccessor (false, true, false, date_type, null, 
get_current_src ());
                }
 
-               current_node = current_property = new Property (attribs["name"], type, get_access, 
set_access, get_current_src ());
+               current_node = current_property = new Property (name, date_type, get_access, set_access, 
get_current_src ());
                current_property.is_abstract = true;
                current_property.access = SymbolAccessibility.PUBLIC;
                current_iface.add_property (current_property);


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