[gobject-introspection] docwriter/gjs: report arrays of (u)int8 and GBytes as ByteArray
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] docwriter/gjs: report arrays of (u)int8 and GBytes as ByteArray
- Date: Wed, 26 Feb 2014 16:27:54 +0000 (UTC)
commit 32b6ee9bfa99b7c106958fec8ce0e64c6390c53b
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Tue Feb 25 02:36:00 2014 +0100
docwriter/gjs: report arrays of (u)int8 and GBytes as ByteArray
The ByteArray class is special in gjs, it's not a normal Array,
so make sure it's flagged as such.
giscanner/docwriter.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/giscanner/docwriter.py b/giscanner/docwriter.py
index 37f575b..40c5fbe 100644
--- a/giscanner/docwriter.py
+++ b/giscanner/docwriter.py
@@ -673,7 +673,10 @@ class DocFormatterGjs(DocFormatterIntrospectableBase):
return fundamental_types.get(name, name)
def format_type(self, type_, link=False):
- if isinstance(type_, (ast.List, ast.Array)):
+ if isinstance(type_, ast.Array) and \
+ type_.element_type.target_fundamental in ('gint8', 'guint8'):
+ return 'ByteArray'
+ elif isinstance(type_, (ast.List, ast.Array)):
return 'Array(' + self.format_type(type_.element_type, link) + ')'
elif isinstance(type_, ast.Map):
return '{%s: %s}' % (self.format_type(type_.key_type, link),
@@ -682,6 +685,8 @@ class DocFormatterGjs(DocFormatterIntrospectableBase):
return "void"
elif type_.target_giname is not None:
giname = type_.target_giname
+ if giname in ('GLib.ByteArray', 'GLib.Bytes'):
+ return 'ByteArray'
if link:
nsname = self._transformer.namespace.name
if giname.startswith(nsname + '.'):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]