diff options
author | Mathieu Duponchelle <mathieu.duponchelle@opencreed.com> | 2015-07-15 13:11:45 +0200 |
---|---|---|
committer | Mathieu Duponchelle <mathieu@centricular.com> | 2019-07-19 01:21:38 +0200 |
commit | 0f3efc9058e2f249e84c02840fd96b6a413a9201 (patch) | |
tree | ea4628119b6573901c3426a16a74fced1c9c7822 /giscanner/maintransformer.py | |
parent | a62855702c3bc0b10370ef25d622a32e227283bd (diff) | |
download | gobject-introspection-0f3efc9058e2f249e84c02840fd96b6a413a9201.tar.gz |
scanner: parse and expose function macros
This is useful for documentation tools, and other utilities that
rely on full introspection of the C API of a given library.
Diffstat (limited to 'giscanner/maintransformer.py')
-rw-r--r-- | giscanner/maintransformer.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py index e1536b93..9468751d 100644 --- a/giscanner/maintransformer.py +++ b/giscanner/maintransformer.py @@ -176,6 +176,16 @@ class MainTransformer(object): block = self._blocks.get(node.symbol) self._apply_annotations_callable(node, chain, block) + def _apply_annotations_function_macro(self, node, chain): + block = self._blocks.get(node.symbol) + for param in node.parameters: + if block: + doc_param = block.params.get(param.argname) + if doc_param: + param.doc = doc_param.description + param.doc_position = doc_param.position + self._apply_annotations_annotated(node, block) + def _pass_read_annotations_early(self, node, chain): if isinstance(node, ast.Record): if node.ctype is not None: @@ -215,6 +225,8 @@ class MainTransformer(object): self._apply_annotations_alias(node, chain) if isinstance(node, ast.Function): self._apply_annotations_function(node, chain) + if isinstance(node, ast.FunctionMacro): + self._apply_annotations_function_macro(node, chain) if isinstance(node, ast.Callback): self._apply_annotations_callable(node, chain, block=self._get_block(node)) if isinstance(node, (ast.Class, ast.Interface, ast.Union, ast.Enum, |