]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Reuse retrieved attributes
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 23 Nov 2017 17:50:04 +0000 (18:50 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 29 Apr 2023 19:00:17 +0000 (21:00 +0200)
dbusgen/valadbusparser.vala

index b7dc932936827768eb5867bf1b343e03a6a98048..3b0ddef3b1b480893753bda6f89ebd07bfd8af16 100644 (file)
@@ -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);