From: Luca Bruno Date: Thu, 28 Jul 2011 08:36:00 +0000 (+0200) Subject: doclets/gtkdoc: Fix documenting thrown errors X-Git-Tag: 0.37.1~3^2~333 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d7c418d169282c59bdef24479b482cc31cc78f2;p=thirdparty%2Fvala.git doclets/gtkdoc: Fix documenting thrown errors Partially fixes bug 637088. --- diff --git a/src/doclets/gtkdoc/generator.vala b/src/doclets/gtkdoc/generator.vala index b12b006ec..e1a1c9d20 100644 --- a/src/doclets/gtkdoc/generator.vala +++ b/src/doclets/gtkdoc/generator.vala @@ -421,7 +421,7 @@ It is important that your GValue ho /** * Visit thrown error domains */ - private void visit_thrown_error_domain (Api.ErrorDomain edomain) { + private void visit_thrown_error_domain (Api.Node error) { // method throws error Header? param_header = null; foreach (var header in current_headers) { @@ -430,13 +430,18 @@ It is important that your GValue ho break; } } - if (param_header == null) { - add_custom_header ("error", "location to store the error occuring, or %NULL to ignore", {"error-domains %s".printf (edomain.get_cname ())}, double.MAX-1); - } else { - // assume the only annotation is error-domains - var annotation = param_header.annotations[0]; - annotation += " %s".printf (edomain.get_cname ()); - param_header.annotations[0] = annotation; + var edomain = error as Api.ErrorDomain; + if (edomain != null) { + if (param_header == null) { + add_custom_header ("error", "location to store the error occuring, or %NULL to ignore", {"error-domains %s".printf (edomain.get_cname ())}, double.MAX-1); + } else { + // assume the only annotation is error-domains + var annotation = param_header.annotations[0]; + annotation += " %s".printf (edomain.get_cname ()); + param_header.annotations[0] = annotation; + } + } else if (param_header == null) { + add_custom_header ("error", "location to store the error occuring, or %NULL to ignore", null, double.MAX-1); } } @@ -521,9 +526,9 @@ It is important that your GValue ho current_delegate = d; d.accept_children ({NodeType.FORMAL_PARAMETER, NodeType.TYPE_PARAMETER}, this); - var exceptions = d.get_children_by_type (NodeType.ERROR_DOMAIN); + var exceptions = d.get_children_by_types ({NodeType.ERROR_DOMAIN, NodeType.CLASS}); foreach (var ex in exceptions) { - visit_thrown_error_domain ((ErrorDomain) ex); + visit_thrown_error_domain (ex); } add_symbol (d.get_filename(), d.get_cname(), d.documentation); @@ -595,9 +600,9 @@ It is important that your GValue ho } m.accept_children ({NodeType.FORMAL_PARAMETER, NodeType.TYPE_PARAMETER}, this); - var exceptions = m.get_children_by_type (NodeType.ERROR_DOMAIN); + var exceptions = m.get_children_by_types ({NodeType.ERROR_DOMAIN, NodeType.CLASS}); foreach (var ex in exceptions) { - visit_thrown_error_domain ((ErrorDomain) ex); + visit_thrown_error_domain (ex); } Header error_header = null;