diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-10-10 11:15:55 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-10-10 20:04:11 +0200 |
commit | bdc12f241118304a644f433bc3b75085c27a261d (patch) | |
tree | 4bf35f77cc474e347fa449425ff5624cb76a1978 /tools/qmllint/qmljstypedescriptionreader.cpp | |
parent | 1bddf29287b4c42c321688376147d14bfecb46a1 (diff) |
Remove QQmlJS::AST::UiImport::versionToken
It was incorrectly parsed in case of "as Foo", and it was mostly unused.
Change-Id: Ie833a8eb247108cb7bcd6ca3e6f3e5df614461cf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tools/qmllint/qmljstypedescriptionreader.cpp')
-rw-r--r-- | tools/qmllint/qmljstypedescriptionreader.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/tools/qmllint/qmljstypedescriptionreader.cpp b/tools/qmllint/qmljstypedescriptionreader.cpp index 44a0d6f8b7..b8aecdddb1 100644 --- a/tools/qmllint/qmljstypedescriptionreader.cpp +++ b/tools/qmllint/qmljstypedescriptionreader.cpp @@ -123,15 +123,13 @@ void TypeDescriptionReader::readDocument(UiProgram *ast) return; } - ComponentVersion version; - const QString versionString = _source.mid(import->versionToken.offset, import->versionToken.length); - const int dotIdx = versionString.indexOf(QLatin1Char('.')); - if (dotIdx != -1) { - version = ComponentVersion(versionString.leftRef(dotIdx).toInt(), - versionString.midRef(dotIdx + 1).toInt()); - } - if (version.majorVersion() != 1) { - addError(import->versionToken, tr("Major version different from 1 not supported.")); + if (!import->version) { + addError(import->firstSourceLocation(), tr("Import statement without version.")); + return; + } + + if (import->version->majorVersion != 1) { + addError(import->version->firstSourceLocation(), tr("Major version different from 1 not supported.")); return; } |