diff options
author | Lars Knoll <lars.knoll@qt.io> | 2016-12-02 09:50:36 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2016-12-09 14:01:23 +0000 |
commit | f9b8436a07534867686627b656418d62f75ba3e5 (patch) | |
tree | 896411a3196df42ebfda4e61b9335dabf01958e8 /src/qml/qml/qqmlbinding.cpp | |
parent | d7ef2aa02c9ba736104fe973bfce7d87e30f81af (diff) |
Mostly use the QV4::Function in javascript expressions
Move the function() accessor from QQmlBoundSIgnal to
QQmlJavaScriptExpression. Change the profiler to
operate on QV4::Function objects for binding profiling.
Change-Id: Ic7ce83c487ceb69cad4b16e3dab42026238b7e82
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlbinding.cpp')
-rw-r--r-- | src/qml/qml/qqmlbinding.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp index 5f0f2eabcc..c7d185ff9a 100644 --- a/src/qml/qml/qqmlbinding.cpp +++ b/src/qml/qml/qqmlbinding.cpp @@ -155,13 +155,11 @@ void QQmlBinding::update(QQmlPropertyData::WriteFlags flags) QQmlEnginePrivate *ep = QQmlEnginePrivate::get(context()->engine); QV4::Scope scope(ep->v4engine()); - QV4::ScopedFunctionObject f(scope, m_function.value()); - Q_ASSERT(f); if (canUseAccessor()) flags.setFlag(QQmlPropertyData::BypassInterceptor); - QQmlBindingProfiler prof(ep->profiler, this, f); + QQmlBindingProfiler prof(ep->profiler, this, function()); doUpdate(watcher, flags, scope); if (!watcher.wasDeleted()) @@ -420,14 +418,10 @@ QVariant QQmlBinding::evaluate() QString QQmlBinding::expressionIdentifier() { - QQmlEnginePrivate *ep = QQmlEnginePrivate::get(context()->engine); - QV4::Scope scope(ep->v4engine()); - QV4::ScopedValue f(scope, m_function.value()); - QV4::Function *function = f->as<QV4::FunctionObject>()->function(); - - QString url = function->sourceFile(); - quint16 lineNumber = function->compiledFunction->location.line; - quint16 columnNumber = function->compiledFunction->location.column; + auto f = function(); + QString url = f->sourceFile(); + quint16 lineNumber = f->compiledFunction->location.line; + quint16 columnNumber = f->compiledFunction->location.column; return url + QString::asprintf(":%u:%u", uint(lineNumber), uint(columnNumber)); } @@ -458,9 +452,7 @@ void QQmlBinding::setEnabled(bool e, QQmlPropertyData::WriteFlags flags) QString QQmlBinding::expression() const { - QV4::Scope scope(QQmlEnginePrivate::get(context()->engine)->v4engine()); - QV4::ScopedValue v(scope, m_function.value()); - return v->toQStringNoThrow(); + return QStringLiteral("function() { [code] }"); } void QQmlBinding::setTarget(const QQmlProperty &prop) |