summaryrefslogtreecommitdiff
path: root/src/qml/jsruntime/qv4sequenceobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4sequenceobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index 2558e376b5..6aadf68c05 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -162,6 +162,8 @@ void Heap::Sequence::init(
QV4::Scope scope(internalClass->engine);
QV4::Scoped<QV4::Sequence> o(scope, this);
o->setArrayType(Heap::ArrayData::Custom);
+ if (CppStackFrame *frame = scope.engine->currentStackFrame)
+ setLocation(frame->v4Function, frame->statementNumber());
o->loadReference();
}
@@ -422,18 +424,19 @@ bool Sequence::sort(const FunctionObject *f, const Value *, const Value *argv, i
void *Sequence::getRawContainerPtr() const
{ return d()->storagePointer(); }
-void Sequence::loadReference() const
+bool Sequence::loadReference() const
{
Q_ASSERT(d()->object());
Q_ASSERT(d()->isReference());
- QV4::ReferenceObject::readReference(d());
+ // If locations are enforced we only read once
+ return d()->enforcesLocation() || QV4::ReferenceObject::readReference(d());
}
-void Sequence::storeReference()
+bool Sequence::storeReference()
{
Q_ASSERT(d()->object());
Q_ASSERT(d()->isReference());
- QV4::ReferenceObject::writeBack(d());
+ return d()->isAttachedToProperty() && QV4::ReferenceObject::writeBack(d());
}
ReturnedValue Sequence::virtualGet(const Managed *that, PropertyKey id, const Value *receiver, bool *hasProperty)