mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-25 17:26:56 +00:00
qapi: Concentrate QAPISchemaParser.exprs updates in .__init__()
Backports commit 4257053083775c1f670fa828003915e25d13e9d7 from qemu
This commit is contained in:
parent
aaa4a812ed
commit
07453b11b8
|
@ -299,8 +299,13 @@ class QAPISchemaParser(object):
|
||||||
if not isinstance(include, str):
|
if not isinstance(include, str):
|
||||||
raise QAPISemError(info,
|
raise QAPISemError(info,
|
||||||
"Value of 'include' must be a string")
|
"Value of 'include' must be a string")
|
||||||
self._include(include, info, os.path.dirname(self.fname),
|
exprs_include = self._include(include, info,
|
||||||
|
os.path.dirname(self.fname),
|
||||||
previously_included)
|
previously_included)
|
||||||
|
if exprs_include:
|
||||||
|
self.exprs.extend(exprs_include.exprs)
|
||||||
|
self.docs.extend(exprs_include.docs)
|
||||||
|
|
||||||
elif "pragma" in expr:
|
elif "pragma" in expr:
|
||||||
self.reject_expr_doc()
|
self.reject_expr_doc()
|
||||||
if len(expr) != 1:
|
if len(expr) != 1:
|
||||||
|
@ -343,14 +348,12 @@ class QAPISchemaParser(object):
|
||||||
|
|
||||||
# skip multiple include of the same file
|
# skip multiple include of the same file
|
||||||
if incl_abs_fname in previously_included:
|
if incl_abs_fname in previously_included:
|
||||||
return
|
return None
|
||||||
try:
|
try:
|
||||||
fobj = open(incl_fname, 'r')
|
fobj = open(incl_fname, 'r')
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
raise QAPISemError(info, '%s: %s' % (e.strerror, incl_fname))
|
raise QAPISemError(info, '%s: %s' % (e.strerror, incl_fname))
|
||||||
exprs_include = QAPISchemaParser(fobj, previously_included, info)
|
return QAPISchemaParser(fobj, previously_included, info)
|
||||||
self.exprs.extend(exprs_include.exprs)
|
|
||||||
self.docs.extend(exprs_include.docs)
|
|
||||||
|
|
||||||
def _pragma(self, name, value, info):
|
def _pragma(self, name, value, info):
|
||||||
global doc_required, returns_whitelist, name_case_whitelist
|
global doc_required, returns_whitelist, name_case_whitelist
|
||||||
|
|
Loading…
Reference in a new issue