summaryrefslogtreecommitdiffstats
path: root/scripts/qapi/expr.py
diff options
context:
space:
mode:
authorMarc-André Lureau2021-08-04 10:31:02 +0200
committerMarkus Armbruster2021-08-26 13:53:56 +0200
commit3ad64edfad2fa404e866c01f6d427ed4fe4f4f0f (patch)
tree0dfacc884ce4a8aeb40e5a0e9ed57586b0a982e8 /scripts/qapi/expr.py
parentqapi: replace if condition list with dict {'all': [...]} (diff)
downloadqemu-3ad64edfad2fa404e866c01f6d427ed4fe4f4f0f.tar.gz
qemu-3ad64edfad2fa404e866c01f6d427ed4fe4f4f0f.tar.xz
qemu-3ad64edfad2fa404e866c01f6d427ed4fe4f4f0f.zip
qapi: add 'any' condition
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210804083105.97531-8-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi/expr.py')
-rw-r--r--scripts/qapi/expr.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index d7a34655a7..f3ce10fb3e 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -290,16 +290,16 @@ def check_if(expr: _JSONObject, info: QAPISourceInfo, source: str) -> None:
raise QAPISemError(
info,
"'if' condition dict of %s must have one key: "
- "'all'" % source)
+ "'all' or 'any'" % source)
check_keys(cond, info, "'if' condition", [],
- ["all"])
+ ["all", "any"])
oper, operands = next(iter(cond.items()))
if not operands:
raise QAPISemError(
info, "'if' condition [] of %s is useless" % source)
- if oper in ("all") and not isinstance(operands, list):
+ if oper in ("all", "any") and not isinstance(operands, list):
raise QAPISemError(
info, "'%s' condition of %s must be an array" % (oper, source))
for operand in operands: