[gobject-introspection] scanner: allow GObject.Object as a superclass return type
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] scanner: allow GObject.Object as a superclass return type
- Date: Thu, 13 Oct 2011 17:02:23 +0000 (UTC)
commit 52e12815dc33af5dab95c08d29396c48ed8055c9
Author: Dan Winship <danw gnome org>
Date: Thu Oct 13 12:21:22 2011 -0400
scanner: allow GObject.Object as a superclass return type
6172c268 made the scanner think GObject* wasn't a superclass of its
subclasses. Fix that.
https://bugzilla.gnome.org/show_bug.cgi?id=661677
giscanner/maintransformer.py | 2 +-
tests/scanner/Foo-1.0-expected.gir | 5 +++++
tests/scanner/foo.c | 12 ++++++++++++
tests/scanner/foo.h | 3 ++-
4 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index a921ad4..5b1ffb7 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -1166,7 +1166,7 @@ method or constructor of some type."""
parent = self._transformer.lookup_typenode(parent.parent)
else:
parent = None
- if parent is None or parent.gi_name == 'GObject.Object':
+ if parent is None:
message.warn_node(func,
"Return value is not superclass for constructor; "
"symbol=%r constructed=%r return=%r" % (
diff --git a/tests/scanner/Foo-1.0-expected.gir b/tests/scanner/Foo-1.0-expected.gir
index b8dc33f..826d676 100644
--- a/tests/scanner/Foo-1.0-expected.gir
+++ b/tests/scanner/Foo-1.0-expected.gir
@@ -366,6 +366,11 @@ and/or use gtk-doc annotations. -->
<type name="Object" c:type="FooObject*"/>
</return-value>
</constructor>
+ <constructor name="new_as_super" c:identifier="foo_object_new_as_super">
+ <return-value transfer-ownership="full">
+ <type name="GObject.Object" c:type="GObject*"/>
+ </return-value>
+ </constructor>
<function name="a_global_method"
c:identifier="foo_object_a_global_method">
<return-value transfer-ownership="none">
diff --git a/tests/scanner/foo.c b/tests/scanner/foo.c
index 5456640..3e15444 100644
--- a/tests/scanner/foo.c
+++ b/tests/scanner/foo.c
@@ -226,6 +226,18 @@ foo_object_init (FooObject *object)
}
+FooObject *
+foo_object_new (void)
+{
+ return g_object_new (FOO_TYPE_OBJECT, NULL);
+}
+
+GObject *
+foo_object_new_as_super (void)
+{
+ return g_object_new (FOO_TYPE_OBJECT, NULL);
+}
+
/**
* foo_object_external_type:
* @object: a #FooObject
diff --git a/tests/scanner/foo.h b/tests/scanner/foo.h
index bd50221..4b20ed7 100644
--- a/tests/scanner/foo.h
+++ b/tests/scanner/foo.h
@@ -113,8 +113,9 @@ struct _FooObjectClass
gint foo_init (void);
GType foo_object_get_type (void) G_GNUC_CONST;
-FooObject* foo_object_new ();
+FooObject* foo_object_new (void);
UtilityObject* foo_object_external_type (FooObject *object);
+GObject* foo_object_new_as_super (void);
void foo_object_various (FooObject *object, void *data, GType some_type);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]