[gi-docgen/issue-117: 1/2] generate: Improve classification of pointer arguments




commit 7dc7916edeaaa2fb4511629d2670e1bfaad47789
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Nov 15 14:28:55 2021 +0000

    generate: Improve classification of pointer arguments
    
    If an argument is of a fundamental type, the direction is out or in-out,
    and it has a single pointer, then we don't need to classify it as a
    pointer argument, as it's really an out argument, and the fact that it
    uses a pointer is merely how C implements out arguments.

 gidocgen/gdgenerate.py | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gidocgen/gdgenerate.py b/gidocgen/gdgenerate.py
index 677300b..1168fe1 100644
--- a/gidocgen/gdgenerate.py
+++ b/gidocgen/gdgenerate.py
@@ -640,6 +640,8 @@ class TemplateArgument:
     def is_pointer(self):
         if self.type_cname is None:
             return False
+        if self.direction in ['out', 'inout'] and self.is_fundamental and self.type_cname.count('*') == 1:
+            return False
         return '*' in self.type_cname
 
     @property
@@ -719,6 +721,8 @@ class TemplateReturnValue:
 
     @property
     def is_pointer(self):
+        if self.type_cname is None:
+            return False
         return '*' in self.type_cname
 
 


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