mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
qapi: Generate in source order
The generators' conversion to visitors (merge commit 9e72681d16)
changed the processing order of entities from source order to
alphabetical order. The next commit needs source order, so change it
back.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180211093607.27351-17-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
97f0249474
commit
8a84767cc4
12 changed files with 207 additions and 205 deletions
|
|
@ -1474,6 +1474,7 @@ class QAPISchema(object):
|
|||
parser = QAPISchemaParser(open(fname, 'r'))
|
||||
exprs = check_exprs(parser.exprs)
|
||||
self.docs = parser.docs
|
||||
self._entity_list = []
|
||||
self._entity_dict = {}
|
||||
self._predefining = True
|
||||
self._def_predefineds()
|
||||
|
|
@ -1485,6 +1486,7 @@ class QAPISchema(object):
|
|||
# Only the predefined types are allowed to not have info
|
||||
assert ent.info or self._predefining
|
||||
assert ent.name not in self._entity_dict
|
||||
self._entity_list.append(ent)
|
||||
self._entity_dict[ent.name] = ent
|
||||
|
||||
def lookup_entity(self, name, typ=None):
|
||||
|
|
@ -1683,12 +1685,12 @@ class QAPISchema(object):
|
|||
assert False
|
||||
|
||||
def check(self):
|
||||
for (name, ent) in sorted(self._entity_dict.items()):
|
||||
for ent in self._entity_list:
|
||||
ent.check(self)
|
||||
|
||||
def visit(self, visitor):
|
||||
visitor.visit_begin(self)
|
||||
for (name, entity) in sorted(self._entity_dict.items()):
|
||||
for entity in self._entity_list:
|
||||
if visitor.visit_needed(entity):
|
||||
entity.visit(visitor)
|
||||
visitor.visit_end()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue