aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4function.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4function.cpp')
-rw-r--r--src/qml/jsruntime/qv4function.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp
index bcc776dc98..78fb46327a 100644
--- a/src/qml/jsruntime/qv4function.cpp
+++ b/src/qml/jsruntime/qv4function.cpp
@@ -38,12 +38,14 @@
****************************************************************************/
#include "qv4function_p.h"
+#include "qv4functionobject_p.h"
#include "qv4managed_p.h"
#include "qv4string_p.h"
#include "qv4value_p.h"
#include "qv4engine_p.h"
#include "qv4lookup_p.h"
#include <private/qv4mm_p.h>
+#include <private/qqmljavascriptexpression_p.h>
QT_BEGIN_NAMESPACE
@@ -117,4 +119,26 @@ void Function::updateInternalClass(ExecutionEngine *engine, const QList<QByteArr
canUseSimpleCall = false;
}
+
+// Do a call with this execution context as the outer scope
+ReturnedValue Function::call(const FunctionObject *f, CallData *callData, Heap::ExecutionContext *context, Function *function)
+{
+ ExecutionEngine *engine = context->internalClass->engine;
+
+ if (!function->canUseSimpleCall) {
+ context = ExecutionContext::newCallContext(context, function, callData);
+ if (f)
+ static_cast<Heap::CallContext *>(context)->function.set(engine, f->d());
+ }
+
+ ReturnedValue res = function->execute(context, callData, f);
+
+ if (function->hasQmlDependencies) {
+ Q_ASSERT(context->type == Heap::ExecutionContext::Type_QmlContext);
+ QQmlPropertyCapture::registerQmlDependencies(static_cast<Heap::QmlContext *>(context), engine, function->compiledFunction);
+ }
+
+ return res;
+}
+
QT_END_NAMESPACE