[gobject-introspection] Revert "[scanner] Revert static method pairing"



commit 94c627ea578572bc91c596cae3624d241b1c1f99
Author: Johan Dahlin <johan gnome org>
Date:   Tue Sep 7 12:14:19 2010 -0300

    Revert "[scanner] Revert static method pairing"
    
    This reverts commit 144cb10d51888a9565721088d2b61794468742e9.

 giscanner/maintransformer.py           |    9 +-
 tests/scanner/Foo-1.0-expected.gir     |   70 +++++++-------
 tests/scanner/Regress-1.0-expected.gir |  165 ++++++++++++++++----------------
 3 files changed, 119 insertions(+), 125 deletions(-)
---
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index cd6f8e9..dc09ae2 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -800,12 +800,9 @@ method or constructor of some type."""
         if not isinstance(node, (ast.Class, ast.Interface,
                                  ast.Record, ast.Union, glibast.GLibBoxedOther)):
             return False
-
-        # FIXME: https://bugzilla.gnome.org/show_bug.cgi?id=572408
-        #self._namespace.float(func)
-        #func.name = funcname
-        #node.static_methods.append(func)
-        return True
+        self._namespace.float(func)
+        func.name = funcname
+        node.static_methods.append(func)
 
     def _pair_constructor(self, func, subsymbol):
         if not (func.symbol.find('_new_') >= 0 or func.symbol.endswith('_new')):
diff --git a/tests/scanner/Foo-1.0-expected.gir b/tests/scanner/Foo-1.0-expected.gir
index 6bf904b..105de42 100644
--- a/tests/scanner/Foo-1.0-expected.gir
+++ b/tests/scanner/Foo-1.0-expected.gir
@@ -318,6 +318,19 @@ and/or use gtk-doc annotations.  -->
           <type name="Object" c:type="FooObject*"/>
         </return-value>
       </constructor>
+      <function name="get_default" c:identifier="foo_object_get_default">
+        <doc xml:whitespace="preserve">This function is intended to match clutter_stage_get_default which
+uses a C sugar return type.</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">The global #FooSubobject</doc>
+          <type name="Subobject"/>
+        </return-value>
+      </function>
+      <function name="static_meth" c:identifier="foo_object_static_meth">
+        <return-value transfer-ownership="none">
+          <type name="gint" c:type="int"/>
+        </return-value>
+      </function>
       <virtual-method name="read_fn" invoker="read">
         <doc xml:whitespace="preserve">Read some stuff.</doc>
         <return-value transfer-ownership="none">
@@ -563,6 +576,27 @@ and/or use gtk-doc annotations.  -->
           </parameter>
         </parameters>
       </method>
+      <function name="new" c:identifier="foo_rectangle_new" introspectable="0">
+        <doc xml:whitespace="preserve">This is a C convenience constructor; we have to (skip)
+it because it's not a boxed type.</doc>
+        <return-value>
+          <type name="Rectangle" c:type="FooRectangle*"/>
+        </return-value>
+        <parameters>
+          <parameter name="x" transfer-ownership="none">
+            <type name="gint" c:type="int"/>
+          </parameter>
+          <parameter name="y" transfer-ownership="none">
+            <type name="gint" c:type="int"/>
+          </parameter>
+          <parameter name="width" transfer-ownership="none">
+            <type name="gint" c:type="int"/>
+          </parameter>
+          <parameter name="height" transfer-ownership="none">
+            <type name="gint" c:type="int"/>
+          </parameter>
+        </parameters>
+      </function>
     </record>
     <constant name="SUCCESS_INT" value="4408">
       <type name="gint" c:type="gint"/>
@@ -907,42 +941,6 @@ exposed to language bindings.</doc>
         </parameter>
       </parameters>
     </function>
-    <function name="object_get_default" c:identifier="foo_object_get_default">
-      <doc xml:whitespace="preserve">This function is intended to match clutter_stage_get_default which
-uses a C sugar return type.</doc>
-      <return-value transfer-ownership="none">
-        <doc xml:whitespace="preserve">The global #FooSubobject</doc>
-        <type name="Subobject"/>
-      </return-value>
-    </function>
-    <function name="object_static_meth" c:identifier="foo_object_static_meth">
-      <return-value transfer-ownership="none">
-        <type name="gint" c:type="int"/>
-      </return-value>
-    </function>
-    <function name="rectangle_new"
-              c:identifier="foo_rectangle_new"
-              introspectable="0">
-      <doc xml:whitespace="preserve">This is a C convenience constructor; we have to (skip)
-it because it's not a boxed type.</doc>
-      <return-value>
-        <type name="Rectangle" c:type="FooRectangle*"/>
-      </return-value>
-      <parameters>
-        <parameter name="x" transfer-ownership="none">
-          <type name="gint" c:type="int"/>
-        </parameter>
-        <parameter name="y" transfer-ownership="none">
-          <type name="gint" c:type="int"/>
-        </parameter>
-        <parameter name="width" transfer-ownership="none">
-          <type name="gint" c:type="int"/>
-        </parameter>
-        <parameter name="height" transfer-ownership="none">
-          <type name="gint" c:type="int"/>
-        </parameter>
-      </parameters>
-    </function>
     <function name="skip_me" c:identifier="foo_skip_me" introspectable="0">
       <doc xml:whitespace="preserve">Does something that's only interesting from C and should not be
 exposed to language bindings.</doc>
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index e604a7b..4014e5e 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -330,6 +330,46 @@ 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">
+          <type name="gdouble" c:type="double"/>
+        </return-value>
+        <parameters>
+          <parameter name="x" transfer-ownership="none">
+            <type name="gint" c:type="int"/>
+          </parameter>
+        </parameters>
+      </function>
+      <function name="static_method_callback"
+                c:identifier="regress_test_obj_static_method_callback">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="callback"
+                     transfer-ownership="none"
+                     allow-none="1"
+                     scope="call">
+            <type name="TestCallback" c:type="RegressTestCallback"/>
+          </parameter>
+        </parameters>
+      </function>
       <virtual-method name="matrix" invoker="do_matrix">
         <doc xml:whitespace="preserve">This method is virtual.  Notably its name differs from the virtual
 slot name, which makes it useful for testing bindings handle this
@@ -603,6 +643,12 @@ case.</doc>
           </parameter>
         </parameters>
       </method>
+      <function name="const_return"
+                c:identifier="regress_test_simple_boxed_a_const_return">
+        <return-value transfer-ownership="none">
+          <type name="TestSimpleBoxedA" c:type="RegressTestSimpleBoxedA*"/>
+        </return-value>
+      </function>
     </record>
     <record name="TestSimpleBoxedB"
             c:type="RegressTestSimpleBoxedB"
@@ -724,6 +770,42 @@ case.</doc>
           <type name="TestWi8021x" c:type="RegressTestWi8021x*"/>
         </return-value>
       </constructor>
+      <function name="get_testbool"
+                c:identifier="regress_test_wi_802_1x_get_testbool">
+        <return-value transfer-ownership="none">
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="obj" transfer-ownership="none">
+            <type name="TestWi8021x" c:type="RegressTestWi8021x*"/>
+          </parameter>
+        </parameters>
+      </function>
+      <function name="set_testbool"
+                c:identifier="regress_test_wi_802_1x_set_testbool">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="obj" transfer-ownership="none">
+            <type name="TestWi8021x" c:type="RegressTestWi8021x*"/>
+          </parameter>
+          <parameter name="v" transfer-ownership="none">
+            <type name="gboolean" c:type="gboolean"/>
+          </parameter>
+        </parameters>
+      </function>
+      <function name="static_method"
+                c:identifier="regress_test_wi_802_1x_static_method">
+        <return-value transfer-ownership="none">
+          <type name="gint" c:type="int"/>
+        </return-value>
+        <parameters>
+          <parameter name="x" transfer-ownership="none">
+            <type name="gint" c:type="int"/>
+          </parameter>
+        </parameters>
+      </function>
       <property name="testbool" writable="1" transfer-ownership="none">
         <type name="gboolean"/>
       </property>
@@ -1862,47 +1944,6 @@ call and can be released on return.</doc>
         </parameter>
       </parameters>
     </function>
-    <function name="test_obj_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="test_obj_static_method"
-              c:identifier="regress_test_obj_static_method">
-      <return-value transfer-ownership="none">
-        <type name="gdouble" c:type="double"/>
-      </return-value>
-      <parameters>
-        <parameter name="x" transfer-ownership="none">
-          <type name="gint" c:type="int"/>
-        </parameter>
-      </parameters>
-    </function>
-    <function name="test_obj_static_method_callback"
-              c:identifier="regress_test_obj_static_method_callback">
-      <return-value transfer-ownership="none">
-        <type name="none" c:type="void"/>
-      </return-value>
-      <parameters>
-        <parameter name="callback"
-                   transfer-ownership="none"
-                   allow-none="1"
-                   scope="call">
-          <type name="TestCallback" c:type="RegressTestCallback"/>
-        </parameter>
-      </parameters>
-    </function>
     <function name="test_short" c:identifier="regress_test_short">
       <return-value transfer-ownership="none">
         <type name="gshort" c:type="gshort"/>
@@ -1913,12 +1954,6 @@ call and can be released on return.</doc>
         </parameter>
       </parameters>
     </function>
-    <function name="test_simple_boxed_a_const_return"
-              c:identifier="regress_test_simple_boxed_a_const_return">
-      <return-value transfer-ownership="none">
-        <type name="TestSimpleBoxedA" c:type="RegressTestSimpleBoxedA*"/>
-      </return-value>
-    </function>
     <function name="test_simple_callback"
               c:identifier="regress_test_simple_callback">
       <return-value transfer-ownership="none">
@@ -2391,41 +2426,5 @@ call and can be released on return.</doc>
         </parameter>
       </parameters>
     </function>
-    <function name="test_wi_802_1x_get_testbool"
-              c:identifier="regress_test_wi_802_1x_get_testbool">
-      <return-value transfer-ownership="none">
-        <type name="gboolean" c:type="gboolean"/>
-      </return-value>
-      <parameters>
-        <parameter name="obj" transfer-ownership="none">
-          <type name="TestWi8021x" c:type="RegressTestWi8021x*"/>
-        </parameter>
-      </parameters>
-    </function>
-    <function name="test_wi_802_1x_set_testbool"
-              c:identifier="regress_test_wi_802_1x_set_testbool">
-      <return-value transfer-ownership="none">
-        <type name="none" c:type="void"/>
-      </return-value>
-      <parameters>
-        <parameter name="obj" transfer-ownership="none">
-          <type name="TestWi8021x" c:type="RegressTestWi8021x*"/>
-        </parameter>
-        <parameter name="v" transfer-ownership="none">
-          <type name="gboolean" c:type="gboolean"/>
-        </parameter>
-      </parameters>
-    </function>
-    <function name="test_wi_802_1x_static_method"
-              c:identifier="regress_test_wi_802_1x_static_method">
-      <return-value transfer-ownership="none">
-        <type name="gint" c:type="int"/>
-      </return-value>
-      <parameters>
-        <parameter name="x" transfer-ownership="none">
-          <type name="gint" c:type="int"/>
-        </parameter>
-      </parameters>
-    </function>
   </namespace>
 </repository>



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