[valadoc] libvaladoc: @parameter: check for existence
- From: Florian Brosch <flobrosch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [valadoc] libvaladoc: @parameter: check for existence
- Date: Fri, 27 Jan 2012 16:45:12 +0000 (UTC)
commit 921a85b1618ebc4a2f92c1c786b6b9b84f1ffb38
Author: Florian Brosch <flo brosch gmail com>
Date: Fri Jan 6 16:26:31 2012 +0100
libvaladoc: @parameter: check for existence
icons/devhelpstyle.css | 4 ++++
icons/style.css | 4 ++++
icons/wikistyle.css | 4 ++++
src/libvaladoc/html/htmlrenderer.vala | 7 ++++++-
src/libvaladoc/taglets/tagletparam.vala | 28 +++++++++++++++++++++++++++-
5 files changed, 45 insertions(+), 2 deletions(-)
---
diff --git a/icons/devhelpstyle.css b/icons/devhelpstyle.css
index c52052a..d6c9443 100644
--- a/icons/devhelpstyle.css
+++ b/icons/devhelpstyle.css
@@ -202,6 +202,10 @@ h3.main_title {
.main_parameter_table_text, .main_errordomain_table_text, .main_enum_table_text {
}
+.main_parameter_table_unknown_parameter {
+ color: GREY;
+}
+
.main_parameter_table_name, .main_errordomain_table_name, .main_enum_table_name {
vertical-align: top;
text-align: right;
diff --git a/icons/style.css b/icons/style.css
index c4b0c79..919fba6 100644
--- a/icons/style.css
+++ b/icons/style.css
@@ -217,6 +217,10 @@ h3.main_title {
.main_parameter_table_text, .main_errordomain_table_text, .main_enum_table_text {
}
+.main_parameter_table_unknown_parameter {
+ color: GREY;
+}
+
.main_parameter_table_name, .main_errordomain_table_name, .main_enum_table_name {
vertical-align: top;
text-align: right;
diff --git a/icons/wikistyle.css b/icons/wikistyle.css
index a3d8e4b..d9aab37 100644
--- a/icons/wikistyle.css
+++ b/icons/wikistyle.css
@@ -203,6 +203,10 @@ h3.main_title {
.main_parameter_table_text, .main_errordomain_table_text, .main_enum_table_text {
}
+.main_parameter_table_unknown_parameter {
+ color: GREY;
+}
+
.main_parameter_table_name, .main_errordomain_table_name, .main_enum_table_name {
vertical-align: top;
text-align: right;
diff --git a/src/libvaladoc/html/htmlrenderer.vala b/src/libvaladoc/html/htmlrenderer.vala
index 2235380..d0ea807 100755
--- a/src/libvaladoc/html/htmlrenderer.vala
+++ b/src/libvaladoc/html/htmlrenderer.vala
@@ -127,7 +127,12 @@ public class Valadoc.Html.HtmlRenderer : ContentRenderer {
taglets,
(taglet) => {
var param = taglet as Taglets.Param;
- writer.start_tag ("tr");
+ string[]? unknown_parameter_css = null;
+ if (param.parameter == null) {
+ unknown_parameter_css = {"class", "main_parameter_table_unknown_parameter"};
+ }
+
+ writer.start_tag ("tr", unknown_parameter_css);
writer.start_tag ("td", {"class", "main_parameter_table_name"}).text (param.parameter_name).end_tag ("td");
writer.start_tag ("td");
param.accept_children (this);
diff --git a/src/libvaladoc/taglets/tagletparam.vala b/src/libvaladoc/taglets/tagletparam.vala
index ed5505e..db0d962 100755
--- a/src/libvaladoc/taglets/tagletparam.vala
+++ b/src/libvaladoc/taglets/tagletparam.vala
@@ -27,6 +27,8 @@ using Valadoc.Content;
public class Valadoc.Taglets.Param : InlineContent, Taglet, Block {
public string parameter_name { internal set; get; }
+ public Api.Symbol? parameter { private set; get; }
+
public Rule? get_parser_rule (Rule run_rule) {
return Rule.seq ({
Rule.option ({ Rule.many ({ TokenType.SPACE }) }),
@@ -37,7 +39,31 @@ public class Valadoc.Taglets.Param : InlineContent, Taglet, Block {
public override void check (Api.Tree api_root, Api.Node container, ErrorReporter reporter, Settings settings) {
- // TODO check for the existence of such a parameter
+ // Check for the existence of such a parameter
+
+ this.parameter = null;
+
+ if (parameter_name == "...") {
+ Gee.List<Api.Node> params = container.get_children_by_type (Api.NodeType.FORMAL_PARAMETER, false);
+ foreach (Api.Node param in params) {
+ if (((Api.FormalParameter) param).ellipsis) {
+ this.parameter = (Api.Symbol) param;
+ break;
+ }
+ }
+ } else {
+ Gee.List<Api.Node> params = container.get_children_by_types ({Api.NodeType.FORMAL_PARAMETER, Api.NodeType.TYPE_PARAMETER}, false);
+ foreach (Api.Node param in params) {
+ if (param.name == parameter_name) {
+ this.parameter = (Api.Symbol) param;
+ break;
+ }
+ }
+ }
+
+ if (this.parameter == null) {
+ reporter.simple_warning ("%s: Unknown parameter `%s'", container.get_full_name (), parameter_name);
+ }
base.check (api_root, container, reporter, settings);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]