aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi/expr.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/qapi/expr.py')
-rw-r--r--scripts/qapi/expr.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index f3ce10f..120b310 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -290,15 +290,18 @@ def check_if(expr: _JSONObject, info: QAPISourceInfo, source: str) -> None:
raise QAPISemError(
info,
"'if' condition dict of %s must have one key: "
- "'all' or 'any'" % source)
+ "'all', 'any' or 'not'" % source)
check_keys(cond, info, "'if' condition", [],
- ["all", "any"])
+ ["all", "any", "not"])
oper, operands = next(iter(cond.items()))
if not operands:
raise QAPISemError(
info, "'if' condition [] of %s is useless" % source)
+ if oper == "not":
+ _check_if(operands)
+ return
if oper in ("all", "any") and not isinstance(operands, list):
raise QAPISemError(
info, "'%s' condition of %s must be an array" % (oper, source))