diff mbox series

[04/16] sphinx/qapidoc: Drop code to generate doc for simple union branch

Message ID 20240216145841.2099240-5-armbru@redhat.com
State New
Headers show
Series qapi: Doc comment parsing & doc generation work | expand

Commit Message

Markus Armbruster Feb. 16, 2024, 2:58 p.m. UTC
Commit 4e99f4b12c0 (qapi: Drop simple unions) eliminated implicitly
defined union branch types, except for the empty object type
'q_empty'.  QAPISchemaGenRSTVisitor._nodes_for_members() still has
code to generate documentation for implicitly defined union branch
types.  It does nothing for 'q_empty'.  Simplify.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 docs/sphinx/qapidoc.py | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

Comments

Daniel P. Berrangé Feb. 20, 2024, 3:13 p.m. UTC | #1
On Fri, Feb 16, 2024 at 03:58:28PM +0100, Markus Armbruster wrote:
> Commit 4e99f4b12c0 (qapi: Drop simple unions) eliminated implicitly
> defined union branch types, except for the empty object type
> 'q_empty'.  QAPISchemaGenRSTVisitor._nodes_for_members() still has
> code to generate documentation for implicitly defined union branch
> types.  It does nothing for 'q_empty'.  Simplify.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  docs/sphinx/qapidoc.py | 18 +++++++-----------
>  1 file changed, 7 insertions(+), 11 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
diff mbox series

Patch

diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py
index 05b809af27..488de23d72 100644
--- a/docs/sphinx/qapidoc.py
+++ b/docs/sphinx/qapidoc.py
@@ -180,17 +180,13 @@  def _nodes_for_members(self, doc, what, base=None, variants=None):
 
         if variants:
             for v in variants.variants:
-                if v.type.is_implicit():
-                    assert not v.type.base and not v.type.variants
-                    for m in v.type.local_members:
-                        term = self._nodes_for_one_member(m)
-                        term.extend(self._nodes_for_variant_when(variants, v))
-                        dlnode += self._make_dlitem(term, None)
-                else:
-                    term = [nodes.Text('The members of '),
-                            nodes.literal('', v.type.doc_type())]
-                    term.extend(self._nodes_for_variant_when(variants, v))
-                    dlnode += self._make_dlitem(term, None)
+                if v.type.name == 'q_empty':
+                    continue
+                assert not v.type.is_implicit()
+                term = [nodes.Text('The members of '),
+                        nodes.literal('', v.type.doc_type())]
+                term.extend(self._nodes_for_variant_when(variants, v))
+                dlnode += self._make_dlitem(term, None)
 
         if not dlnode.children:
             return []