[gobject-introspection/wip/transformer] major: Don't allow methods whose first argument is **



commit db74c8f09ef370cff0eab0db1a795382b1224c26
Author: Colin Walters <walters verbum org>
Date:   Mon Aug 23 16:08:09 2010 -0400

    major: Don't allow methods whose first argument is **

 giscanner/primarytransformer.py        |    6 ++++++
 tests/scanner/Regress-1.0-expected.gir |   20 +++++++++++++++-----
 2 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/giscanner/primarytransformer.py b/giscanner/primarytransformer.py
index 7bac244..d26851d 100644
--- a/giscanner/primarytransformer.py
+++ b/giscanner/primarytransformer.py
@@ -733,6 +733,12 @@ method or constructor of some type."""
                                    ast.Record, ast.Union,
                                    glibast.GLibBoxedOther)):
             return False
+
+        # A quick hack here...in the future we should catch C signature/GI signature
+        # mismatches in a general way in finaltransformer
+        if first.type.ctype.count('*') != 1:
+            return False
+
         uscored = self._uscored_identifier_for_type(first.type)
         if not subsymbol.startswith(uscored):
             return False
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 8536f88..f25947e 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -330,6 +330,21 @@ and/or use gtk-doc annotations.  -->
           </parameter>
         </parameters>
       </constructor>
+      <function name="null_out" c:identifier="regress_test_obj_null_out">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="obj"
+                     direction="out"
+                     caller-allocates="0"
+                     transfer-ownership="full"
+                     allow-none="1">
+            <doc xml:whitespace="preserve">A #RegressTestObj</doc>
+            <type name="TestObj" c:type="RegressTestObj**"/>
+          </parameter>
+        </parameters>
+      </function>
       <function name="static_method"
                 c:identifier="regress_test_obj_static_method">
         <return-value transfer-ownership="none">
@@ -408,11 +423,6 @@ case.</doc>
           <type name="none" c:type="void"/>
         </return-value>
       </method>
-      <method name="null_out" c:identifier="regress_test_obj_null_out">
-        <return-value transfer-ownership="none">
-          <type name="none" c:type="void"/>
-        </return-value>
-      </method>
       <method name="set_bare" c:identifier="regress_test_obj_set_bare">
         <return-value transfer-ownership="none">
           <type name="none" c:type="void"/>



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