By default, any union will automatically generate a enum type as "[UnionName]Kind" in C code, and it is duplicated when the discriminator is specified as a pre-defined enum type in schema. After this patch, the pre-defined enum type will be really used as the switch case condition in generated C code, if discriminator is an enum field. Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
18 lines
377 B
JSON
18 lines
377 B
JSON
{ 'union': 'TestUnion',
|
|
'base': 'TestBase',
|
|
'discriminator': 'enum1',
|
|
'data': { 'value1': 'TestTypeA',
|
|
'value2': 'TestTypeB' } }
|
|
|
|
{ 'type': 'TestBase',
|
|
'data': { 'enum1': 'TestEnum' } }
|
|
|
|
{ 'enum': 'TestEnum',
|
|
'data': [ 'value1', 'value2' ] }
|
|
|
|
{ 'type': 'TestTypeA',
|
|
'data': { 'string': 'str' } }
|
|
|
|
{ 'type': 'TestTypeB',
|
|
'data': { 'integer': 'int' } }
|