diff options
author | Lars Knoll <lars.knoll@qt.io> | 2016-11-29 15:23:34 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2016-12-06 13:01:38 +0000 |
commit | 83aa1933c82333b7ec5128442ac9ee2161387491 (patch) | |
tree | b80507888b817e05c795fbd4b917fc00412b6827 /src/qml | |
parent | e31e72925f857be56c77b494c0fa10e55de72cfc (diff) |
Add a sourceLocation() accessor to QV4::Function
Change-Id: I3a38ee44ce46c2416ceef153ce631bc15fd461fe
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/jsruntime/qv4function_p.h | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4function_p.h b/src/qml/jsruntime/qv4function_p.h index 6e0ba9d764..12094a0943 100644 --- a/src/qml/jsruntime/qv4function_p.h +++ b/src/qml/jsruntime/qv4function_p.h @@ -51,6 +51,7 @@ // #include "qv4global_p.h" +#include <private/qqmlglobal_p.h> #include <private/qv4compileddata_p.h> QT_BEGIN_NAMESPACE @@ -89,6 +90,11 @@ struct Q_QML_EXPORT Function { inline bool needsActivation() const { return activationRequired; } + QQmlSourceLocation sourceLocation() const + { + return QQmlSourceLocation(sourceFile(), compiledFunction->location.line, compiledFunction->location.column); + } + }; } diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 28a9949464..8e84eaebe7 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -237,10 +237,8 @@ QQmlSourceLocation FunctionObject::sourceLocation() const Q_ASSERT(as<const QV4::QQmlBindingFunction>()); return *static_cast<QV4::Heap::QQmlBindingFunction *>(d())->bindingLocation; } - QV4::Function *function = d()->function; - Q_ASSERT(function); - return QQmlSourceLocation(function->sourceFile(), function->compiledFunction->location.line, function->compiledFunction->location.column); + return d()->function->sourceLocation(); } DEFINE_OBJECT_VTABLE(FunctionCtor); |