diff options
-rw-r--r-- | src/qml/compiler/qqmlirbuilder.cpp | 48 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 2 |
2 files changed, 23 insertions, 27 deletions
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp index 88accc2f49..883b21ab07 100644 --- a/src/qml/compiler/qqmlirbuilder.cpp +++ b/src/qml/compiler/qqmlirbuilder.cpp @@ -2279,42 +2279,38 @@ QV4::Compiler::Codegen::Reference JSCodeGen::fallbackNameLookup(const QString &n if (_scopeObject) { QQmlPropertyData *data = lookupQmlCompliantProperty(_scopeObject, name); - if (!data) - return Reference::fromName(this, name); - - Reference base = Reference::fromStackSlot(this, _qmlContextSlot); - Reference::PropertyCapturePolicy capturePolicy; - if (!data->isConstant() && !data->isQmlBinding()) - capturePolicy = Reference::CaptureAtRuntime; - else - capturePolicy = data->isConstant() ? Reference::DontCapture : Reference::CaptureAheadOfTime; - return Reference::fromQmlScopeObject(base, data->coreIndex(), data->notifyIndex(), capturePolicy); + if (data) { + Reference base = Reference::fromStackSlot(this, _qmlContextSlot); + Reference::PropertyCapturePolicy capturePolicy; + if (!data->isConstant() && !data->isQmlBinding()) + capturePolicy = Reference::CaptureAtRuntime; + else + capturePolicy = data->isConstant() ? Reference::DontCapture : Reference::CaptureAheadOfTime; + return Reference::fromQmlScopeObject(base, data->coreIndex(), data->notifyIndex(), capturePolicy); + } } if (_contextObject) { QQmlPropertyData *data = lookupQmlCompliantProperty(_contextObject, name); - if (!data) - return Reference::fromName(this, name); - - Reference base = Reference::fromStackSlot(this, _qmlContextSlot); - Reference::PropertyCapturePolicy capturePolicy; - if (!data->isConstant() && !data->isQmlBinding()) - capturePolicy = Reference::CaptureAtRuntime; - else - capturePolicy = data->isConstant() ? Reference::DontCapture : Reference::CaptureAheadOfTime; - return Reference::fromQmlContextObject(base, data->coreIndex(), data->notifyIndex(), capturePolicy); + if (data) { + Reference base = Reference::fromStackSlot(this, _qmlContextSlot); + Reference::PropertyCapturePolicy capturePolicy; + if (!data->isConstant() && !data->isQmlBinding()) + capturePolicy = Reference::CaptureAtRuntime; + else + capturePolicy = data->isConstant() ? Reference::DontCapture : Reference::CaptureAheadOfTime; + return Reference::fromQmlContextObject(base, data->coreIndex(), data->notifyIndex(), capturePolicy); + } } - if (m_globalNames.contains(name)) { - Reference r = Reference::fromName(this, name); + Reference r = Reference::fromName(this, name); + if (m_globalNames.contains(name)) r.global = true; - return r; - } + return r; #else Q_UNUSED(name) -#endif // V4_BOOTSTRAP - // fall back to name lookup at run-time. return Reference(); +#endif // V4_BOOTSTRAP } #ifndef V4_BOOTSTRAP diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 99306d8d15..cf3eecff6d 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -1600,7 +1600,7 @@ void tst_qqmlecmascript::aliasPropertyReset() // test that a manual write (of undefined) to a non-resettable property fails properly QUrl url = testFileUrl("aliasreset/aliasPropertyReset.error.1.qml"); - QString warning1 = url.toString() + QLatin1String(":15: Error: Cannot assign [undefined] to int"); + QString warning1 = url.toString() + QLatin1String(": Error: Cannot assign [undefined] to int"); QQmlComponent e1(&engine, url); object = e1.create(); QVERIFY(object != nullptr); |