Eric Blake <ebl...@redhat.com> writes: > On 09/16/2015 05:06 AM, Markus Armbruster wrote: >> The old code prints the result of parsing (list of expression >> dictionaries), and partial results of semantic analysis (list of enum >> dictionaries, list of struct dictionaries). >> >> The new code prints a trace of a schema visit, i.e. what the back-ends >> are going to use. Built-in and array types are omitted, because >> they're boring. >> >> Signed-off-by: Markus Armbruster <arm...@redhat.com> >> --- > >> +class QAPISchemaTestVisitor(QAPISchemaVisitor): >> + def visit_enum_type(self, name, info, values, prefix): >> + print 'enum %s %s prefix=%s' % (name, values, prefix) >> + >> + def visit_object_type(self, name, info, base, members, variants): >> + print 'object %s' % name >> + if base: >> + print ' base %s' % base.name > > For consistency with other visitors, I might have done: > > if prefix: > print ' prefix %s' % prefix > > instead of printing prefix=None for most enums. In particular, > >> +enum EnumOne ['value1', 'value2', 'value3'] prefix=None >> +object EventStructOne >> + member struct1: UserDefOne optional=False >> + member string: str optional=False >> + member enum2: EnumOne optional=True >> +object NestedEnumsOne >> + member enum1: EnumOne optional=False >> + member enum2: EnumOne optional=True >> + member enum3: EnumOne optional=False >> + member enum4: EnumOne optional=True >> +enum QEnumTwo ['value1', 'value2'] prefix=QENUM_TWO > > the fact that prefix=None and prefix=QENUM_TWO doesn't offer any visual > clues on whether the string was user-supplied, means that the following > would result in ambiguous output: > { 'enum':'Foo', 'prefix':'None', 'data':[] }
No big deal. But avoiding it is no big deal, either. I'll give it a try. > But it's not necessarily a strong enough reason for a respin. > > Reviewed-by: Eric Blake <ebl...@redhat.com> Thanks!