summaryrefslogtreecommitdiff
path: root/giscanner/maintransformer.py
diff options
context:
space:
mode:
authorGiovanni Campagna <gcampagna@src.gnome.org>2012-08-28 00:11:40 +0200
committerGiovanni Campagna <gcampagna@src.gnome.org>2012-10-28 18:41:04 +0100
commitd893890d1098953d6740d5c8114d278b6d9875fc (patch)
tree495d4ba5656a19725f6c8b65f03599d4614cc509 /giscanner/maintransformer.py
parentb7e230a61b9f9682c5ee433e24cfb749cec8c9c5 (diff)
downloadgobject-introspection-d893890d1098953d6740d5c8114d278b6d9875fc.tar.gz
Add documentation for enumeration members
Enum members were Annotated in the AST, and most code already assumed they could have docs. What was missing was reading the docs from the comment blocks and writing them in the XML. https://bugzilla.gnome.org/show_bug.cgi?id=683046
Diffstat (limited to 'giscanner/maintransformer.py')
-rw-r--r--giscanner/maintransformer.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index d4163fae..bf276c06 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -215,6 +215,8 @@ usage is void (*_gtk_reserved1)(void);"""
if isinstance(node, (ast.Class, ast.Interface, ast.Union, ast.Enum,
ast.Bitfield, ast.Callback)):
self._apply_annotations_annotated(node, self._get_block(node))
+ if isinstance(node, (ast.Enum, ast.Bitfield)):
+ self._apply_annotations_enum_members(node, self._get_block(node))
if isinstance(node, (ast.Class, ast.Interface, ast.Record, ast.Union)):
block = self._get_block(node)
for field in node.fields:
@@ -820,6 +822,15 @@ usage is void (*_gtk_reserved1)(void);"""
if tag:
node.value = tag.value
+ def _apply_annotations_enum_members(self, node, block):
+ if block is None:
+ return
+
+ for m in node.members:
+ tag = block.params.get(m.symbol, None)
+ if tag is not None:
+ m.doc = tag.comment
+
def _pass_read_annotations2(self, node, chain):
if isinstance(node, ast.Function):
self._apply_annotations2_function(node, chain)