More Utils::toSet/toList

... and unrelated cosmetic changes.

Change-Id: I591b17fd5289831e701b683f8fb47816efd1fa67
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-07-03 18:34:30 +02:00
parent 599b03179e
commit 6a58666f44
49 changed files with 138 additions and 105 deletions

View File

@@ -29,6 +29,7 @@
#include "qmljsutils.h"
#include "parser/qmljsast_p.h"
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <QColor>
@@ -666,7 +667,7 @@ Check::Check(Document::Ptr doc, const ContextPtr &context)
_isQtQuick2 = isQtQuick2();
}
_enabledMessages = Message::allMessageTypes().toSet();
_enabledMessages = Utils::toSet(Message::allMessageTypes());
disableMessage(HintAnonymousFunctionSpacing);
disableMessage(HintDeclareVarsInOneLine);
disableMessage(HintDeclarationsShouldBeAtStartOfFunction);
@@ -1539,7 +1540,7 @@ void Check::scanCommentsForAnnotations()
// enable all checks annotation
if (comment.contains("@enable-all-checks"))
_enabledMessages = Message::allMessageTypes().toSet();
_enabledMessages = Utils::toSet(Message::allMessageTypes());
// find all disable annotations
int lastOffset = -1;

View File

@@ -27,6 +27,7 @@
#include "qmljsinterpreter.h"
#include "qmljsviewercontext.h"
#include <utils/algorithm.h>
#include <utils/qrcparser.h>
#include <utils/qtcassert.h>
@@ -521,7 +522,7 @@ QByteArray DependencyInfo::calculateFingerprint(const ImportDependencies &deps)
{
QCryptographicHash hash(QCryptographicHash::Sha1);
rootImport.addToHash(hash);
QStringList coreImports = allCoreImports.toList();
QStringList coreImports = Utils::toList(allCoreImports);
coreImports.sort();
foreach (const QString importId, coreImports) {
hash.addData(reinterpret_cast<const char*>(importId.constData()), importId.size() * sizeof(QChar));
@@ -529,9 +530,9 @@ QByteArray DependencyInfo::calculateFingerprint(const ImportDependencies &deps)
hash.addData(coreImportFingerprint);
}
hash.addData("/", 1);
QList<ImportKey> imports(allImports.toList());
QList<ImportKey> imports = Utils::toList(allImports);
std::sort(imports.begin(), imports.end());
foreach (const ImportKey &k, imports)
for (const ImportKey &k : qAsConst(imports))
k.addToHash(hash);
return hash.result();
}