[vala/0.40] libvaladoc: Don't traverse into close circles with parent
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.40] libvaladoc: Don't traverse into close circles with parent
- Date: Wed, 9 Oct 2019 17:33:40 +0000 (UTC)
commit fedec474e2ce96c89899ff8b809e58454a61b111
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Jul 30 12:54:56 2019 +0200
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
libvaladoc/api/node.vala | 9 +++++++++
valadoc/tests/drivers/api-test.data.vapi | 1 +
valadoc/tests/drivers/generic-api-test.vala | 2 +-
3 files changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/libvaladoc/api/node.vala b/libvaladoc/api/node.vala
index edea58d7a..0ec5fda4f 100644
--- a/libvaladoc/api/node.vala
+++ b/libvaladoc/api/node.vala
@@ -118,6 +118,9 @@ public abstract class Valadoc.Api.Node : Item, Browsable, 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, Browsable, 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, Browsable, 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 0e070e882..6448283ef 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]