[gobject-introspection/wip/transformer: 2/3] [girwriter] For arrays and lists, write <any> if we don't know a type
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/wip/transformer: 2/3] [girwriter] For arrays and lists, write <any> if we don't know a type
- Date: Thu, 8 Jul 2010 14:42:09 +0000 (UTC)
commit 7b894634fe3220b682613b5e0ced5310f9e7e636
Author: Colin Walters <walters verbum org>
Date: Wed Jul 7 19:42:11 2010 -0400
[girwriter] For arrays and lists, write <any> if we don't know a type
Both types with unknown element_type can occur in the current scanner;
it's least wrong if we write out an <any> type.
giscanner/girwriter.py | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py
index e5b7ca0..5e29d06 100644
--- a/giscanner/girwriter.py
+++ b/giscanner/girwriter.py
@@ -23,7 +23,7 @@ from __future__ import with_statement
from .ast import (Alias, Array, Bitfield, Callback, Class, Constant, Enum,
Function, Interface, List, Map, Member, Struct, Union,
- Varargs)
+ Varargs, Type)
from .glibast import (GLibBoxed, GLibEnum, GLibEnumMember,
GLibFlags, GLibObject, GLibInterface,
GLibRecord)
@@ -256,6 +256,8 @@ and/or use gtk-doc annotations. ''')
with self.tagcontext('array', attrs):
if ntype.element_type is not None:
self._write_type(ntype.element_type)
+ else:
+ self._write_type(Type('any', ctype='gpointer'))
return
attrs = [('name', self._type_to_string(ntype))]
# FIXME: figure out if type references a basic type
@@ -263,9 +265,14 @@ and/or use gtk-doc annotations. ''')
# writing the ctype if the latter.
if type_cname is not None:
attrs.append(('c:type', type_cname))
- if isinstance(ntype, List) and ntype.element_type:
+ if (isinstance(ntype, List)
+ or typename in ('GLib.List',
+ 'GLib.SList')):
with self.tagcontext('type', attrs):
- self._write_type(ntype.element_type)
+ if isinstance(ntype, List) and ntype.element_type:
+ self._write_type(ntype.element_type)
+ else:
+ self._write_type(Type('any', ctype='gpointer'))
return
if isinstance(ntype, Map) and ntype.key_type:
with self.tagcontext('type', attrs):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]