diff options
Diffstat (limited to 'scripts/qapi')
-rw-r--r-- | scripts/qapi/parser.py | 2 | ||||
-rw-r--r-- | scripts/qapi/source.py | 10 |
2 files changed, 4 insertions, 8 deletions
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index a53b735e7d..39dbcc4eac 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -47,7 +47,7 @@ class QAPISchemaParser: if self.src == '' or self.src[-1] != '\n': self.src += '\n' self.cursor = 0 - self.info = QAPISourceInfo(fname, 1, incl_info) + self.info = QAPISourceInfo(fname, incl_info) self.line_pos = 0 self.exprs = [] self.docs = [] diff --git a/scripts/qapi/source.py b/scripts/qapi/source.py index 1ade864d7b..04193cc964 100644 --- a/scripts/qapi/source.py +++ b/scripts/qapi/source.py @@ -31,10 +31,9 @@ class QAPISchemaPragma: class QAPISourceInfo: T = TypeVar('T', bound='QAPISourceInfo') - def __init__(self, fname: str, line: int, - parent: Optional['QAPISourceInfo']): + def __init__(self, fname: str, parent: Optional['QAPISourceInfo']): self.fname = fname - self.line = line + self.line = 1 self.parent = parent self.pragma: QAPISchemaPragma = ( parent.pragma if parent else QAPISchemaPragma() @@ -52,10 +51,7 @@ class QAPISourceInfo: return info def loc(self) -> str: - ret = self.fname - if self.line is not None: - ret += ':%d' % self.line - return ret + return f"{self.fname}:{self.line}" def in_defn(self) -> str: if self.defn_name: |