diff options
author | Wenchao Xia <wenchaoqemu@gmail.com> | 2014-03-04 18:44:32 -0800 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2014-03-11 09:07:41 -0400 |
commit | 4b35991a3bd5f9e03333d5b1bd4a7bcf9941aac5 (patch) | |
tree | 5b41a70e6d38c54dbc357b60dfef9b643114208a /scripts/qapi.py | |
parent | dad1fcab91bf101a02151069036d416367b59c5c (diff) |
qapi script: add check for duplicated key
It is bad that same key was specified twice, especially when a union has
two branches with same condition. This patch can prevent it.
Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'scripts/qapi.py')
-rw-r--r-- | scripts/qapi.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py index 023930ea0c..d0e793452a 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -116,6 +116,8 @@ class QAPISchema: if self.tok != ':': raise QAPISchemaError(self, 'Expected ":"') self.accept() + if key in expr: + raise QAPISchemaError(self, 'Duplicate key "%s"' % key) expr[key] = self.get_expr(True) if self.tok == '}': self.accept() |