qapi/parser: assert object keys are strings
The single quote token implies the value is a string. Assert this to be the case, to allow us to write an accurate return type for get_members. Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210519183951.3946870-8-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
9cd0205d55
commit
234dce2c2d
@ -249,6 +249,8 @@ class QAPISchemaParser:
|
|||||||
raise QAPIParseError(self, "expected string or '}'")
|
raise QAPIParseError(self, "expected string or '}'")
|
||||||
while True:
|
while True:
|
||||||
key = self.val
|
key = self.val
|
||||||
|
assert isinstance(key, str) # Guaranteed by tok == "'"
|
||||||
|
|
||||||
self.accept()
|
self.accept()
|
||||||
if self.tok != ':':
|
if self.tok != ':':
|
||||||
raise QAPIParseError(self, "expected ':'")
|
raise QAPIParseError(self, "expected ':'")
|
||||||
|
Loading…
Reference in New Issue
Block a user