Commit 19239e37 authored by Tim Jenssen's avatar Tim Jenssen

QmlJs: use initilizer_lists for pairs

Change-Id: I0386d57ad3549814ab197c4e24549705e061c95a
Reviewed-by: Thomas Hartmann's avatarThomas Hartmann <thomas.hartmann@qt.io>
parent c2ebce68
......@@ -1397,11 +1397,11 @@ bool Check::visit(CaseBlock *ast)
{
QList< QPair<SourceLocation, StatementList *> > clauses;
for (CaseClauses *it = ast->clauses; it; it = it->next)
clauses += qMakePair(it->clause->caseToken, it->clause->statements);
clauses += {it->clause->caseToken, it->clause->statements};
if (ast->defaultClause)
clauses += qMakePair(ast->defaultClause->defaultToken, ast->defaultClause->statements);
clauses += {ast->defaultClause->defaultToken, ast->defaultClause->statements};
for (CaseClauses *it = ast->moreClauses; it; it = it->next)
clauses += qMakePair(it->clause->caseToken, it->clause->statements);
clauses += {it->clause->caseToken, it->clause->statements};
// check all but the last clause for fallthrough
for (int i = 0; i < clauses.size() - 1; ++i) {
......
......@@ -1232,7 +1232,7 @@ void ModelManagerInterface::queueCppQmlTypeUpdate(const CPlusPlus::Document::Ptr
QPair<CPlusPlus::Document::Ptr, bool> prev = m_queuedCppDocuments.value(doc->fileName());
if (prev.first && prev.second)
prev.first->releaseSourceAndAST();
m_queuedCppDocuments.insert(doc->fileName(), qMakePair(doc, scan));
m_queuedCppDocuments.insert(doc->fileName(), {doc, scan});
m_updateCppQmlTypesTimer->start();
}
......
......@@ -107,7 +107,7 @@ public:
typedef QHash<QString, QPair<QString, int> > Table;
void insert(const QString &fileName, const QString &source, int revision = 0)
{ _elements.insert(fileName, qMakePair(source, revision)); }
{ _elements.insert(fileName, {source, revision}); }
bool contains(const QString &fileName) const
{ return _elements.contains(fileName); }
......
......@@ -487,7 +487,7 @@ QrcParser::Ptr QrcCachePrivate::addPath(const QString &path, const QString &cont
QPair<QrcParser::Ptr,int> currentValue;
{
QMutexLocker l(&m_mutex);
currentValue = m_cache.value(path, qMakePair(QrcParser::Ptr(0), 0));
currentValue = m_cache.value(path, {QrcParser::Ptr(0), 0});
currentValue.second += 1;
if (currentValue.second > 1) {
m_cache.insert(path, currentValue);
......@@ -499,7 +499,7 @@ QrcParser::Ptr QrcCachePrivate::addPath(const QString &path, const QString &cont
qCWarning(qmljsLog) << "adding invalid qrc " << path << " to the cache:" << newParser->errorMessages();
{
QMutexLocker l(&m_mutex);
QPair<QrcParser::Ptr,int> currentValue = m_cache.value(path, qMakePair(QrcParser::Ptr(0), 0));
QPair<QrcParser::Ptr,int> currentValue = m_cache.value(path, {QrcParser::Ptr(0), 0});
if (currentValue.first.isNull())
currentValue.first = newParser;
currentValue.second += 1;
......@@ -513,7 +513,7 @@ void QrcCachePrivate::removePath(const QString &path)
QPair<QrcParser::Ptr,int> currentValue;
{
QMutexLocker l(&m_mutex);
currentValue = m_cache.value(path, qMakePair(QrcParser::Ptr(0), 0));
currentValue = m_cache.value(path, {QrcParser::Ptr(0), 0});
if (currentValue.second == 1) {
m_cache.remove(path);
} else if (currentValue.second > 1) {
......@@ -530,7 +530,7 @@ QrcParser::Ptr QrcCachePrivate::updatePath(const QString &path, const QString &c
QrcParser::Ptr newParser = QrcParser::parseQrcFile(path, contents);
{
QMutexLocker l(&m_mutex);
QPair<QrcParser::Ptr,int> currentValue = m_cache.value(path, qMakePair(QrcParser::Ptr(0), 0));
QPair<QrcParser::Ptr,int> currentValue = m_cache.value(path, {QrcParser::Ptr(0), 0});
currentValue.first = newParser;
if (currentValue.second == 0)
currentValue.second = 1; // add qrc files that are not in the resources of a project
......@@ -542,7 +542,7 @@ QrcParser::Ptr QrcCachePrivate::updatePath(const QString &path, const QString &c
QrcParser::Ptr QrcCachePrivate::parsedPath(const QString &path)
{
QMutexLocker l(&m_mutex);
QPair<QrcParser::Ptr,int> currentValue = m_cache.value(path, qMakePair(QrcParser::Ptr(0), 0));
QPair<QrcParser::Ptr,int> currentValue = m_cache.value(path, {QrcParser::Ptr(0), 0});
return currentValue.first;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment