]> Git Repo - qemu.git/commit
qapi/introspect.py: create a typed 'Annotated' data strutcure
authorJohn Snow <[email protected]>
Tue, 16 Feb 2021 02:18:00 +0000 (21:18 -0500)
committerMarkus Armbruster <[email protected]>
Thu, 18 Feb 2021 18:45:17 +0000 (19:45 +0100)
commit4f7f97a7b3d3321f02f854829f37637d6e144a57
tree60837d0b184cf9cc333608c891ebcb6d46a1819b
parent9db27346133b5b83699af49d290662d346683259
qapi/introspect.py: create a typed 'Annotated' data strutcure

Presently, we use a tuple to attach a dict containing annotations
(comments and compile-time conditionals) to a tree node. This is
undesirable because dicts are difficult to strongly type; promoting it
to a real class allows us to name the values and types of the
annotations we are expecting.

In terms of typing, the Annotated<T> type serves as a generic container
where the annotated node's type is preserved, allowing for greater
specificity than we'd be able to provide without a generic.

Signed-off-by: John Snow <[email protected]>
Message-Id: <20210216021809[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
scripts/qapi/introspect.py
This page took 0.023888 seconds and 4 git commands to generate.