[gobject-introspection: 1/2] Preserve complete_ctype when using type from annotation.



commit 4bfdc83b063bce3821b09e88e5ee3207a10259d2
Author: Tomasz Miąsko <tomasz miasko gmail com>
Date:   Fri Feb 9 00:00:00 2018 +0000

    Preserve complete_ctype when using type from annotation.
    
    When replacing type with one from user annotation we already preserve
    ctype, do the same for complete_ctype to preserve const / volatile
    qualifiers if any.
    
    Fixes issue #190.

 giscanner/maintransformer.py                                          | 1 +
 .../Regress-1.0-C-expected/Regress.annotation_set_source_file.page    | 4 ++--
 tests/scanner/Regress-1.0-expected.gir                                | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 23ed4102..275f1c08 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -330,6 +330,7 @@ class MainTransformer(object):
         # might lose the ctype from the original node.
         if type_node is not None:
             result.ctype = type_node.ctype
+            result.complete_ctype = type_node.complete_ctype
         return result
 
     def _get_position(self, func, param):
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.annotation_set_source_file.page 
b/tests/scanner/Regress-1.0-C-expected/Regress.annotation_set_source_file.page
index 2f7fb864..5d8197a2 100644
--- a/tests/scanner/Regress-1.0-C-expected/Regress.annotation_set_source_file.page
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.annotation_set_source_file.page
@@ -13,14 +13,14 @@
       </api:returns>
       <api:name>regress_annotation_set_source_file</api:name>
       <api:arg>
-        <api:type>char*</api:type>
+        <api:type>const char*</api:type>
         <api:name>fname</api:name>
       </api:arg>
     </api:function>
   </info>
   <title>regress_annotation_set_source_file</title>
   <synopsis><code mime="text/x-csrc">
-void regress_annotation_set_source_file (char* fname);
+void regress_annotation_set_source_file (const char* fname);
   </code></synopsis>
 
 
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 2e4830cf..980ad650 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -4502,7 +4502,7 @@ detection, and fixing it via annotations.</doc>
       <parameters>
         <parameter name="fname" transfer-ownership="none">
           <doc xml:space="preserve">Source file</doc>
-          <type name="filename" c:type="char*"/>
+          <type name="filename" c:type="const char*"/>
         </parameter>
       </parameters>
     </function>


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