gobject-introspection r795 - in trunk: giscanner tests/scanner
- From: tko svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r795 - in trunk: giscanner tests/scanner
- Date: Thu, 23 Oct 2008 17:40:29 +0000 (UTC)
Author: tko
Date: Thu Oct 23 17:40:29 2008
New Revision: 795
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=795&view=rev
Log:
deduce transfer-ownership from GTypes
* giscanner/glibtransformer.py (_adjust_transfer):
* tests/scanner/foo-1.0-expected.gir:
* tests/scanner/foo-1.0-expected.tgir: deduce
transfer-ownership from GTypes
Modified:
trunk/giscanner/glibtransformer.py
trunk/tests/scanner/foo-1.0-expected.gir
trunk/tests/scanner/foo-1.0-expected.tgir
Modified: trunk/giscanner/glibtransformer.py
==============================================================================
--- trunk/giscanner/glibtransformer.py (original)
+++ trunk/giscanner/glibtransformer.py Thu Oct 23 17:40:29 2008
@@ -781,6 +781,7 @@
def _adjust_transfer(self, param):
# Do GLib/GObject-specific type transformations here
+ transfer = None
is_object = None
if hasattr(param.type, '_gtype'):
ftype = cgobject.type_fundamental(param.type._gtype)
@@ -789,6 +790,17 @@
is_object = ftype in [cgobject.TYPE_OBJECT,
cgobject.TYPE_INTERFACE]
+ if ftype in [cgobject.TYPE_OBJECT,
+ cgobject.TYPE_INTERFACE,
+ cgobject.TYPE_STRING,
+ cgobject.TYPE_BOXED,
+ cgobject.TYPE_PARAM]:
+ transfer = 'full'
+ else:
+ # if type is a cgobject.TYPE_POINTER we could require direction
+ # and transfer-ownership annotations
+ transfer = 'none'
+
if is_object is None:
is_object = (param.type.name == 'GObject.Object' or
(self._namespace_name == 'GObject' and
@@ -802,6 +814,8 @@
if param.transfer is None or param.transfer_inferred:
if is_out and is_object:
param.transfer = 'full'
+ elif transfer is not None:
+ param.transfer = transfer
def _adjust_throws(self, func):
if func.parameters == []:
Modified: trunk/tests/scanner/foo-1.0-expected.gir
==============================================================================
--- trunk/tests/scanner/foo-1.0-expected.gir (original)
+++ trunk/tests/scanner/foo-1.0-expected.gir Thu Oct 23 17:40:29 2008
@@ -153,14 +153,14 @@
</parameters>
</callback>
<glib:signal name="signal">
- <return-value>
+ <return-value transfer-ownership="full">
<type name="utf8" c:type="gchararray"/>
</return-value>
<parameters>
- <parameter name="object">
+ <parameter name="object" transfer-ownership="full">
<type name="GObject.Object" c:type="GObject"/>
</parameter>
- <parameter name="p0">
+ <parameter name="p0" transfer-ownership="none">
<type name="any" c:type="gpointer"/>
</parameter>
</parameters>
Modified: trunk/tests/scanner/foo-1.0-expected.tgir
==============================================================================
--- trunk/tests/scanner/foo-1.0-expected.tgir (original)
+++ trunk/tests/scanner/foo-1.0-expected.tgir Thu Oct 23 17:40:29 2008
@@ -101,7 +101,7 @@
<type name="utf8"/>
</return-value>
<parameters>
- <parameter name="object">
+ <parameter name="object" transfer-ownership="full">
<type name="GObject.Object"/>
</parameter>
<parameter name="p0">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]