]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
libvaladoc: Don't traverse into close circles with parent
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 30 Jul 2019 10:54:56 +0000 (12:54 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 4 Sep 2019 07:32:44 +0000 (09:32 +0200)
SymbolResolver.resolve_thrown_list() adds error-type nodes which are
allowed to be NodeType.ERROR_DOMAIN and NodeType.CLASS.

This can result in a cycle on invoking Node.accept_all_children(),
Node.parse_comments() or Node.check_comments()

Fixes https://gitlab.gnome.org/GNOME/vala/issues/829

libvaladoc/api/node.vala
valadoc/tests/drivers/api-test.data.vapi
valadoc/tests/drivers/generic-api-test.vala

index 079c7ee442c3359f2be136e831337da4190aed57..6b41e5e9edacdd68961e000a03a97befed02796f 100644 (file)
@@ -118,6 +118,9 @@ public abstract class Valadoc.Api.Node : Item, Documentation {
                do_document = true;
 
                foreach (Node node in per_name_children.get_values ()) {
+                       if (this.parent == node) {
+                               continue;
+                       }
                        if (node.is_browsable (settings)) {
                                node.parse_comments (settings, parser);
                        }
@@ -130,6 +133,9 @@ public abstract class Valadoc.Api.Node : Item, Documentation {
        internal override void check_comments (Settings settings, DocumentationParser parser) {
 
                foreach (Node node in per_name_children.get_values ()) {
+                       if (this.parent == node) {
+                               continue;
+                       }
                        if (node.is_browsable (settings)) {
                                node.check_comments (settings, parser);
                        }
@@ -277,6 +283,9 @@ public abstract class Valadoc.Api.Node : Item, Documentation {
         */
        public void accept_all_children (Visitor visitor, bool filtered = true) {
                foreach (Vala.List<Node> children in per_type_children.get_values ()) {
+                       if (this.parent == children[0]) {
+                               continue;
+                       }
                        foreach (Node node in children) {
                                if (node.do_document || !filtered) {
                                        node.accept (visitor);
index 37871f0129c31ebd06dda1e520ab1b4a154b3b0f..c23ca2979d57c1fdcf5fc36830c9b290797cfa50 100644 (file)
@@ -26,6 +26,7 @@ public errordomain TestErrDomGlobal {
        ERROR2;
 
        public static void static_method ();
+       public static void static_method_error () throws TestErrDomGlobal;
 }
 
 
index 5d20405d66deedb76c3fcf6eb6cb52e18ddce86e..ad99accfdfe66ff0eacf0cda1f2b371bd410d4c9 100644 (file)
@@ -258,7 +258,7 @@ public static void test_erroromain_global (Api.ErrorDomain? err, Api.Package pkg
 
 
        Vala.List<Api.Node> methods = err.get_children_by_type (Api.NodeType.STATIC_METHOD, false);
-       assert (methods.size == 1);
+       assert (methods.size == 2);
 
        Api.Method method = methods.get (0) as Api.Method;
        assert (method != null);