[gobject-introspection/wip/transformer] Parse virtuals before generic callback processing



commit d935e34a4580c94842f17b966beaae4395819293
Author: Colin Walters <walters verbum org>
Date:   Fri Jul 23 05:07:22 2010 -0400

    Parse virtuals before generic callback processing

 giscanner/glibtransformer.py |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/giscanner/glibtransformer.py b/giscanner/glibtransformer.py
index 2e15fb9..b75d546 100644
--- a/giscanner/glibtransformer.py
+++ b/giscanner/glibtransformer.py
@@ -145,9 +145,11 @@ class GLibTransformer(object):
                 self._uscore_type_names[uscored] = node
 
         for node in list(self._namespace.itervalues()):
-            # Discover which toplevel functions are actually methods
             if isinstance(node, Function):
+                # Discover which toplevel functions are actually methods
                 self._pair_function(node)
+            if isinstance(node, (Class, Interface)):
+                self._pair_class_virtuals(node)
 
         self._namespace.walk(self._pass3)
 
@@ -202,6 +204,7 @@ class GLibTransformer(object):
         if isinstance(node, Interface):
             for iface in node.prerequisites:
                 self._transformer.resolve_type(iface)
+        return True
 
     def _resolve_quarks(self):
         # self._uscore_type_names is an authoritative mapping of types
@@ -698,7 +701,7 @@ method or constructor of some type."""
         pair_class.inherit_file_positions(class_struct)
         gclass_struct.is_gtype_struct_for = pair_class.create_type()
 
-    def _pass3_class_interface(self, node):
+    def _pair_class_virtuals(self, node):
         """Look for virtual methods from the class structure."""
         if not node.glib_type_struct:
             self._transformer.log_node_warning(node,
@@ -765,8 +768,7 @@ method or constructor of some type."""
         if isinstance(node, Callable):
             self._pass3_callable_callbacks(node)
             self._pass3_callable_throws(node)
-        elif isinstance(node, (Class, Interface)):
-            self._pass3_class_interface(node)
+        return True
 
     def _pass3_callable_callbacks(self, node):
         """Check to see if we have anything that looks like a
@@ -806,13 +808,12 @@ method or constructor of some type."""
         callback+user_data+GDestroyNotify set."""
         if not node.parameters:
             return
-        last_param = node.parameters.pop()
+        last_param = node.parameters[-1]
         # Checking type.name=='GLib.Error' generates false positives
         # on methods that take a 'GError *'
         if last_param.type.ctype == 'GError**':
+            node.parameters.pop()
             node.throws = True
-        else:
-            node.parameters.append(last_param)
 
     # Validation
 



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