diff options
author | Giovanni Campagna <gcampagna@src.gnome.org> | 2014-02-02 00:57:24 +0100 |
---|---|---|
committer | Giovanni Campagna <gcampagna@src.gnome.org> | 2014-02-20 03:09:38 +0100 |
commit | b6568a4c8007f574f8b9c6a048d04f80dd291f37 (patch) | |
tree | 6519689ee028c39cfff837b2bef13ab433b22904 /giscanner/maintransformer.py | |
parent | 6cc9207cbdb1328c746e0899f459bb09d1e3e954 (diff) | |
download | gobject-introspection-b6568a4c8007f574f8b9c6a048d04f80dd291f37.tar.gz |
scanner: support virtual functions with a typedef-ed callback
The field of a callback need not be anonymous, it could be a
typedef, with a proper Type node.
Fixes TelepathyGlib.BaseClient having no virtual functions
(and probably others)
https://bugzilla.gnome.org/show_bug.cgi?id=723439
Diffstat (limited to 'giscanner/maintransformer.py')
-rw-r--r-- | giscanner/maintransformer.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py index c107beed..e6f04684 100644 --- a/giscanner/maintransformer.py +++ b/giscanner/maintransformer.py @@ -1225,16 +1225,24 @@ method or constructor of some type.""" field.writable = False for field in class_struct.fields: - if not isinstance(field.anonymous_node, ast.Callback): + callback = None + + if isinstance(field.anonymous_node, ast.Callback): + callback = field.anonymous_node + elif field.type is not None: + callback = self._transformer.lookup_typenode(field.type) + if not isinstance(callback, ast.Callback): + continue + else: continue - callback = field.anonymous_node + # Check the first parameter is the object if len(callback.parameters) == 0: continue firstparam_type = callback.parameters[0].type if firstparam_type != node_type: continue - vfunc = ast.VFunction.from_callback(callback) + vfunc = ast.VFunction.from_callback(field.name, callback) vfunc.instance_parameter = callback.parameters[0] vfunc.inherit_file_positions(callback) |