[gobject-introspection/wip/transformer] Fixes for vfunc processing
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/wip/transformer] Fixes for vfunc processing
- Date: Fri, 23 Jul 2010 10:36:23 +0000 (UTC)
commit dfcf94e61d69559491be9871a4bd738b6588968f
Author: Colin Walters <walters verbum org>
Date: Fri Jul 23 03:44:57 2010 -0400
Fixes for vfunc processing
giscanner/annotationparser.py | 9 ++++++++-
giscanner/glibtransformer.py | 21 ++++++++++++++-------
2 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index 0a460ac..ab19574 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -544,9 +544,16 @@ class AnnotationApplier(object):
key = '%s::%s' % (parent.type_name, vfunc.name)
self._parse_callable(vfunc, self._blocks.get(key))
if vfunc.invoker:
+ invoker = None
+ for method in parent.methods:
+ if method.name == vfunc.invoker:
+ invoker = method
+ break
+ if not invoker:
+ return
# We normally expect annotations like (element-type) to be
# applied to the invoker.
- block = self._blocks.get(vfunc.invoker.symbol)
+ block = self._blocks.get(invoker.symbol)
self._parse_callable(vfunc, block)
def _parse_field(self, parent, field, block=None):
diff --git a/giscanner/glibtransformer.py b/giscanner/glibtransformer.py
index 10fa187..2e15fb9 100644
--- a/giscanner/glibtransformer.py
+++ b/giscanner/glibtransformer.py
@@ -698,7 +698,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(self, node):
+ def _pass3_class_interface(self, node):
"""Look for virtual methods from the class structure."""
if not node.glib_type_struct:
self._transformer.log_node_warning(node,
@@ -746,11 +746,18 @@ method or constructor of some type."""
# name+signature.
for vfunc in node.virtual_methods:
for method in node.methods:
- if (method.name != vfunc.name or
- method.retval != vfunc.retval or
- method.parameters != vfunc.parameters):
+ if method.name != vfunc.name:
continue
- vfunc.invoker = method
+ if method.retval.type != vfunc.retval.type:
+ continue
+ if len(method.parameters) != len(vfunc.parameters):
+ continue
+ for i in xrange(len(method.parameters)):
+ m_type = method.parameters[i].type
+ v_type = vfunc.parameters[i].type
+ if m_type != v_type:
+ continue
+ vfunc.invoker = method.name
def _pass3(self, node, chain):
"""Pass 3 is after we've loaded GType data and performed type
@@ -758,8 +765,8 @@ method or constructor of some type."""
if isinstance(node, Callable):
self._pass3_callable_callbacks(node)
self._pass3_callable_throws(node)
- elif isinstance(node, Class):
- self._pass3_class(node)
+ elif isinstance(node, (Class, Interface)):
+ self._pass3_class_interface(node)
def _pass3_callable_callbacks(self, node):
"""Check to see if we have anything that looks like a
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]