[gobject-introspection] When doing type resolution on a string, treat it as its own ctype
- From: Colin Walters <walters src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gobject-introspection] When doing type resolution on a string, treat it as its own ctype
- Date: Fri, 23 Oct 2009 03:55:30 +0000 (UTC)
commit 9fe8f41bacef14f08d4d30528725fa920dc7e49a
Author: Colin Walters <walters verbum org>
Date: Thu Oct 22 23:53:37 2009 -0400
When doing type resolution on a string, treat it as its own ctype
Calling _resolve_param_type on a string instead of Node is fairly unusual,
and (as far as I could see) basically only happened in the Array processing
code. We were passing None as the ctype in this case, but we might as well
try using the name as a ctype too.
This fixes using GCallback (and in general any item in an array that comes
from an included gir).
giscanner/transformer.py | 2 +-
tests/scanner/foo-1.0-expected.gir | 5 +++++
tests/scanner/foo-1.0-expected.tgir | 5 +++++
tests/scanner/foo.h | 3 +++
4 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index bacdfab..86a2114 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -667,7 +667,7 @@ class Transformer(object):
self.ctype_of(ptype),
names, **kwargs)
elif isinstance(ptype, basestring):
- return self.resolve_type_name_full(ptype, None, names, **kwargs)
+ return self.resolve_type_name_full(ptype, ptype, names, **kwargs)
else:
raise AssertionError("Unhandled param: %r" % (ptype, ))
return ptype
diff --git a/tests/scanner/foo-1.0-expected.gir b/tests/scanner/foo-1.0-expected.gir
index 5eae4cd..24e9fbb 100644
--- a/tests/scanner/foo-1.0-expected.gir
+++ b/tests/scanner/foo-1.0-expected.gir
@@ -494,6 +494,11 @@ uses a C sugar return type.">
</parameter>
</parameters>
</callback>
+ <field name="_reserved">
+ <array zero-terminated="0" c:type="GCallback" fixed-size="4">
+ <type name="GObject.Callback"/>
+ </array>
+ </field>
</record>
<constant name="PIE_IS_TASTY" value="3.14159">
<type name="double"/>
diff --git a/tests/scanner/foo-1.0-expected.tgir b/tests/scanner/foo-1.0-expected.tgir
index 81ebd02..2de826b 100644
--- a/tests/scanner/foo-1.0-expected.tgir
+++ b/tests/scanner/foo-1.0-expected.tgir
@@ -351,6 +351,11 @@
<field name="parent_class">
<type name="GObject.ObjectClass"/>
</field>
+ <field name="_reserved">
+ <array fixed-size="4">
+ <type name="GObject.Callback"/>
+ </array>
+ </field>
</record>
<constant name="PIE_IS_TASTY" value="3.141590">
<type name="double"/>
diff --git a/tests/scanner/foo.h b/tests/scanner/foo.h
index 2e018ce..7c2afe6 100644
--- a/tests/scanner/foo.h
+++ b/tests/scanner/foo.h
@@ -87,6 +87,9 @@ struct _FooObjectClass
/* Intended to match GFile */
void (*read_fn) (FooObject *object, int offset, int length);
+
+ /* Test reserved stuff */
+ GCallback _reserved[4];
};
gint foo_init (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]