summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2019-07-30 12:54:56 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2019-09-04 09:32:44 +0200
commitd144372cfd690471ce9253fbff72de7b66015a72 (patch)
treec1da625881c1727ba78c2988a29d13c71316b810
parent4e695a4e374df741859651f62e9a554f55991aac (diff)
downloadvala-d144372cfd690471ce9253fbff72de7b66015a72.tar.gz
libvaladoc: Don't traverse into close circles with parent
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
-rw-r--r--libvaladoc/api/node.vala9
-rw-r--r--valadoc/tests/drivers/api-test.data.vapi1
-rw-r--r--valadoc/tests/drivers/generic-api-test.vala2
3 files changed, 11 insertions, 1 deletions
diff --git a/libvaladoc/api/node.vala b/libvaladoc/api/node.vala
index 079c7ee44..6b41e5e9e 100644
--- a/libvaladoc/api/node.vala
+++ b/libvaladoc/api/node.vala
@@ -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);
diff --git a/valadoc/tests/drivers/api-test.data.vapi b/valadoc/tests/drivers/api-test.data.vapi
index 37871f012..c23ca2979 100644
--- a/valadoc/tests/drivers/api-test.data.vapi
+++ b/valadoc/tests/drivers/api-test.data.vapi
@@ -26,6 +26,7 @@ public errordomain TestErrDomGlobal {
ERROR2;
public static void static_method ();
+ public static void static_method_error () throws TestErrDomGlobal;
}
diff --git a/valadoc/tests/drivers/generic-api-test.vala b/valadoc/tests/drivers/generic-api-test.vala
index 5d20405d6..ad99accfd 100644
--- a/valadoc/tests/drivers/generic-api-test.vala
+++ b/valadoc/tests/drivers/generic-api-test.vala
@@ -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);