summaryrefslogtreecommitdiff
path: root/giscanner/girwriter.py
diff options
context:
space:
mode:
authorMathieu Duponchelle <mathieu@centricular.com>2020-07-01 23:34:34 +0200
committerMathieu Duponchelle <mathieu@centricular.com>2020-07-12 02:52:12 +0200
commitd7504419093aef9fae802ad599cff1bf9022e24d (patch)
treeba9b0aa6815f98ae44106388134d9e822b2327a1 /giscanner/girwriter.py
parentbc8d3bc249e8eeff444e5fafac0d8821244fdb26 (diff)
downloadgobject-introspection-d7504419093aef9fae802ad599cff1bf9022e24d.tar.gz
giscanner: parse block comments for members and fields
There was previously no mechanism for tagging enum members and struct fields with Since tags (or other, eg deprecation tags). While the customary place to add Since tags for these symbols is inline in the parent symbol's documentation eg: /** * Foo: * * @FOO_BAR: some bar. Since X.Y */ And variations on that theme, implementing parsing for that scheme would result in a pretty ambiguous grammar, especially if we also want support for multiple tags. Instead, the solution implemented here is to allow providing documentation for individual members and fields through their own separate block, as is done for virtual functions already. Inline comments are still used, with a lower precedence. Fixes #348
Diffstat (limited to 'giscanner/girwriter.py')
-rw-r--r--giscanner/girwriter.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py
index d1333cb7..41d3ead2 100644
--- a/giscanner/girwriter.py
+++ b/giscanner/girwriter.py
@@ -437,6 +437,7 @@ class GIRWriter(XMLWriter):
attrs = [('name', member.name),
('value', str(member.value)),
('c:identifier', member.symbol)]
+ self._append_version(member, attrs)
if member.nick is not None:
attrs.append(('glib:nick', member.nick))
with self.tagcontext('member', attrs):
@@ -626,6 +627,7 @@ class GIRWriter(XMLWriter):
raise AssertionError("Unknown field anonymous: %r" % (field.anonymous_node, ))
else:
attrs = [('name', field.name)]
+ self._append_version(field, attrs)
self._append_node_generic(field, attrs)
# Fields are assumed to be read-only
# (see also girparser.c and generate.c)