diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2025-08-27 14:09:06 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2025-09-01 19:25:21 +0200 |
| commit | 64d64968956410990f4ef702a92f820a31f68a29 (patch) | |
| tree | f4938734f90ceafd3968f4b0efc73486939807bf /src/qml/jsruntime/qv4sequenceobject.cpp | |
| parent | 2ce3b7bf0a2ee94593273ae897dd91e3cef21eba (diff) | |
QtQml: Accept Heap::Sequence in doGetIndexed()
It only operates on the heap object anyway.
Pick-to: 6.10 6.9 6.8
Task-number: QTBUG-129972
Task-number: QTBUG-139025
Change-Id: I7e6c232fd68893429533e1b10363ef9922a33ae7
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4sequenceobject.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4sequenceobject.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp index 4cb620d496..1bc4e1fdff 100644 --- a/src/qml/jsruntime/qv4sequenceobject.cpp +++ b/src/qml/jsruntime/qv4sequenceobject.cpp @@ -22,8 +22,8 @@ namespace QV4 { DEFINE_OBJECT_VTABLE(Sequence); -static ReturnedValue doGetIndexed(const Sequence *s, qsizetype index) { - Heap::Sequence *p = s->d(); +static ReturnedValue doGetIndexed(Heap::Sequence *p, qsizetype index) +{ QV4::Scope scope(p->internalClass->engine); const QMetaType valueMetaType = p->valueMetaType(); @@ -89,8 +89,7 @@ struct SequenceOwnPropertyKeyIterator : ObjectOwnPropertyKeyIterator ~SequenceOwnPropertyKeyIterator() override = default; PropertyKey next(const Object *o, Property *pd = nullptr, PropertyAttributes *attrs = nullptr) override { - const Sequence *s = static_cast<const Sequence *>(o); - Heap::Sequence *p = s->d(); + Heap::Sequence *p = static_cast<const Sequence *>(o)->d(); if (p->isReference() && !p->loadReference()) return PropertyKey::invalid(); @@ -102,7 +101,7 @@ struct SequenceOwnPropertyKeyIterator : ObjectOwnPropertyKeyIterator if (attrs) *attrs = QV4::Attr_Data; if (pd) - pd->value = doGetIndexed(s, index); + pd->value = doGetIndexed(p, index); return PropertyKey::fromArrayIndex(index); } @@ -310,8 +309,7 @@ ReturnedValue Sequence::virtualGet(const Managed *that, PropertyKey id, const Va return false; } - const Sequence *s = static_cast<const Sequence *>(that); - Heap::Sequence *p = s->d(); + Heap::Sequence *p = static_cast<const Sequence *>(that)->d(); if (p->isReference() && !p->loadReference()) return Encode::undefined(); @@ -320,7 +318,7 @@ ReturnedValue Sequence::virtualGet(const Managed *that, PropertyKey id, const Va if (index < sizeInline(p)) { if (hasProperty) *hasProperty = true; - return doGetIndexed(s, index); + return doGetIndexed(p, index); } if (hasProperty) |
