On 11/04/2015 12:02 PM, Markus Armbruster wrote: > Eric Blake writes: > >> From: Markus Armbruster >> >> Avoid the 'if seen' conditional by doing just the essential work >> here, namely setting self.tag_member for flat unions. >> Move the rest to callers. >> >> Signed-off-by: Markus Armbruster >> Message-Id: <1446559499-26984-7-git-send-email-armbru@redhat.com> >> [reword commit, rebase to earlier AlternateType.check() changes] >> Signed-off-by: Eric Blake >> >> --- >> v9: new patch >> --- >> scripts/qapi.py | 5 ++--- >> 1 file changed, 2 insertions(+), 3 deletions(-) >> >> diff --git a/scripts/qapi.py b/scripts/qapi.py >> index 3054628..6653c70 100644 >> --- a/scripts/qapi.py >> +++ b/scripts/qapi.py >> @@ -988,9 +988,10 @@ class QAPISchemaObjectType(QAPISchemaType): >> for m in self.local_members: >> m.check(schema) >> m.check_clash(seen) >> + self.members = seen.values() >> if self.variants: >> self.variants.check(schema, seen) >> - self.members = seen.values() >> + assert self.variants.tag_member in self.members >> >> def is_implicit(self): >> # See QAPISchema._make_implicit_object_type() >> @@ -1053,8 +1054,6 @@ class QAPISchemaObjectTypeVariants(object): >> # seen is non-empty for unions, empty for alternates > > You added this comment in PATCH 10 to explain the conditional I'm > dropping here. Let's drop the comment, too. Except the comment becomes relevant again in 23/27. Or maybe I just move the comment to that point. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org