gobject-introspection r556 - in trunk: giscanner tests/scanner
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r556 - in trunk: giscanner tests/scanner
- Date: Sun, 31 Aug 2008 16:39:04 +0000 (UTC)
Author: walters
Date: Sun Aug 31 16:39:04 2008
New Revision: 556
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=556&view=rev
Log:
Follow aliases when resolving constructor return types
* giscanner/glibtransformer.py: Follow aliases to ensure
we don't get a constructor returning a basic type.
* giscanner/transformer.py: Add function to follow aliases.
* tests/ Update.
Modified:
trunk/giscanner/glibtransformer.py
trunk/giscanner/transformer.py
trunk/tests/scanner/foo-expected.gir
trunk/tests/scanner/foo.h
Modified: trunk/giscanner/glibtransformer.py
==============================================================================
--- trunk/giscanner/glibtransformer.py (original)
+++ trunk/giscanner/glibtransformer.py Sun Aug 31 16:39:04 2008
@@ -319,7 +319,9 @@
if new_idx < 0:
return None
# Constructors don't return basic types
- if target_arg.type.name in type_names:
+ derefed = self._transformer.follow_aliases(target_arg.type.name,
+ self._names)
+ if derefed in type_names:
print "NOTE: Rejecting constructor returning basic: %r" \
% (func.symbol, )
return None
Modified: trunk/giscanner/transformer.py
==============================================================================
--- trunk/giscanner/transformer.py (original)
+++ trunk/giscanner/transformer.py Sun Aug 31 16:39:04 2008
@@ -490,3 +490,13 @@
return self.resolve_param_type_full(ptype, self._names)
except KeyError, e:
return ptype
+
+ def follow_aliases(self, type_name, names):
+ while True:
+ resolved = names.aliases.get(type_name)
+ if resolved:
+ (ns, alias) = resolved
+ type_name = alias.target
+ else:
+ break
+ return type_name
Modified: trunk/tests/scanner/foo-expected.gir
==============================================================================
--- trunk/tests/scanner/foo-expected.gir (original)
+++ trunk/tests/scanner/foo-expected.gir Sun Aug 31 16:39:04 2008
@@ -9,6 +9,7 @@
<namespace name="foo" shared-library="foo">
<alias name="List" target="GLib.SList" c:type="FooList"/>
<alias name="XEvent" target="none" c:type="FooXEvent"/>
+ <alias name="ObjectCookie" target="any" c:type="FooObjectCookie"/>
<interface name="Interface"
c:type="FooInterface"
glib:type-name="FooInterface"
@@ -89,6 +90,19 @@
</parameter>
</parameters>
</method>
+ <method name="new_cookie" c:identifier="foo_object_new_cookie">
+ <return-value>
+ <type name="ObjectCookie" c:type="FooObjectCookie"/>
+ </return-value>
+ <parameters>
+ <parameter name="object">
+ <type name="Object" c:type="FooObject*"/>
+ </parameter>
+ <parameter name="target">
+ <type name="string" c:type="char*"/>
+ </parameter>
+ </parameters>
+ </method>
<property name="string">
<type name="string" c:type="gchararray"/>
</property>
Modified: trunk/tests/scanner/foo.h
==============================================================================
--- trunk/tests/scanner/foo.h (original)
+++ trunk/tests/scanner/foo.h Sun Aug 31 16:39:04 2008
@@ -58,6 +58,9 @@
void foo_object_with_tdef (FooObject *object, FooList *blah);
+typedef gpointer FooObjectCookie;
+
+FooObjectCookie foo_object_new_cookie (FooObject *object, const char *target);
struct _FooSubobject
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]