summaryrefslogtreecommitdiffstats
path: root/scripts/qapi/expr.py
diff options
context:
space:
mode:
authorMarkus Armbruster2019-10-24 13:02:34 +0200
committerMarkus Armbruster2019-10-29 07:35:16 +0100
commitad1ecfc6794bddd512f6f0ce400e3018d89e167b (patch)
treebabfe1496469bce99f095bd4859920fa9a23cf48 /scripts/qapi/expr.py
parentqapi: Fold normalize_features() into check_features() (diff)
downloadqemu-ad1ecfc6794bddd512f6f0ce400e3018d89e167b.tar.gz
qemu-ad1ecfc6794bddd512f6f0ce400e3018d89e167b.tar.xz
qemu-ad1ecfc6794bddd512f6f0ce400e3018d89e167b.zip
qapi: Fold normalize_enum() into check_enum()
check_features() is always called together with normalize_features(). Fold the latter into the former. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191024110237.30963-17-armbru@redhat.com>
Diffstat (limited to 'scripts/qapi/expr.py')
-rw-r--r--scripts/qapi/expr.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index 66014e2bb2..d7a289eded 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -190,12 +190,6 @@ def check_features(features, info):
check_if(f, info, source)
-def normalize_enum(expr):
- if isinstance(expr['data'], list):
- expr['data'] = [m if isinstance(m, dict) else {'name': m}
- for m in expr['data']]
-
-
def check_enum(expr, info):
name = expr['enum']
members = expr['data']
@@ -208,6 +202,8 @@ def check_enum(expr, info):
permit_upper = name in info.pragma.name_case_whitelist
+ members[:] = [m if isinstance(m, dict) else {'name': m}
+ for m in members]
for member in members:
source = "'data' member"
check_keys(member, info, source, ['name'], ['if'])
@@ -325,7 +321,6 @@ def check_exprs(exprs):
if meta == 'enum':
check_keys(expr, info, meta,
['enum', 'data'], ['if', 'prefix'])
- normalize_enum(expr)
check_enum(expr, info)
elif meta == 'union':
check_keys(expr, info, meta,