aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4script.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-09-13 13:43:15 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-20 14:26:12 +0200
commit7def3cfb31603b47a1b4e5690f8c650768f9b803 (patch)
treeb7aa966470f960fed20a366cf7c77a0357082eb5 /src/qml/jsruntime/qv4script.cpp
parent5c4c9123917fb411598807cd9bb855b9aa1fa832 (diff)
[new compiler] Fix function and binding expression setup
Binding expressions and QML used to be set up so that they were written as function closure: (function(...) { expression here }) and then evaluated inside qml scope. With the new setup we do that closure setup manually now. For that we have to define a dummy outter "context scope" function in the codegen, that will later be used to look up the context ids. Change-Id: I0656419d67a1728451fcd46f402b03979f118b0b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4script.cpp')
-rw-r--r--src/qml/jsruntime/qv4script.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index ad83a52d8f..7dd3bbeb66 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -75,11 +75,26 @@ QmlBindingWrapper::QmlBindingWrapper(ExecutionContext *scope, Function *f, Objec
scope->engine->popContext();
}
+QmlBindingWrapper::QmlBindingWrapper(ExecutionContext *scope, Object *qml)
+ : FunctionObject(scope, scope->engine->id_eval)
+ , qml(qml)
+{
+ vtbl = &static_vtbl;
+ function = 0;
+ usesArgumentsObject = false;
+ needsActivation = false;
+ defineReadonlyProperty(scope->engine->id_length, Value::fromInt32(1));
+
+ qmlContext = scope->engine->current->newQmlContext(this, qml);
+ scope->engine->popContext();
+}
+
ReturnedValue QmlBindingWrapper::call(Managed *that, CallData *)
{
ExecutionEngine *engine = that->engine();
Scope scope(engine);
QmlBindingWrapper *This = static_cast<QmlBindingWrapper *>(that);
+ Q_ASSERT(This->function);
CallContext *ctx = This->qmlContext;
std::fill(ctx->locals, ctx->locals + ctx->function->varCount, Value::undefinedValue());