From bdc12f241118304a644f433bc3b75085c27a261d Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 10 Oct 2019 11:15:55 +0200 Subject: 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 Reviewed-by: Simon Hausmann --- tools/qmllint/qmljstypedescriptionreader.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'tools/qmllint/qmljstypedescriptionreader.cpp') 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; } -- cgit v1.2.3