From: Rico Tzschichholz Date: Thu, 23 Nov 2017 17:50:04 +0000 (+0100) Subject: Reuse retrieved attributes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dbab26b4ee4814d4cdd468f9b7bf190cf675b1a6;p=thirdparty%2Fvala.git Reuse retrieved attributes --- 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 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);