From 01d509a10050a29ead723c3af3161c941b71b6f2 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Thu, 12 Nov 2020 17:44:10 +0100 Subject: [PATCH] qmljs: improve code a bit Change-Id: Iea7bdb5c1a0340b60a3e9efd1e9369403af4fabd Reviewed-by: Tim Jenssen --- src/libs/qmljs/qmljsimportdependencies.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libs/qmljs/qmljsimportdependencies.cpp b/src/libs/qmljs/qmljsimportdependencies.cpp index ca84e700145..26b1e82526c 100644 --- a/src/libs/qmljs/qmljsimportdependencies.cpp +++ b/src/libs/qmljs/qmljsimportdependencies.cpp @@ -298,13 +298,13 @@ ImportMatchStrength ImportKey::matchImport(const ImportKey &o, const ViewerConte if (dirToFile) --lenPath1; int iSelector = 0; - int nSelectors = vContext.selectors.size(); + const int nSelectors = vContext.selectors.size(); while (iPath1 < lenPath1) { if (lenPath2 - iPath2 > lenPath1 - iPath1) return ImportMatchStrength(); - QString p1 = splitPath.at(iPath1); + const QString p1 = splitPath.at(iPath1); if (iPath2 < lenPath2) { - QString p2 = splitPath.at(iPath2); + const QString p2 = splitPath.at(iPath2); if (p1 == p2) { ++iPath1; ++iPath2; @@ -312,7 +312,7 @@ ImportMatchStrength ImportKey::matchImport(const ImportKey &o, const ViewerConte } } if (!p1.startsWith(QLatin1Char('+'))) - return QList(); + return ImportMatchStrength(); const QStringView selectorAtt(p1.constData() + 1, p1.size() - 1); while (iSelector < nSelectors) { if (selectorAtt == vContext.selectors.at(iSelector)) @@ -320,16 +320,16 @@ ImportMatchStrength ImportKey::matchImport(const ImportKey &o, const ViewerConte ++iSelector; } if (iSelector == nSelectors) - return QList(); + return ImportMatchStrength(); res << (nSelectors - iSelector); ++iSelector; ++iPath1; } if (iPath2 != lenPath2) - return QList(); + return ImportMatchStrength(); if (res.isEmpty()) res << 0; - return ImportMatchStrength(res); + return ImportMatchStrength(res); } int ImportKey::compare(const ImportKey &other) const