Remove some duplicated code
authorLars Knoll <lars.knoll@digia.com>
Tue, 5 Feb 2013 15:15:38 +0000 (16:15 +0100)
committerErik Verbruggen <erik.verbruggen@digia.com>
Wed, 6 Feb 2013 14:51:47 +0000 (15:51 +0100)
Change-Id: I02857ad6ab74bb70aebe1b6b74c21171e8d87d03
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
src/v4/qmljs_runtime.cpp
src/v4/qv4object.h

index d01d76d..e192b40 100644 (file)
@@ -616,7 +616,7 @@ void __qmljs_set_element(ExecutionContext *ctx, Value object, Value index, Value
 
     uint idx = index.asArrayIndex();
     if (idx < UINT_MAX) {
-        PropertyDescriptor *p = o->nonSparseArrayAtRef(idx);
+        PropertyDescriptor *p = o->nonSparseArrayAt(idx);
         if (p && p->type == PropertyDescriptor::Data && p->isWritable()) {
             p->value = value;
             return;
index 948948b..c9a4337 100644 (file)
@@ -283,7 +283,7 @@ public:
         return true;
     }
 
-    PropertyDescriptor *arrayAt(uint index) {
+    PropertyDescriptor *arrayAt(uint index) const {
         if (!sparseArray) {
             if (index >= arrayDataLen)
                 return 0;
@@ -296,7 +296,7 @@ public:
         }
     }
 
-    const PropertyDescriptor *nonSparseArrayAt(uint index) const {
+    PropertyDescriptor *nonSparseArrayAt(uint index) const {
         if (sparseArray)
             return 0;
         if (index >= arrayDataLen)
@@ -304,27 +304,6 @@ public:
         return arrayData + index;
     }
 
-    PropertyDescriptor *nonSparseArrayAtRef(uint index) {
-        if (sparseArray)
-            return 0;
-        if (index >= arrayDataLen)
-            return 0;
-        return arrayData + index;
-    }
-
-    const PropertyDescriptor *arrayAt(uint index) const {
-        if (!sparseArray) {
-            if (index >= arrayDataLen)
-                return 0;
-            return arrayData + index;
-        } else {
-            SparseArrayNode *n = sparseArray->findNode(index);
-            if (!n)
-                return 0;
-            return arrayData + n->value;
-        }
-    }
-
     void markArrayObjects() const;
 
     PropertyDescriptor *front() {