From 1ababa4a756dc4cc0ae474b15cccfbfa8727e505 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 5 Dec 2016 15:02:43 +0100 Subject: Get rid of QQmlJavaScriptExpression::setFunctionObject() It was only used in one place now, and the code is actually cleaner when calling setupFunction() instead. Change-Id: Idfe2842b81e765569f2c70f3d5dcd1862442a2ee Reviewed-by: Simon Hausmann --- src/qml/qml/qqmlboundsignal.cpp | 3 ++- src/qml/qml/qqmljavascriptexpression.cpp | 12 ------------ src/qml/qml/qqmljavascriptexpression_p.h | 1 - 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index 2b0b3f8048..c4af82133a 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -100,7 +100,8 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, function += QLatin1String(") { ") + expression + QLatin1String(" })"); QV4::Scope valueScope(v4); QV4::ScopedFunctionObject f(valueScope, evalFunction(context(), scopeObject(), function, fileName, line)); - setFunctionObject(f); + QV4::ScopedContext context(valueScope, f->scope()); + setupFunction(context, f->function()); } QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, QQmlContextData *ctxt, QObject *scopeObject, diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index c521e0793a..17cccc0bbd 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -454,18 +454,6 @@ void QQmlJavaScriptExpression::createQmlBinding(QQmlContextData *ctxt, QObject * setupFunction(qmlContext, script.vmFunction); } -void QQmlJavaScriptExpression::setFunctionObject(const QV4::FunctionObject *o) -{ - if (!o) - return; - - m_qmlScope.set(o->engine(), o->d()->scope); - - m_v4Function = o->d()->function; - Q_ASSERT(m_v4Function); - m_compilationUnit = m_v4Function->compilationUnit; -} - void QQmlJavaScriptExpression::setupFunction(QV4::ExecutionContext *qmlContext, QV4::Function *f) { if (!qmlContext || !f) diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h index 8cbaf891a4..0724038382 100644 --- a/src/qml/qml/qqmljavascriptexpression_p.h +++ b/src/qml/qml/qqmljavascriptexpression_p.h @@ -159,7 +159,6 @@ protected: } } - void setFunctionObject(const QV4::FunctionObject *o); void setupFunction(QV4::ExecutionContext *qmlContext, QV4::Function *f); private: -- cgit v1.2.3