[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 14/29] qapi: Concentrate QAPISchemaParser.exprs u
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH v2 14/29] qapi: Concentrate QAPISchemaParser.exprs updates in .__init__() |
Date: |
Sun, 11 Feb 2018 10:35:52 +0100 |
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
---
scripts/qapi/common.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
index dce289ae21..cc5a5941dd 100644
--- a/scripts/qapi/common.py
+++ b/scripts/qapi/common.py
@@ -290,8 +290,12 @@ class QAPISchemaParser(object):
if not isinstance(include, str):
raise QAPISemError(info,
"Value of 'include' must be a string")
- self._include(include, info, os.path.dirname(self.fname),
- previously_included)
+ exprs_include = self._include(include, info,
+ os.path.dirname(self.fname),
+ previously_included)
+ if exprs_include:
+ self.exprs.extend(exprs_include.exprs)
+ self.docs.extend(exprs_include.docs)
elif "pragma" in expr:
self.reject_expr_doc(cur_doc)
if len(expr) != 1:
@@ -334,14 +338,13 @@ class QAPISchemaParser(object):
# skip multiple include of the same file
if incl_abs_fname in previously_included:
- return
+ return None
+
try:
fobj = open(incl_fname, 'r')
except IOError as e:
raise QAPISemError(info, '%s: %s' % (e.strerror, incl_fname))
- exprs_include = QAPISchemaParser(fobj, previously_included, info)
- self.exprs.extend(exprs_include.exprs)
- self.docs.extend(exprs_include.docs)
+ return QAPISchemaParser(fobj, previously_included, info)
def _pragma(self, name, value, info):
global doc_required, returns_whitelist, name_case_whitelist
--
2.13.6
- Re: [Qemu-devel] [PATCH v2 29/29] qapi: Don't create useless directory qapi-generated, (continued)
- [Qemu-devel] [PATCH v2 09/29] qapi-gen: Convert from getopt to argparse, Markus Armbruster, 2018/02/11
- [Qemu-devel] [PATCH v2 20/29] qapi/types qapi/visit: Generate built-in stuff into separate files, Markus Armbruster, 2018/02/11
- [Qemu-devel] [PATCH v2 14/29] qapi: Concentrate QAPISchemaParser.exprs updates in .__init__(),
Markus Armbruster <=
- [Qemu-devel] [PATCH v2 02/29] qapi: Streamline boilerplate comment generation, Markus Armbruster, 2018/02/11
- [Qemu-devel] [PATCH v2 11/29] qapi: Improve include file name reporting in error messages, Markus Armbruster, 2018/02/11
- [Qemu-devel] [PATCH v2 05/29] qapi: New classes QAPIGenC, QAPIGenH, QAPIGenDoc, Markus Armbruster, 2018/02/11
- [Qemu-devel] [PATCH v2 17/29] qapi: Record 'include' directives in intermediate representation, Markus Armbruster, 2018/02/11