diff options
Diffstat (limited to 'src/qml/jsruntime/qv4qmlcontext.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4qmlcontext.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp index e3069fdc06..d1b923fa36 100644 --- a/src/qml/jsruntime/qv4qmlcontext.cpp +++ b/src/qml/jsruntime/qv4qmlcontext.cpp @@ -150,13 +150,7 @@ ReturnedValue QQmlContextWrapper::getPropertyAndBase(const QQmlContextWrapper *r return Object::virtualGet(resource, id, receiver, hasProperty); } - bool hasProp = false; - ScopedValue result(scope, Object::virtualGet(resource, id, receiver, &hasProp)); - if (hasProp) { - if (hasProperty) - *hasProperty = hasProp; - return result->asReturnedValue(); - } + ScopedValue result(scope); // It's possible we could delay the calculation of the "actual" context (in the case // of sub contexts) until it is definitely needed. @@ -360,6 +354,16 @@ ReturnedValue QQmlContextWrapper::getPropertyAndBase(const QQmlContextWrapper *r lookup = nullptr; } + // Do the generic JS lookup late. + // The scope, context, types etc should be able to override it. + bool hasProp = false; + result = Object::virtualGet(resource, id, receiver, &hasProp); + if (hasProp) { + if (hasProperty) + *hasProperty = hasProp; + return result->asReturnedValue(); + } + // Do a lookup in the global object here to avoid expressionContext->unresolvedNames becoming // true if we access properties of the global object. if (originalLookup) { |