]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Ignore duplicate standard interfaces
authorJCWasmx86 <JCWasmx86@t-online.de>
Sun, 5 Jun 2022 12:40:07 +0000 (14:40 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 29 Apr 2023 19:00:17 +0000 (21:00 +0200)
dbusgen/valadbusparser.vala
dbusgen/valadbusvariantmodule.vala

index 5eda728611ad385a69cee00231a63e72491408d4..3d7a76869088ea5fd31d40e50dec6349d5aee62d 100644 (file)
@@ -151,6 +151,18 @@ public class Vala.DBusParser : CodeVisitor {
                }
 
                string iface_name = namespace_strategy.get_name (name);
+
+               foreach (var iface in current_ns.get_interfaces ()) {
+                       // The default interfaces can occur duplicated
+                       if ((iface_name == namespace_strategy.get_name ("org.freedesktop.DBus.Peer")
+                                || iface_name == namespace_strategy.get_name ("org.freedesktop.DBus.Introspectable")
+                                || iface_name == namespace_strategy.get_name ("org.freedesktop.DBus.Properties")
+                                || iface_name == namespace_strategy.get_name ("org.freedesktop.DBus.ObjectManager")) && iface.name == iface_name) {
+                               next ();
+                               seek_end ("interface");
+                               return;
+                       }
+               }
                current_node = current_iface = new Interface (iface_name, get_current_src ());
 
                current_iface.access = SymbolAccessibility.PUBLIC;
@@ -619,6 +631,16 @@ public class Vala.DBusParser : CodeVisitor {
                next ();
        }
 
+       private void seek_end (string name) {
+               while (current_token != MarkupTokenType.END_ELEMENT || reader.name != name) {
+                       skip_element ();
+                       if (current_token == MarkupTokenType.EOF) {
+                               return;
+                       }
+               }
+               next ();
+       }
+
        private SourceReference get_current_src () {
                return new SourceReference (current_source_file, begin, end);
        }
index 404f7bb4083a1e79de291a941ce45e908162f050..436329684d49def5bbc76dc0a80eee125f38838f 100644 (file)
@@ -202,14 +202,12 @@ public class Vala.DBusVariantModule {
                                }
                        } else {
                                var element_type = get_variant_type (element);
-                               if (element != null && !(element_type is ArrayType)) {
+                               if (element != null && !(element_type is ArrayType) && element_type != null) {
                                        var array = new ArrayType (element_type, 1, null);
                                        array.value_owned = true;
                                        return array;
                                }
                        }
-               } else if (type.equal (VariantType.TUPLE)) {
-                       // TODO: Emit structure
                }
 
                if (!skipped_generation) {