[gi-docgen/ebassi/introspectable: 1/2] generate: Add shadows/shadowed-by metadata




commit bc7a8c51e8d22e14b2597f781a33f41877c35abd
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Feb 9 16:18:50 2022 +0000

    generate: Add shadows/shadowed-by metadata
    
    Methods and functions can shadow other symbols within the same type
    and namespace; and, in turn, can be shadowed by other symbols.
    
    We can use this information inside the templates when generating the
    documentation.

 gidocgen/gdgenerate.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
---
diff --git a/gidocgen/gdgenerate.py b/gidocgen/gdgenerate.py
index 1e4099f..397ccaa 100644
--- a/gidocgen/gdgenerate.py
+++ b/gidocgen/gdgenerate.py
@@ -835,6 +835,19 @@ class TemplateMethod:
 
         self.introspectable = method.introspectable
 
+        self.shadows = method.shadows
+        if method.shadows:
+            for m in type_.methods:
+                if m.name == method.shadows:
+                    self.shadows_symbol = m.identifier
+                    break
+        self.shadowed_by = method.shadowed_by
+        if method.shadowed_by:
+            for m in type_.methods:
+                if m.name == method.shadowed_by:
+                    self.shadowed_by_symbol = m.identifier
+                    break
+
         def transform_property_attribute(namespace, type_, method, value):
             if value in type_.properties:
                 text = f"{namespace.name}.{type_.name}:{value}"
@@ -1044,6 +1057,17 @@ class TemplateFunction:
 
         self.introspectable = func.introspectable
 
+        self.shadows = func.shadows
+        if func.shadows:
+            f = namespace.find_function(func.shadows)
+            if f is not None:
+                self.shadows_symbol = f.identifier
+        self.shadowed_by = func.shadowed_by
+        if func.shadowed_by:
+            f = namespace.find_function(func.shadowed_by)
+            if f is not None:
+                self.shadowed_by_symbol = f.identifier
+
     @property
     def c_decl(self):
         res = []


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