[gi-docgen/ebassi/parse-array: 2/5] gir: Use the array:name attribute, if one is set




commit 7bb084a1f24e3541a65c671aace1d58c9af7c7cd
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Nov 9 22:06:29 2021 +0000

    gir: Use the array:name attribute, if one is set
    
    Right now, we're use the name of the parent node, but it should be our
    fallback value.

 gidocgen/gir/parser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gidocgen/gir/parser.py b/gidocgen/gir/parser.py
index 3241ed0..08d2d93 100644
--- a/gidocgen/gir/parser.py
+++ b/gidocgen/gir/parser.py
@@ -332,7 +332,7 @@ class GirParser:
     def _parse_array(self, node: ET.Element) -> ast.Type:
         child = node.find('core:array', GI_NAMESPACES)
 
-        name = node.attrib.get('name')
+        name = child.attrib.get('name') or node.attrib.get('name')
         array_type = child.attrib.get(_cns('type'))
         attr_zero_terminated = child.attrib.get('zero-terminated')
         attr_fixed_size = child.attrib.get('fixed-size')


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