mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
qapi: introduce QAPISchemaIfCond.cgen()
Instead of building prepocessor conditions from a list of string, use the result generated from QAPISchemaIfCond.cgen() and hide the implementation details. Note: this patch introduces a minor regression, generating a redundant pair of parenthesis. This is mostly fixed in a later patch in this series ("qapi: replace if condition list with dict [..]") Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210804083105.97531-5-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Commit message tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
33aa3267ba
commit
6cc2e4817f
6 changed files with 46 additions and 34 deletions
|
@ -124,10 +124,10 @@ def _tree_to_qlit(obj: JSONValue,
|
|||
if obj.comment:
|
||||
ret += indent(level) + f"/* {obj.comment} */\n"
|
||||
if obj.ifcond.is_present():
|
||||
ret += gen_if(obj.ifcond.ifcond)
|
||||
ret += gen_if(obj.ifcond.cgen())
|
||||
ret += _tree_to_qlit(obj.value, level)
|
||||
if obj.ifcond.is_present():
|
||||
ret += '\n' + gen_endif(obj.ifcond.ifcond)
|
||||
ret += '\n' + gen_endif(obj.ifcond.cgen())
|
||||
return ret
|
||||
|
||||
ret = ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue