From: Florian Brosch Date: Mon, 20 Aug 2012 22:29:10 +0000 (+0200) Subject: libvaladoc: Accept error codes in @throws X-Git-Tag: 0.37.1~3^2~137 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0613ea4287dc6744bc75ebd857b5bcb24331c0a1;p=thirdparty%2Fvala.git libvaladoc: Accept error codes in @throws --- diff --git a/src/libvaladoc/taglets/tagletthrows.vala b/src/libvaladoc/taglets/tagletthrows.vala index 6bc51e64e..2ba7fa0ce 100644 --- a/src/libvaladoc/taglets/tagletthrows.vala +++ b/src/libvaladoc/taglets/tagletthrows.vala @@ -25,7 +25,13 @@ using Gee; using Valadoc.Content; public class Valadoc.Taglets.Throws : InlineContent, Taglet, Block { + // TODO: rename public string error_domain_name { private set; get; } + + /** + * Thrown Error domain or Error code + */ + // TODO: rename public Api.Node error_domain { private set; get; } public Rule? get_parser_rule (Rule run_rule) { @@ -55,11 +61,12 @@ public class Valadoc.Taglets.Throws : InlineContent, Taglet, Block { } - // Check if the method is allowed to throw the given type: + // Check if the method is allowed to throw the given type or error code: Gee.List exceptions = container.get_children_by_types ({Api.NodeType.ERROR_DOMAIN, Api.NodeType.CLASS}, false); + Api.Item expected_error_domain = (error_domain is Api.ErrorCode)? error_domain.parent : error_domain; bool report_warning = true; foreach (Api.Node exception in exceptions) { - if (exception == error_domain || exception is Api.Class) { + if (exception == expected_error_domain || (exception is Api.Class && expected_error_domain is Api.ErrorDomain)) { report_warning = false; break; }