]> git.proxmox.com Git - mirror_qemu.git/commit - scripts/qapi-types.py
qapi: Use predicate callback to determine visit filtering
authorEric Blake <eblake@redhat.com>
Tue, 13 Oct 2015 04:22:21 +0000 (22:22 -0600)
committerMarkus Armbruster <armbru@redhat.com>
Thu, 15 Oct 2015 06:39:07 +0000 (08:39 +0200)
commit25a0d9c977c2f5db914b0a1619759fd77d97b016
treed08f3d9064f5de6bb9e2da7d5b79c18914c1d637
parentd08ac81a459258ce20b3184fa9325c6c1350ac9e
qapi: Use predicate callback to determine visit filtering

Previously, qapi-types and qapi-visit filtered out implicit
objects during visit_object_type() by using 'info' (works since
implicit objects do not [yet] have associated info); meanwhile
qapi-introspect filtered out all schema types on the first pass
by returning a python type from visit_begin(), which was then
used at a distance in QAPISchema.visit() to do the filtering.

Rather than keeping these ad hoc approaches, add a new visitor
callback visit_needed() which returns False to skip a given
entity, and which defaults to True unless overridden.  Use the
new mechanism to simplify all three filtering visitors.

No change to the generated code.

Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1444710158-8723-2-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
scripts/qapi-introspect.py
scripts/qapi-types.py
scripts/qapi-visit.py
scripts/qapi.py