]> git.proxmox.com Git - mirror_qemu.git/commit
qapi/introspect.py: create a typed 'Annotated' data strutcure
authorJohn Snow <jsnow@redhat.com>
Tue, 16 Feb 2021 02:18:00 +0000 (21:18 -0500)
committerMarkus Armbruster <armbru@redhat.com>
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 <jsnow@redhat.com>
Message-Id: <20210216021809.134886-11-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
scripts/qapi/introspect.py