[vala/staging] libvaladoc/html: Don't sort struct fields to keep their original order



commit 57b8d77db295d3593addedf24d5719c91c97f766
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Fri Jan 15 17:00:52 2021 +0100

    libvaladoc/html: Don't sort struct fields to keep their original order
    
    This follows their special handling done in Codewriter.visit_struct().
    
    In addition to a336d75586acb534aff55ca86425eb8f3aa45de4

 libvaladoc/html/basicdoclet.vala | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/libvaladoc/html/basicdoclet.vala b/libvaladoc/html/basicdoclet.vala
index 46578c28f..66f45338c 100644
--- a/libvaladoc/html/basicdoclet.vala
+++ b/libvaladoc/html/basicdoclet.vala
@@ -983,7 +983,10 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
        protected void write_children (Api.Node node, Api.NodeType type, string type_string, Api.Node? 
container) {
                var children = node.get_children_by_type (type);
                if (children.size > 0) {
-                       children.sort ((CompareDataFunc) Api.Node.compare_to);
+                       // Follow Vala.Codewriter.visit_struct() and don't sort struct fields
+                       if (!(node is Api.Struct && type == Api.NodeType.FIELD)) {
+                               children.sort ((CompareDataFunc) Api.Node.compare_to);
+                       }
                        writer.start_tag ("h3", {"class", css_title})
                                .text (type_string)
                                .text (":")


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]