mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-10 23:25:29 +00: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. Backports commit 8a84767cc4f7e00e5dd62435c32be9e7d2cbe4d3 from qemu
This commit is contained in:
parent
cad1593b7d
commit
6fe71ebc68
|
@ -1483,6 +1483,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()
|
||||
|
@ -1494,6 +1495,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):
|
||||
|
@ -1692,12 +1694,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…
Reference in a new issue