[gi-docgen/inherited-fixes: 1/2] generate: Fix the threshold for inherited methods




commit d13cb36182d4c9858b5b369ec29b44edd643c082
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Sep 27 11:58:02 2021 +0100

    generate: Fix the threshold for inherited methods
    
    We should not add methods until we hit the threshold: we should check
    the number of (visible) methods in ancestors and interfaces, and then
    decide whether or not to add the methods.

 gidocgen/gdgenerate.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gidocgen/gdgenerate.py b/gidocgen/gdgenerate.py
index f57107b..ce4f4db 100644
--- a/gidocgen/gdgenerate.py
+++ b/gidocgen/gdgenerate.py
@@ -205,8 +205,10 @@ def gen_index_ancestor(ancestor_type, namespace, config, md=None):
             is_hidden = config.is_hidden(ancestor_name, "method", m.name)
             if not is_hidden:
                 n_methods += 1
-            if n_methods < 24 and not is_hidden:
-                methods.append(gen_index_func(m, namespace, md))
+        if n_methods > 0 and n_methods < 24:
+            for m in ancestor.methods:
+                if not config.is_hidden(ancestor_name, "method", m.name):
+                    methods.append(gen_index_func(m, namespace, md))
         for p in ancestor.properties.values():
             if not config.is_hidden(ancestor_name, "property", p.name):
                 n_properties += 1
@@ -257,8 +259,10 @@ def gen_index_implements(iface_type, namespace, config, md=None):
             is_hidden = config.is_hidden(iface_name, "method", m.name)
             if not is_hidden:
                 n_methods += 1
-            if n_methods < 24 and not is_hidden:
-                methods.append(gen_index_func(m, namespace, md))
+        if n_methods > 0 and n_methods < 24:
+            for m in iface.methods:
+                if not config.is_hidden(iface_name, "method", m.name):
+                    methods.append(gen_index_func(m, namespace, md))
         for p in iface.properties.values():
             if not config.is_hidden(iface_name, "property", p.name):
                 n_properties += 1


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