aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2016-12-05 13:28:26 +0100
committerLars Knoll <lars.knoll@qt.io>2016-12-09 14:02:05 +0000
commit91ac4a8d099d10fdfd5aa631da02727b7917d85f (patch)
tree27b7b6c9a0fbf41fac184423ce70682a4d6a3b43 /src
parent3d582fd5c17b011a606001fe8635e732e4609328 (diff)
Don't store a source location in the QQmlBindingFunction anymore
It's not needed anymore as we now store this in the binding directly. Change-Id: I518c83207f219b690f31200e4d17251075bbd322 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp5
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp2
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp1
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper.cpp2
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp6
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions_p.h8
6 files changed, 5 insertions, 19 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 0f2a0ebf86..5bbe2d5f9a 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -212,11 +212,6 @@ bool FunctionObject::isBoundFunction() const
QQmlSourceLocation FunctionObject::sourceLocation() const
{
- if (isBinding()) {
- Q_ASSERT(as<const QV4::QQmlBindingFunction>());
- return *static_cast<QV4::Heap::QQmlBindingFunction *>(d())->bindingLocation;
- }
-
return d()->function->sourceLocation();
}
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 235f2fee5a..888983d7c7 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -391,9 +391,9 @@ void QObjectWrapper::setProperty(ExecutionEngine *engine, QObject *object, QQmlP
QQmlContextData *callingQmlContext = scope.engine->callingQmlContext();
QV4::Scoped<QQmlBindingFunction> bindingFunction(scope, (const Value &)f);
- bindingFunction->initBindingLocation();
newBinding = QQmlBinding::create(property, f, object, callingQmlContext);
+ newBinding->setSourceLocation(bindingFunction->currentLocation());
newBinding->setTarget(object, *property, nullptr);
}
}
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp
index a9e309396e..e10b4ef946 100644
--- a/src/qml/qml/qqmljavascriptexpression.cpp
+++ b/src/qml/qml/qqmljavascriptexpression.cpp
@@ -464,7 +464,6 @@ void QQmlJavaScriptExpression::setFunctionObject(const QV4::FunctionObject *o)
m_v4Function = o->d()->function;
if (o->isBinding()) {
const QV4::QQmlBindingFunction *b = static_cast<const QV4::QQmlBindingFunction *>(o);
- setSourceLocation(*b->d()->bindingLocation);
m_v4Function = b->d()->originalFunction->function;
}
Q_ASSERT(m_v4Function);
diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp
index fe1bd584de..4ce7f67760 100644
--- a/src/qml/qml/qqmlvaluetypewrapper.cpp
+++ b/src/qml/qml/qqmlvaluetypewrapper.cpp
@@ -453,9 +453,9 @@ void QQmlValueTypeWrapper::put(Managed *m, String *name, const Value &value)
cacheData.setCoreIndex(reference->d()->property);
QV4::Scoped<QQmlBindingFunction> bindingFunction(scope, (const Value &)f);
- bindingFunction->initBindingLocation();
QQmlBinding *newBinding = QQmlBinding::create(&cacheData, f, reference->d()->object, context);
+ newBinding->setSourceLocation(bindingFunction->currentLocation());
newBinding->setTarget(reference->d()->object, cacheData, pd);
QQmlPropertyPrivate::setBinding(newBinding);
return;
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index 7bab2415c5..aa2b8a24ec 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -1304,15 +1304,13 @@ ReturnedValue QtObject::method_locale(CallContext *ctx)
void Heap::QQmlBindingFunction::init(const QV4::FunctionObject *originalFunction)
{
QV4::Heap::FunctionObject::init(originalFunction->scope(), originalFunction->name());
- bindingLocation = new QQmlSourceLocation;
this->originalFunction = originalFunction->d();
}
-void QQmlBindingFunction::initBindingLocation()
+QQmlSourceLocation QQmlBindingFunction::currentLocation() const
{
QV4::StackFrame frame = engine()->currentStackFrame();
- d()->bindingLocation->sourceFile = frame.source;
- d()->bindingLocation->line = frame.line;
+ return QQmlSourceLocation(frame.source, frame.line, 0);
}
void QQmlBindingFunction::call(const Managed *that, Scope &scope, CallData *callData)
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
index f84c819e6a..dc2cd04cbe 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
@@ -82,13 +82,7 @@ struct ConsoleObject : Object {
struct QQmlBindingFunction : FunctionObject {
void init(const QV4::FunctionObject *originalFunction);
- void destroy() {
- delete bindingLocation;
- Object::destroy();
- }
Pointer<FunctionObject> originalFunction;
- // Set when the binding is created later
- QQmlSourceLocation *bindingLocation;
};
}
@@ -187,7 +181,7 @@ struct QQmlBindingFunction : public QV4::FunctionObject
V4_OBJECT2(QQmlBindingFunction, FunctionObject)
V4_NEEDS_DESTROY
- void initBindingLocation(); // from caller stack trace
+ QQmlSourceLocation currentLocation() const; // from caller stack trace
static void call(const Managed *that, Scope &scope, CallData *callData);