aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlcontextwrapper.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-11-21 16:41:32 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-04 09:45:50 +0100
commit9306c05dd152511b8b938d7899a7bdf1aeb8d1c2 (patch)
tree514b6cda632244d7f9e7fdb1af143da05b7b1ce0 /src/qml/qml/qqmlcontextwrapper.cpp
parent0f32303e5cc9c539aa8698cab2b8cc2e946d885a (diff)
Encapsulate the current context and fix it's usage
Encapsulate accesses to the current context, and rework the way we push and pop this context from the context stack. Largely a cleanup, but simplifies the code in the long term Change-Id: I409e378490d0ab027be6a4c01a4031b2ea35c51d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlcontextwrapper.cpp')
-rw-r--r--src/qml/qml/qqmlcontextwrapper.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp
index 2814b2bbcf..b3c2105e68 100644
--- a/src/qml/qml/qqmlcontextwrapper.cpp
+++ b/src/qml/qml/qqmlcontextwrapper.cpp
@@ -137,7 +137,7 @@ ReturnedValue QmlContextWrapper::get(Managed *m, const StringRef name, bool *has
QV4::Scope scope(v4);
QmlContextWrapper *resource = m->as<QmlContextWrapper>();
if (!resource)
- return v4->current->throwTypeError();
+ return v4->currentContext()->throwTypeError();
// In V8 the JS global object would come _before_ the QML global object,
// so simulate that here.
@@ -246,7 +246,7 @@ ReturnedValue QmlContextWrapper::get(Managed *m, const StringRef name, bool *has
// Search scope object
if (scopeObject) {
bool hasProp = false;
- QV4::ScopedValue result(scope, QV4::QObjectWrapper::getQmlProperty(v4->current, context, scopeObject,
+ QV4::ScopedValue result(scope, QV4::QObjectWrapper::getQmlProperty(v4->currentContext(), context, scopeObject,
name.getPointer(), QV4::QObjectWrapper::CheckRevision, &hasProp));
if (hasProp) {
if (hasProperty)
@@ -260,7 +260,7 @@ ReturnedValue QmlContextWrapper::get(Managed *m, const StringRef name, bool *has
// Search context object
if (context->contextObject) {
bool hasProp = false;
- result = QV4::QObjectWrapper::getQmlProperty(v4->current, context, context->contextObject, name.getPointer(), QV4::QObjectWrapper::CheckRevision, &hasProp);
+ result = QV4::QObjectWrapper::getQmlProperty(v4->currentContext(), context, context->contextObject, name.getPointer(), QV4::QObjectWrapper::CheckRevision, &hasProp);
if (hasProp) {
if (hasProperty)
*hasProperty = true;
@@ -284,7 +284,7 @@ void QmlContextWrapper::put(Managed *m, const StringRef name, const ValueRef val
return;
QV4::Scoped<QmlContextWrapper> wrapper(scope, m->as<QmlContextWrapper>());
if (!wrapper) {
- v4->current->throwTypeError();
+ v4->currentContext()->throwTypeError();
return;
}
@@ -292,8 +292,8 @@ void QmlContextWrapper::put(Managed *m, const StringRef name, const ValueRef val
if (wrapper && wrapper->readOnly) {
QString error = QLatin1String("Invalid write to global property \"") + name->toQString() +
QLatin1Char('"');
- Scoped<String> e(scope, v4->current->engine->newString(error));
- v4->current->throwError(e);
+ Scoped<String> e(scope, v4->currentContext()->engine->newString(error));
+ v4->currentContext()->throwError(e);
return;
}
@@ -327,13 +327,13 @@ void QmlContextWrapper::put(Managed *m, const StringRef name, const ValueRef val
// Search scope object
if (scopeObject &&
- QV4::QObjectWrapper::setQmlProperty(v4->current, context, scopeObject, name.getPointer(), QV4::QObjectWrapper::CheckRevision, value))
+ QV4::QObjectWrapper::setQmlProperty(v4->currentContext(), context, scopeObject, name.getPointer(), QV4::QObjectWrapper::CheckRevision, value))
return;
scopeObject = 0;
// Search context object
if (context->contextObject &&
- QV4::QObjectWrapper::setQmlProperty(v4->current, context, context->contextObject, name.getPointer(), QV4::QObjectWrapper::CheckRevision, value))
+ QV4::QObjectWrapper::setQmlProperty(v4->currentContext(), context, context->contextObject, name.getPointer(), QV4::QObjectWrapper::CheckRevision, value))
return;
context = context->parent;
@@ -344,7 +344,7 @@ void QmlContextWrapper::put(Managed *m, const StringRef name, const ValueRef val
if (wrapper->readOnly) {
QString error = QLatin1String("Invalid write to global property \"") + name->toQString() +
QLatin1Char('"');
- v4->current->throwError(error);
+ v4->currentContext()->throwError(error);
return;
}