QtQml: Inline containerDeleteIndexedProperty into its only user

We don't want to expose it from Sequence's interface.

Pick-to: 6.10 6.9 6.8
Task-number: QTBUG-129972
Task-number: QTBUG-139025
Change-Id: I35c37ea1da675a83a1a8d3a4af08e4301c8cd60c
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
This commit is contained in:
Ulf Hermann 2025-08-27 13:45:27 +02:00
parent 308305c86a
commit 8953a873fa
2 changed files with 24 additions and 26 deletions

View File

@ -286,26 +286,6 @@ static void removeLastInline(Heap::Sequence *p, qsizetype num)
}
}
bool Sequence::containerDeleteIndexedProperty(qsizetype index)
{
Heap::Sequence *p = d();
if (p->isReadOnly())
return false;
if (p->isReference() && !p->loadReference())
return false;
if (index < 0 || index >= sizeInline(p))
return false;
/* according to ECMA262r3 it should be Undefined, */
/* but we cannot, so we insert a default-value instead. */
replaceInline(p, index, QVariant());
if (p->object())
p->storeReference();
return true;
}
bool Sequence::containerIsEqualTo(Managed *other)
{
if (!other)
@ -421,15 +401,34 @@ bool Sequence::virtualPut(Managed *that, PropertyKey id, const Value &value, Val
bool Sequence::virtualDeleteProperty(Managed *that, PropertyKey id)
{
if (id.isArrayIndex()) {
const uint index = id.asArrayIndex();
if (qIsAtMostSizetypeLimit(index))
return static_cast<Sequence *>(that)->containerDeleteIndexedProperty(qsizetype(index));
if (!id.isArrayIndex())
return ReferenceObject::virtualDeleteProperty(that, id);
const uint arrayIndex = id.asArrayIndex();
if (!qIsAtMostSizetypeLimit(arrayIndex)) {
generateWarning(that->engine(), QLatin1String("Index out of range during indexed delete"));
return false;
}
return Object::virtualDeleteProperty(that, id);
Heap::Sequence *p = static_cast<Sequence *>(that)->d();
if (p->isReadOnly())
return false;
if (p->isReference() && !p->loadReference())
return false;
const qsizetype index = arrayIndex;
if (index >= sizeInline(p))
return false;
/* according to ECMA262r3 it should be Undefined, */
/* but we cannot, so we insert a default-value instead. */
replaceInline(p, index, QVariant());
if (p->object())
p->storeReference();
return true;
}
bool Sequence::virtualIsEqualTo(Managed *that, Managed *other)

View File

@ -124,7 +124,6 @@ public:
static QV4::OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target);
static int virtualMetacall(Object *object, QMetaObject::Call call, int index, void **a);
bool containerDeleteIndexedProperty(qsizetype index);
bool containerIsEqualTo(Managed *other);
};