diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2025-08-27 13:52:41 +0200 |
|---|---|---|
| committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2025-09-02 12:01:37 +0000 |
| commit | 5375910a510cf0b1e73d1f89fbe6d42789077a76 (patch) | |
| tree | 3eb81bafba2bf9d673a54d3ad10402cf57264b9d | |
| parent | 53d9acf7fa44bfb906f55846047460e5c34fa3ca (diff) | |
QtQml: Inline Sequence::containerIsEqualTo into its only user
We don't want to expose it from Sequence's interface.
Pick-to: 6.8
Task-number: QTBUG-129972
Task-number: QTBUG-139025
Change-Id: Iae144bb8a66a24660dd8da490edb0b4bd7cdc81e
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
(cherry picked from commit 476ee7f5a3b1c4ac027f8dbba35e864158c57d17)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 585b01ae37b63569602c5f4a1af6acfb6bfb11d2)
| -rw-r--r-- | src/qml/jsruntime/qv4sequenceobject.cpp | 38 | ||||
| -rw-r--r-- | src/qml/jsruntime/qv4sequenceobject_p.h | 2 |
2 files changed, 21 insertions, 19 deletions
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp index c9159b038c..ab8fbe21cf 100644 --- a/src/qml/jsruntime/qv4sequenceobject.cpp +++ b/src/qml/jsruntime/qv4sequenceobject.cpp @@ -286,22 +286,6 @@ static void removeLastInline(Heap::Sequence *p, qsizetype num) } } -bool Sequence::containerIsEqualTo(Managed *other) -{ - if (!other) - return false; - Sequence *otherSequence = other->as<Sequence>(); - if (!otherSequence) - return false; - if (d()->object() && otherSequence->d()->object()) { - return d()->object() == otherSequence->d()->object() - && d()->property() == otherSequence->d()->property(); - } else if (!d()->object() && !otherSequence->d()->object()) { - return this == otherSequence; - } - return false; -} - bool Heap::Sequence::loadReference() { Q_ASSERT(object()); @@ -433,7 +417,27 @@ bool Sequence::virtualDeleteProperty(Managed *that, PropertyKey id) bool Sequence::virtualIsEqualTo(Managed *that, Managed *other) { - return static_cast<Sequence *>(that)->containerIsEqualTo(other); + if (!other) + return false; + + const Sequence *otherS = other->as<Sequence>(); + if (!otherS) + return false; + + const Sequence *s = static_cast<Sequence *>(that); + const Heap::Sequence *p = s->d(); + const Heap::Sequence *otherP = otherS->d(); + + const Heap::Object *object = p->object(); + const Heap::Object *otherObject = otherP->object(); + + if (object && otherObject) + return object == otherObject && p->property() == otherP->property(); + + if (!object && !otherObject) + return s == otherS; + + return false; } OwnPropertyKeyIterator *Sequence::virtualOwnPropertyKeys(const Object *m, Value *target) diff --git a/src/qml/jsruntime/qv4sequenceobject_p.h b/src/qml/jsruntime/qv4sequenceobject_p.h index 6fa7b3a499..5b08492103 100644 --- a/src/qml/jsruntime/qv4sequenceobject_p.h +++ b/src/qml/jsruntime/qv4sequenceobject_p.h @@ -123,8 +123,6 @@ public: static bool virtualIsEqualTo(Managed *that, Managed *other); static QV4::OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target); static int virtualMetacall(Object *object, QMetaObject::Call call, int index, void **a); - - bool containerIsEqualTo(Managed *other); }; } |
