diff options
Diffstat (limited to 'src/qml/qml/qqmljavascriptexpression.cpp')
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index f81320aa6b..a694b43447 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -48,6 +48,7 @@ #include <private/qv4scopedvalue_p.h> #include <private/qqmlglobal_p.h> #include <private/qv4qobjectwrapper_p.h> +#include <private/qqmlbuiltinfunctions_p.h> QT_BEGIN_NAMESPACE @@ -131,6 +132,9 @@ void QQmlJavaScriptExpression::resetNotifyOnValueChanged() QQmlSourceLocation QQmlJavaScriptExpression::sourceLocation() const { return m_function.valueRef()->as<QV4::FunctionObject>()->sourceLocation(); + // Can't use the below yet, as the source location for bindings gnerated with Qt.binding() would be wrong. +// auto f = function(); +// return f ? f->sourceLocation() : QQmlSourceLocation(); } void QQmlJavaScriptExpression::setContext(QQmlContextData *context) @@ -154,6 +158,14 @@ void QQmlJavaScriptExpression::setContext(QQmlContextData *context) } } +QV4::Function *QQmlJavaScriptExpression::function() const +{ + QV4::FunctionObject *f = m_function.valueRef()->as<QV4::FunctionObject>(); + if (f && f->isBinding()) + return static_cast<QV4::QQmlBindingFunction *>(f)->d()->originalFunction->function; + return f ? f->function() : 0; +} + void QQmlJavaScriptExpression::refresh() { } |