diff options
author | Giovanni Campagna <gcampagna@src.gnome.org> | 2014-02-25 02:36:00 +0100 |
---|---|---|
committer | Giovanni Campagna <gcampagna@src.gnome.org> | 2014-02-26 17:27:07 +0100 |
commit | 32b6ee9bfa99b7c106958fec8ce0e64c6390c53b (patch) | |
tree | e45978c143c2bf92025bc87178d9e17e50fd492f /giscanner/docwriter.py | |
parent | d66b9ec78a8338a90a5b36df69a93cf21040e972 (diff) | |
download | gobject-introspection-32b6ee9bfa99b7c106958fec8ce0e64c6390c53b.tar.gz |
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.
Diffstat (limited to 'giscanner/docwriter.py')
-rw-r--r-- | giscanner/docwriter.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/giscanner/docwriter.py b/giscanner/docwriter.py index 37f575b7..40c5fbed 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 + '.'): |