Begin preparing to remove public access to the .features member by
introducing a semantic "has features" property instead.
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/qapi/parser.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index b33edbba74f..dcc58170bd5 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -555,7 +555,7 @@ def get_doc(self) -> 'QAPIDoc':
break
# Non-blank line, first of a section
if line == 'Features:':
- if doc.features:
+ if doc.has_features:
raise QAPIParseError(
self, "duplicated 'Features:' line")
self.accept(False)
@@ -570,7 +570,7 @@ def get_doc(self) -> 'QAPIDoc':
if text:
doc.append_line(text)
line = self.get_doc_indented(doc)
- if not doc.features:
+ if not doc.has_features:
raise QAPIParseError(
self, 'feature descriptions expected')
no_more_args = True
@@ -741,6 +741,10 @@ def __init__(self, info: QAPISourceInfo, symbol: Optional[str] = None):
# "Since" section
self.since: Optional[QAPIDoc.Section] = None
+ @property
+ def has_features(self) -> bool:
+ return bool(self.features)
+
def end(self) -> None:
for section in self.all_sections:
section.text = section.text.strip('\n')
--
2.54.0