diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2021-06-23 19:12:18 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gmail.com> | 2022-02-12 15:27:38 +0000 |
commit | 59a77cc7a96e34aa0d49b8c82f647115a8286a56 (patch) | |
tree | 8f696c73d427e5a2001132e704c48abf50fd14b1 /giscanner/maintransformer.py | |
parent | 9cbcd6dd958c090d967a6e74f8fd5e130cf173b8 (diff) | |
download | gobject-introspection-59a77cc7a96e34aa0d49b8c82f647115a8286a56.tar.gz |
scanner: Add (emitter) annotation for signals
Signals that have an emitter function should have an annotation to allow
consumers of the introspection XML to effectively pair signals to their
corresponding emitter functions that share the same prototype.
Diffstat (limited to 'giscanner/maintransformer.py')
-rw-r--r-- | giscanner/maintransformer.py | 58 |
1 files changed, 48 insertions, 10 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py index 0f1ea9b6..2004d254 100644 --- a/giscanner/maintransformer.py +++ b/giscanner/maintransformer.py @@ -22,16 +22,49 @@ import re from . import ast from . import message from .annotationparser import (TAG_DEPRECATED, TAG_SINCE, TAG_STABILITY, TAG_RETURNS) -from .annotationparser import (ANN_ALLOW_NONE, ANN_ARRAY, ANN_ATTRIBUTES, ANN_CLOSURE, - ANN_CONSTRUCTOR, ANN_DESTROY, ANN_ELEMENT_TYPE, ANN_FOREIGN, - ANN_GET_PROPERTY, ANN_GET_VALUE_FUNC, ANN_GETTER, ANN_IN, ANN_INOUT, - ANN_METHOD, ANN_OUT, ANN_REF_FUNC, ANN_RENAME_TO, ANN_SCOPE, - ANN_SET_PROPERTY, ANN_SET_VALUE_FUNC, ANN_SETTER, ANN_SKIP, ANN_TRANSFER, - ANN_TYPE, ANN_UNREF_FUNC, ANN_VALUE, ANN_VFUNC, ANN_NULLABLE, - ANN_OPTIONAL, ANN_NOT) -from .annotationparser import (OPT_ARRAY_FIXED_SIZE, OPT_ARRAY_LENGTH, OPT_ARRAY_ZERO_TERMINATED, - OPT_OUT_CALLEE_ALLOCATES, OPT_OUT_CALLER_ALLOCATES, - OPT_TRANSFER_CONTAINER, OPT_TRANSFER_FLOATING, OPT_TRANSFER_NONE) +from .annotationparser import ( + ANN_ALLOW_NONE, + ANN_ARRAY, + ANN_ATTRIBUTES, + ANN_CLOSURE, + ANN_CONSTRUCTOR, + ANN_DESTROY, + ANN_ELEMENT_TYPE, + ANN_EMITTER, + ANN_FOREIGN, + ANN_GET_PROPERTY, + ANN_GET_VALUE_FUNC, + ANN_GETTER, + ANN_IN, + ANN_INOUT, + ANN_METHOD, + ANN_OUT, + ANN_REF_FUNC, + ANN_RENAME_TO, + ANN_SCOPE, + ANN_SET_PROPERTY, + ANN_SET_VALUE_FUNC, + ANN_SETTER, + ANN_SKIP, + ANN_TRANSFER, + ANN_TYPE, + ANN_UNREF_FUNC, + ANN_VALUE, + ANN_VFUNC, + ANN_NULLABLE, + ANN_OPTIONAL, + ANN_NOT, +) +from .annotationparser import ( + OPT_ARRAY_FIXED_SIZE, + OPT_ARRAY_LENGTH, + OPT_ARRAY_ZERO_TERMINATED, + OPT_OUT_CALLEE_ALLOCATES, + OPT_OUT_CALLER_ALLOCATES, + OPT_TRANSFER_CONTAINER, + OPT_TRANSFER_FLOATING, + OPT_TRANSFER_NONE, +) from .utils import to_underscores_noprefix @@ -938,6 +971,11 @@ class MainTransformer(object): if block: self._apply_annotations_annotated(signal, block) + + emitter = block.annotations.get(ANN_EMITTER) + if emitter: + signal.emitter = emitter[0] + # We're only attempting to name the signal parameters if # the number of parameters (@foo) is the same or greater # than the number of signal parameters |