diff options
author | Colin Walters <walters@verbum.org> | 2010-09-14 11:19:11 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2010-09-14 11:19:11 -0400 |
commit | 303255d484165f7d2e3e3ad298168da43edcbd2e (patch) | |
tree | 73a93abdc943567214574975955726fd4c8b202b /giscanner | |
parent | e2195f648dfc92fd57049f12a4944682c8e0fb1d (diff) |
scanner: Handle G_TYPE_HASH_TABLE
Our Type creation from GType names didn't know how to handle
the GObject boxeds for GHashTable, GArray etc.
Diffstat (limited to 'giscanner')
-rw-r--r-- | giscanner/ast.py | 7 | ||||
-rw-r--r-- | giscanner/transformer.py | 11 |
2 files changed, 12 insertions, 6 deletions
diff --git a/giscanner/ast.py b/giscanner/ast.py index 6e9dc89..53ddad2 100644 --- a/giscanner/ast.py +++ b/giscanner/ast.py @@ -88,6 +88,11 @@ in contrast to the other create_type() functions.""" fundamental = type_names.get(gtype_name) if fundamental is not None: return cls(target_fundamental=fundamental.target_fundamental) + if gtype_name == 'GHashTable': + return Map(TYPE_ANY, TYPE_ANY, gtype_name=gtype_name) + elif gtype_name in ('GArray', 'GPtrArray', 'GByteArray'): + return Array('GLib.' + gtype_name[1:], TYPE_ANY, + gtype_name=gtype_name) return cls(gtype_name=gtype_name) def get_giname(self): @@ -577,7 +582,7 @@ class Array(Type): else: assert array_type in (self.GLIB_ARRAY, self.GLIB_BYTEARRAY, - self.GLIB_PTRARRAY) + self.GLIB_PTRARRAY), array_type self.array_type = array_type assert isinstance(element_type, Type) self.element_type = element_type diff --git a/giscanner/transformer.py b/giscanner/transformer.py index 1acc67a..f9a4ead 100644 --- a/giscanner/transformer.py +++ b/giscanner/transformer.py @@ -529,14 +529,15 @@ raise ValueError.""" return ast.List(name, ast.TYPE_ANY, ctype=ctype, is_const=is_const) elif base in ('GArray', 'GPtrArray', 'GByteArray', - 'GLib.Array', 'GLib.PtrArray', 'GLib.ByteArray'): - if base in ('GArray', 'GPtrArray', 'GByteArray'): - name = 'GLib.' + base[1:] + 'GLib.Array', 'GLib.PtrArray', 'GLib.ByteArray', + 'GObject.Array', 'GObject.PtrArray', 'GObject.ByteArray'): + if '.' in base: + name = 'GLib.' + base.split('.', 1)[1] else: - name = base + name = 'GLib.' + base[1:] return ast.Array(name, ast.TYPE_ANY, ctype=ctype, is_const=is_const) - elif base in ('GHashTable', 'GLib.HashTable'): + elif base in ('GHashTable', 'GLib.HashTable', 'GObject.HashTable'): return ast.Map(ast.TYPE_ANY, ast.TYPE_ANY, ctype=ctype, is_const=is_const) return None |