diff options
author | John Snow <jsnow@redhat.com> | 2023-02-14 19:00:09 -0500 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2023-02-23 13:01:45 +0100 |
commit | 420110591c54f5fd38e065d5bddac73b3076bf9e (patch) | |
tree | e48291e9f8efd56878e9eb64c753854cdf90bb65 /scripts/qapi/__init__.py | |
parent | c60caf8086247afbfbf0673993d809d348238ef6 (diff) |
qapi/parser: add QAPIExpression type
This patch creates a new type, QAPIExpression, which represents a parsed
expression complete with QAPIDoc and QAPISourceInfo.
This patch turns parser.exprs into a list of QAPIExpression instead,
and adjusts expr.py to match.
This allows the types we specify in parser.py to be "remembered" all the
way through expr.py and into schema.py. Several assertions around
packing and unpacking this data can be removed as a result.
It also corrects a harmless typing error. Before the patch,
check_exprs() allegedly takes a List[_JSONObject]. It actually takes
a list of dicts of the form
{'expr': E, 'info': I, 'doc': D}
where E is of type _ExprValue, I is of type QAPISourceInfo, and D is
of type QAPIDoc. Key 'doc' is optional. This is not a _JSONObject!
Passes type checking anyway, because _JSONObject is Dict[str, object].
Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20230215000011.1725012-5-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Commit message amended to point out the typing fix]
Diffstat (limited to 'scripts/qapi/__init__.py')
0 files changed, 0 insertions, 0 deletions