diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-06-18 13:12:31 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-08-10 01:21:48 +0000 |
commit | 416c0f32632ef1393350e45a29311d7881828993 (patch) | |
tree | 153255dd7da943bb17ed34942206735ca6808c2f /src/qml/jsruntime/qv4engine.cpp | |
parent | 9100b85cc54bc26d1218623ad0f65978c1600b2c (diff) |
Add ability to retrieve and use the QmlContext from our generated code
Our generated code (JIT and interpreter) should operate on the
QML context to retrieve QML related things. That's better than
operating on 4 different temps.
So this commit introduces the QML context as a temp in the
code we generate for QML. The next commits will move things over
to use that context with specialized runtime methods instead of
using generic subscript/get calls on the different subobjects.
Change-Id: Ia05cf339de9cdd23003f35cf78ede17d2590f8de
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 016187f488..a55755c6d1 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -720,7 +720,7 @@ Heap::Object *ExecutionEngine::newForEachIteratorObject(Object *o) return obj->d(); } -Heap::QmlContextWrapper *ExecutionEngine::qmlContextObject() const +Heap::QmlContext *ExecutionEngine::qmlContext() const { Heap::ExecutionContext *ctx = currentContext(); @@ -737,8 +737,14 @@ Heap::QmlContextWrapper *ExecutionEngine::qmlContextObject() const if (ctx->type != Heap::ExecutionContext::Type_QmlContext) return 0; - Q_ASSERT(static_cast<Heap::QmlContext *>(ctx)->qml); - return static_cast<Heap::QmlContext *>(ctx)->qml; + return static_cast<Heap::QmlContext *>(ctx); +} + +Heap::QmlContextWrapper *ExecutionEngine::qmlContextObject() const +{ + Heap::QmlContext *ctx = qmlContext(); + Q_ASSERT(ctx->qml); + return ctx->qml; } QObject *ExecutionEngine::qmlScopeObject() const |