diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-04-17 01:01:42 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-04-17 07:58:19 +0200 |
commit | 761d23806633cb32613f2ddf11711b3a71650eb1 (patch) | |
tree | 900fd3ff412cbb74c9213f7369deafc64aabb5c5 /src/qml/compiler | |
parent | 8bc3329e2cec4638fa9af274a40dda176bbb7352 (diff) | |
parent | 259c958e21c63f227a1bb678867210e0f6af0991 (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
tests/auto/qml/qv4assembler/tst_qv4assembler.cpp
Change-Id: I9d31c982881a617099354bf8acceb76332f11496
Diffstat (limited to 'src/qml/compiler')
-rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 2 | ||||
-rw-r--r-- | src/qml/compiler/qv4compilercontext_p.h | 1 | ||||
-rw-r--r-- | src/qml/compiler/qv4compilerscanfunctions.cpp | 27 |
3 files changed, 17 insertions, 13 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index e6d079fe36..c0ce125741 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -900,6 +900,8 @@ bool ResolvedTypeReference::addToHash(QCryptographicHash *hash, QQmlEngine *engi hash->addData(createPropertyCache(engine)->checksum(&ok)); return ok; } + if (!compilationUnit) + return false; hash->addData(compilationUnit->unitData()->md5Checksum, sizeof(compilationUnit->unitData()->md5Checksum)); return true; } diff --git a/src/qml/compiler/qv4compilercontext_p.h b/src/qml/compiler/qv4compilercontext_p.h index cb20ea9d57..57ef4be36e 100644 --- a/src/qml/compiler/qv4compilercontext_p.h +++ b/src/qml/compiler/qv4compilercontext_p.h @@ -217,7 +217,6 @@ struct Context { bool usesThis = false; bool innerFunctionAccessesThis = false; bool innerFunctionAccessesNewTarget = false; - bool hasTry = false; bool returnsClosure = false; mutable bool argumentsCanEscape = false; bool requiresExecutionContext = false; diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp index 04593f202a..8984b6931e 100644 --- a/src/qml/compiler/qv4compilerscanfunctions.cpp +++ b/src/qml/compiler/qv4compilerscanfunctions.cpp @@ -741,9 +741,9 @@ void ScanFunctions::calcEscapingVariables() if (c->contextType != ContextType::ESModule) continue; for (const auto &entry: c->exportEntries) { - auto m = c->members.find(entry.localName); - if (m != c->members.end()) - m->canEscape = true; + auto mIt = c->members.constFind(entry.localName); + if (mIt != c->members.constEnd()) + mIt->canEscape = true; } break; } @@ -759,8 +759,8 @@ void ScanFunctions::calcEscapingVariables() } Q_ASSERT(c != inner); while (c) { - Context::MemberMap::const_iterator it = c->members.find(var); - if (it != c->members.end()) { + Context::MemberMap::const_iterator it = c->members.constFind(var); + if (it != c->members.constEnd()) { if (c->parent || it->isLexicallyScoped()) { it->canEscape = true; c->requiresExecutionContext = true; @@ -816,15 +816,17 @@ void ScanFunctions::calcEscapingVariables() // add an escaping 'this' variable c->addLocalVar(QStringLiteral("this"), Context::VariableDefinition, VariableScope::Let); c->requiresExecutionContext = true; - auto m = c->members.find(QStringLiteral("this")); - m->canEscape = true; + auto mIt = c->members.constFind(QStringLiteral("this")); + Q_ASSERT(mIt != c->members.constEnd()); + mIt->canEscape = true; } if (c->innerFunctionAccessesNewTarget) { // add an escaping 'new.target' variable c->addLocalVar(QStringLiteral("new.target"), Context::VariableDefinition, VariableScope::Let); c->requiresExecutionContext = true; - auto m = c->members.find(QStringLiteral("new.target")); - m->canEscape = true; + auto mIt = c->members.constFind(QStringLiteral("new.target")); + Q_ASSERT(mIt != c->members.constEnd()); + mIt->canEscape = true; } if (c->allVarsEscape && c->contextType == ContextType::Block && c->members.isEmpty()) c->allVarsEscape = false; @@ -845,8 +847,9 @@ void ScanFunctions::calcEscapingVariables() } if (c->contextType == ContextType::Block && c->isCatchBlock) { c->requiresExecutionContext = true; - auto m = c->members.find(c->caughtVariable); - m->canEscape = true; + auto mIt = c->members.constFind(c->caughtVariable); + Q_ASSERT(mIt != c->members.constEnd()); + mIt->canEscape = true; } const QLatin1String exprForOn("expression for on"); if (c->contextType == ContextType::Binding && c->name.length() > exprForOn.size() && @@ -855,7 +858,7 @@ void ScanFunctions::calcEscapingVariables() // we don't know if the code is a signal handler or not. c->requiresExecutionContext = true; if (c->allVarsEscape) { - for (auto &m : c->members) + for (const auto &m : qAsConst(c->members)) m.canEscape = true; } } |