[gobject-introspection] scanner: Make sure that vfuncs made to the GIR



commit d6c8a24095de9ab26d9d5d22974027a31918013a
Author: Tomeu Vizoso <tomeu vizoso collabora co uk>
Date:   Fri Jan 7 17:15:52 2011 +0100

    scanner: Make sure that vfuncs made to the GIR
    
    * don't skip those associated to a signal
    * don't warn if it doesn't have an invoker
    
    https://bugzilla.gnome.org/show_bug.cgi?id=637215

 giscanner/introspectablepass.py    |   10 ----------
 giscanner/maintransformer.py       |   13 -------------
 tests/scanner/Foo-1.0-expected.gir |    5 +++++
 3 files changed, 5 insertions(+), 23 deletions(-)
---
diff --git a/giscanner/introspectablepass.py b/giscanner/introspectablepass.py
index 4b35f7d..36d70b2 100644
--- a/giscanner/introspectablepass.py
+++ b/giscanner/introspectablepass.py
@@ -38,14 +38,6 @@ class IntrospectablePass(object):
         self._namespace.walk(self._introspectable_callable_analysis)
         self._namespace.walk(self._introspectable_pass3)
 
-    def _interface_vfunc_check(self, node, stack):
-        if isinstance(node, ast.Interface):
-            for vfunc in node.virtual_methods:
-                if not vfunc.invoker:
-                    message.warn_node(vfunc,
-"""Virtual function %r has no known invoker""" % (vfunc.name, ),
-                    context=node)
-
     def _parameter_warning(self, parent, param, text, position=None):
         # Suppress VFunctions and Callbacks warnings for now
         # they cause more problems then they are worth
@@ -183,8 +175,6 @@ class IntrospectablePass(object):
     def _analyze_node(self, obj, stack):
         if obj.skip:
             return False
-        # Combine one-pass checks here
-        self._interface_vfunc_check(obj, stack)
         # Our first pass for scriptability
         if isinstance(obj, ast.Callable):
             for param in obj.parameters:
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index bafff60..0868d78 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -1035,10 +1035,6 @@ method or constructor of some type."""
             if isinstance(field, ast.Field):
                 field.writable = False
 
-        # Loop through fields to determine which are virtual
-        # functions and which are signal slots by
-        # assuming everything that doesn't share a name
-        # with a known signal is a virtual slot.
         for field in class_struct.fields:
             if not isinstance(field.anonymous_node, ast.Callback):
                 continue
@@ -1049,15 +1045,6 @@ method or constructor of some type."""
             firstparam_type = callback.parameters[0].type
             if firstparam_type != node_type:
                 continue
-            # Also double check we don't have a signal with this
-            # name.
-            matched_signal = False
-            for signal in node.signals:
-                if signal.name.replace('-', '_') == callback.name:
-                    matched_signal = True
-                    break
-            if matched_signal:
-                continue
             vfunc = ast.VFunction.from_callback(callback)
             vfunc.instance_parameter = callback.parameters[0]
             vfunc.inherit_file_positions(callback)
diff --git a/tests/scanner/Foo-1.0-expected.gir b/tests/scanner/Foo-1.0-expected.gir
index 378852e..e527cad 100644
--- a/tests/scanner/Foo-1.0-expected.gir
+++ b/tests/scanner/Foo-1.0-expected.gir
@@ -664,6 +664,11 @@ exposed to language bindings.</doc>
                glib:get-type="foo_sub_interface_get_type"
                glib:type-struct="SubInterfaceIface">
       <prerequisite name="Interface"/>
+      <virtual-method name="destroy_event">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </virtual-method>
       <virtual-method name="do_bar" invoker="do_bar">
         <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]