element.accept_children (this);
taglets = element.find_taglets ((Api.Node) _container, typeof (Taglets.Param));
+ taglets.sort ((_a, _b) => {
+ Taglets.Param a = _a as Taglets.Param;
+ Taglets.Param b = _b as Taglets.Param;
+
+ if (a.position < 0 && b.position < 0) {
+ int cmp = a.parameter_name.ascii_casecmp (b.parameter_name);
+ if (cmp == 0) {
+ return 0;
+ }
+
+ if (a.parameter_name == "...") {
+ return 1;
+ }
+
+ if (b.parameter_name == "...") {
+ return -1;
+ }
+
+ return cmp;
+ }
+
+ if (a.position < 0) {
+ return 1;
+ }
+
+ if (b.position < 0) {
+ return -1;
+ }
+
+ return a.position - b.position;
+ });
+
write_taglets (
() => {
writer.start_tag ("h2", {"class", "main_title"}).text ("Parameters:").end_tag ("h2");
public class Valadoc.Taglets.Param : InlineContent, Taglet, Block {
public string parameter_name { internal set; get; }
- public Api.Symbol? parameter { private set; get; }
+ public weak Api.Symbol? parameter { private set; get; }
+
+ public int position { private set; get; default = -1; }
public Rule? get_parser_rule (Rule run_rule) {
return Rule.seq ({
public override void check (Api.Tree api_root, Api.Node container, ErrorReporter reporter, Settings settings) {
// Check for the existence of such a parameter
-
this.parameter = null;
if (parameter_name == "...") {
foreach (Api.Node param in params) {
if (((Api.FormalParameter) param).ellipsis) {
this.parameter = (Api.Symbol) param;
+ this.position = params.size - 1;
break;
}
}
} else {
Gee.List<Api.Node> params = container.get_children_by_types ({Api.NodeType.FORMAL_PARAMETER, Api.NodeType.TYPE_PARAMETER}, false);
+ int pos = 0;
+
foreach (Api.Node param in params) {
if (param.name == parameter_name) {
this.parameter = (Api.Symbol) param;
+ this.position = pos;
break;
}
+
+ pos++;
}
}