summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2010-05-27 00:08:20 -0300
committerJohan Dahlin <johan@gnome.org>2010-05-27 00:09:55 -0300
commite77f99fba5fce4dd0d4810707aa1aeac2ba0fb50 (patch)
treea837d6e79a57c2f085f42a8794dc535afc6d51a7 /giscanner
parent666bb8d76a648011a49f14b6db4558e256c8e31b (diff)
downloadgobject-introspection-e77f99fba5fce4dd0d4810707aa1aeac2ba0fb50.tar.gz
[scanner] Element-type annotation for GArray types
Add support for (element-type) annotations for G*Array types. https://bugzilla.gnome.org/show_bug.cgi?id=619545
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/annotationparser.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index b1d4ea00..180de6be 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -647,15 +647,20 @@ class AnnotationApplier(object):
return True
return False
+ def _is_array_type(self, node):
+ if node.type.name in ['GLib.Array', 'GLib.PtrArray',
+ 'GLib.ByteArray']:
+ return True
+ if node.type.ctype in ['GArray*', 'GPtrArray*', 'GByteArray*']:
+ return True
+ return False
+
def _extract_container_type(self, parent, node, options):
has_element_type = OPT_ELEMENT_TYPE in options
has_array = OPT_ARRAY in options
if not has_array:
- has_array = \
- node.type.name in ['GLib.Array', 'GLib.PtrArray',
- 'GLib.ByteArray'] or \
- node.type.ctype in ['GArray*', 'GPtrArray*', 'GByteArray*']
+ has_array = self._is_array_type(node)
# FIXME: This is a hack :-(
if (not isinstance(node, Field) and
@@ -781,6 +786,10 @@ class AnnotationApplier(object):
node.type.ctype,
self._resolve(element_type[0]),
self._resolve(element_type[1]))
+ elif self._is_array_type(node):
+ container_type = Array(node.type.name,
+ node.type.ctype,
+ self._resolve(element_type[0]))
else:
print 'FIXME: unhandled element-type container:', node
return container_type