Fix equalitySemantics sub-test in qqmlecmascript::sequenceConversionArray
authorSimon Hausmann <simon.hausmann@digia.com>
Fri, 7 Jun 2013 20:09:28 +0000 (22:09 +0200)
committerLars Knoll <lars.knoll@digia.com>
Sat, 8 Jun 2013 20:37:28 +0000 (22:37 +0200)
Implement Managed::isEqualTo correctly

Change-Id: Ife4e2bf368037910614401e2ffa0c334b6581e30
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/qml/v4/qv4sequenceobject.cpp

index 2f7fe99..c936dba 100644 (file)
@@ -296,6 +296,19 @@ public:
         return true;
     }
 
+    bool containerIsEqualTo(Managed *other)
+    {
+        QQmlSequence<Container> *otherSequence = other->as<QQmlSequence<Container> >();
+        if (!otherSequence)
+            return false;
+        if (m_isReference && otherSequence->m_isReference) {
+            return m_object == otherSequence->m_object && m_propertyIndex == otherSequence->m_propertyIndex;
+        } else if (!m_isReference && !otherSequence->m_isReference) {
+            return this == otherSequence;
+        }
+        return false;
+    }
+
     void sort(QV4::SimpleCallContext *ctx)
     {
         if (m_isReference) {
@@ -443,6 +456,8 @@ private:
     { return static_cast<QQmlSequence<Container> *>(that)->containerQueryIndexed(ctx, index); }
     static bool deleteIndexedProperty(QV4::Managed *that, QV4::ExecutionContext *ctx, uint index)
     { return static_cast<QQmlSequence<Container> *>(that)->containerDeleteIndexedProperty(ctx, index); }
+    static bool isEqualTo(Managed *that, Managed *other)
+    { return static_cast<QQmlSequence<Container> *>(that)->containerIsEqualTo(other); }
 
     static void destroy(Managed *that)
     {