Remove the context argument from Managed::putIndexed
authorLars Knoll <lars.knoll@digia.com>
Fri, 21 Jun 2013 21:42:08 +0000 (23:42 +0200)
committerSimon Hausmann <simon.hausmann@digia.com>
Sat, 22 Jun 2013 19:45:58 +0000 (21:45 +0200)
Change-Id: If311140333a1c45be6c6d5464d43898e09eb4322
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
12 files changed:
src/qml/qml/v4/qv4arrayobject.cpp
src/qml/qml/v4/qv4managed_p.h
src/qml/qml/v4/qv4object.cpp
src/qml/qml/v4/qv4object_p.h
src/qml/qml/v4/qv4regexp.cpp
src/qml/qml/v4/qv4regexp_p.h
src/qml/qml/v4/qv4runtime.cpp
src/qml/qml/v4/qv4sequenceobject.cpp
src/qml/qml/v4/qv4string.cpp
src/qml/qml/v4/qv4string_p.h
src/qml/qml/v8/qjsvalue.cpp
src/quick/items/context2d/qquickcontext2d.cpp

index 5263048..4a36f66 100644 (file)
@@ -287,7 +287,7 @@ Value ArrayPrototype::method_push(SimpleCallContext *ctx)
         }
     } else {
         for (uint i = 0; i < ctx->argumentCount; ++i)
-            instance->putIndexed(ctx, len + i, ctx->argument(i));
+            instance->putIndexed(len + i, ctx->argument(i));
         len += ctx->argumentCount;
     }
     if (instance->isArrayObject())
@@ -313,11 +313,11 @@ Value ArrayPrototype::method_reverse(SimpleCallContext *ctx)
         Value lval = instance->getIndexed(lo, &loExists);
         Value hval = instance->getIndexed(hi, &hiExists);
         if (hiExists)
-            instance->putIndexed(ctx, lo, hval);
+            instance->putIndexed(lo, hval);
         else
             instance->deleteIndexedProperty(lo);
         if (loExists)
-            instance->putIndexed(ctx, hi, lval);
+            instance->putIndexed(hi, lval);
         else
             instance->deleteIndexedProperty(hi);
     }
@@ -368,7 +368,7 @@ Value ArrayPrototype::method_shift(SimpleCallContext *ctx)
             bool exists;
             Value v = instance->getIndexed(k, &exists);
             if (exists)
-                instance->putIndexed(ctx, k - 1, v);
+                instance->putIndexed(k - 1, v);
             else
                 instance->deleteIndexedProperty(k - 1);
         }
@@ -527,12 +527,12 @@ Value ArrayPrototype::method_unshift(SimpleCallContext *ctx)
             bool exists;
             Value v = instance->getIndexed(k - 1, &exists);
             if (exists)
-                instance->putIndexed(ctx, k + ctx->argumentCount - 1, v);
+                instance->putIndexed(k + ctx->argumentCount - 1, v);
             else
                 instance->deleteIndexedProperty(k + ctx->argumentCount - 1);
         }
         for (uint i = 0; i < ctx->argumentCount; ++i)
-            instance->putIndexed(ctx, i, ctx->argument(i));
+            instance->putIndexed(i, ctx->argument(i));
     }
 
     uint newLen = len + ctx->argumentCount;
index 4a8410c..6061f92 100644 (file)
@@ -108,7 +108,7 @@ struct ManagedVTable
     Value (*get)(Managed *, String *name, bool *hasProperty);
     Value (*getIndexed)(Managed *, uint index, bool *hasProperty);
     void (*put)(Managed *, ExecutionContext *ctx, String *name, const Value &value);
-    void (*putIndexed)(Managed *, ExecutionContext *ctx, uint index, const Value &value);
+    void (*putIndexed)(Managed *, uint index, const Value &value);
     PropertyAttributes (*query)(const Managed *, String *name);
     PropertyAttributes (*queryIndexed)(const Managed *, uint index);
     bool (*deleteProperty)(Managed *m, String *name);
@@ -266,8 +266,8 @@ public:
     Value getIndexed(uint index, bool *hasProperty = 0);
     void put(ExecutionContext *ctx, String *name, const Value &value)
     { vtbl->put(this, ctx, name, value); }
-    void putIndexed(ExecutionContext *ctx, uint index, const Value &value)
-    { vtbl->putIndexed(this, ctx, index, value); }
+    void putIndexed(uint index, const Value &value)
+    { vtbl->putIndexed(this, index, value); }
     PropertyAttributes query(String *name) const
     { return vtbl->query(this, name); }
     PropertyAttributes queryIndexed(uint index) const
index 18bea21..85171b8 100644 (file)
@@ -182,7 +182,7 @@ void Object::inplaceBinOp(ExecutionContext *ctx, BinOp op, const Value &index, c
         Value v = getIndexed(idx, &hasProperty);
         Value result;
         op(ctx, &result, v, rhs);
-        putIndexed(ctx, idx, result);
+        putIndexed(idx, result);
         return;
     }
     String *name = index.toString(ctx);
@@ -409,9 +409,9 @@ void Object::put(Managed *m, ExecutionContext *ctx, String *name, const Value &v
     static_cast<Object *>(m)->internalPut(ctx, name, value);
 }
 
-void Object::putIndexed(Managed *m, ExecutionContext *ctx, uint index, const Value &value)
+void Object::putIndexed(Managed *m, uint index, const Value &value)
 {
-    static_cast<Object *>(m)->internalPutIndexed(ctx, index, value);
+    static_cast<Object *>(m)->internalPutIndexed(index, value);
 }
 
 PropertyAttributes Object::query(const Managed *m, String *name)
@@ -649,7 +649,7 @@ void Object::internalPut(ExecutionContext *ctx, String *name, const Value &value
 {
     uint idx = name->asArrayIndex();
     if (idx != UINT_MAX)
-        return putIndexed(ctx, idx, value);
+        return putIndexed(idx, value);
 
     name->makeIdentifier(ctx);
 
@@ -725,7 +725,7 @@ void Object::internalPut(ExecutionContext *ctx, String *name, const Value &value
     }
 }
 
-void Object::internalPutIndexed(ExecutionContext *ctx, uint index, const Value &value)
+void Object::internalPutIndexed(uint index, const Value &value)
 {
     Property *pd = 0;
     PropertyAttributes attrs;
@@ -783,7 +783,7 @@ void Object::internalPutIndexed(ExecutionContext *ctx, uint index, const Value &
 
         Value args[1];
         args[0] = value;
-        pd->setter()->call(ctx, Value::fromObject(this), args, 1);
+        pd->setter()->call(engine()->current, Value::fromObject(this), args, 1);
         return;
     }
 
@@ -791,8 +791,8 @@ void Object::internalPutIndexed(ExecutionContext *ctx, uint index, const Value &
     return;
 
   reject:
-    if (ctx->strictMode)
-        ctx->throwTypeError();
+    if (engine()->current->strictMode)
+        engine()->current->throwTypeError();
 }
 
 // Section 8.12.7
index 9505d29..287513d 100644 (file)
@@ -334,7 +334,7 @@ public:
     inline void put(String *name, const Value &v)
     { vtbl->put(this, engine()->current, name, v); }
     inline void putIndexed(uint idx, const Value &v)
-    { vtbl->putIndexed(this, engine()->current, idx, v); }
+    { vtbl->putIndexed(this, idx, v); }
     using Managed::get;
     using Managed::getIndexed;
     using Managed::put;
@@ -353,7 +353,7 @@ protected:
     static Value get(Managed *m, String *name, bool *hasProperty);
     static Value getIndexed(Managed *m, uint index, bool *hasProperty);
     static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value);
-    static void putIndexed(Managed *m, ExecutionContext *ctx, uint index, const Value &value);
+    static void putIndexed(Managed *m, uint index, const Value &value);
     static PropertyAttributes query(const Managed *m, String *name);
     static PropertyAttributes queryIndexed(const Managed *m, uint index);
     static bool deleteProperty(Managed *m, String *name);
@@ -367,7 +367,7 @@ private:
     Value internalGet(String *name, bool *hasProperty);
     Value internalGetIndexed(uint index, bool *hasProperty);
     void internalPut(ExecutionContext *ctx, String *name, const Value &value);
-    void internalPutIndexed(ExecutionContext *ctx, uint index, const Value &value);
+    void internalPutIndexed(uint index, const Value &value);
     bool internalDeleteProperty(String *name);
     bool internalDeleteIndexedProperty(uint index);
 
index 33b962e..621ed89 100644 (file)
@@ -150,7 +150,7 @@ void RegExp::put(Managed *m, ExecutionContext *ctx, String *name, const Value &v
 {
 }
 
-void RegExp::putIndexed(Managed *m, ExecutionContext *ctx, uint index, const Value &value)
+void RegExp::putIndexed(Managed *m, uint index, const Value &value)
 {
 }
 
index 52a998a..ff6d30c 100644 (file)
@@ -114,7 +114,7 @@ protected:
     static Value get(Managed *m, String *name, bool *hasProperty);
     static Value getIndexed(Managed *m, uint index, bool *hasProperty);
     static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value);
-    static void putIndexed(Managed *m, ExecutionContext *ctx, uint index, const Value &value);
+    static void putIndexed(Managed *m, uint index, const Value &value);
     static PropertyAttributes query(const Managed *m, String *name);
     static PropertyAttributes queryIndexed(const Managed *m, uint index);
     static bool deleteProperty(Managed *, String *);
index 02dd67a..af4a6e7 100644 (file)
@@ -631,7 +631,7 @@ void __qmljs_set_element(ExecutionContext *ctx, const Value &object, const Value
                 return;
             }
         }
-        o->putIndexed(ctx, idx, value);
+        o->putIndexed(idx, value);
         return;
     }
 
@@ -1097,7 +1097,7 @@ void __qmljs_builtin_post_increment_element(ExecutionContext *context, Value *re
         v = Value::fromDouble(d + 1);
     }
 
-    o->putIndexed(context, idx, v);
+    o->putIndexed(idx, v);
 }
 
 void __qmljs_builtin_post_decrement(Value *result, Value *val)
@@ -1177,7 +1177,7 @@ void __qmljs_builtin_post_decrement_element(ExecutionContext *context, Value *re
         v = Value::fromDouble(d - 1);
     }
 
-    o->putIndexed(context, idx, v);
+    o->putIndexed(idx, v);
 }
 
 ExecutionContext *__qmljs_builtin_push_with_scope(const Value &o, ExecutionContext *ctx)
index cce1957..f4758c6 100644 (file)
@@ -222,11 +222,11 @@ public:
         return QV4::Value::undefinedValue();
     }
 
-    void containerPutIndexed(QV4::ExecutionContext *ctx, uint index, const QV4::Value &value)
+    void containerPutIndexed(uint index, const QV4::Value &value)
     {
         /* Qt containers have int (rather than uint) allowable indexes. */
         if (index > INT_MAX) {
-            generateWarning(ctx, QLatin1String("Index out of range during indexed set"));
+            generateWarning(engine()->current, QLatin1String("Index out of range during indexed set"));
             return;
         }
 
@@ -486,8 +486,8 @@ private:
 
     static QV4::Value getIndexed(QV4::Managed *that, uint index, bool *hasProperty)
     { return static_cast<QQmlSequence<Container> *>(that)->containerGetIndexed(index, hasProperty); }
-    static void putIndexed(Managed *that, QV4::ExecutionContext *ctx, uint index, const QV4::Value &value)
-    { static_cast<QQmlSequence<Container> *>(that)->containerPutIndexed(ctx, index, value); }
+    static void putIndexed(Managed *that, uint index, const QV4::Value &value)
+    { static_cast<QQmlSequence<Container> *>(that)->containerPutIndexed(index, value); }
     static QV4::PropertyAttributes queryIndexed(const QV4::Managed *that, uint index)
     { return static_cast<const QQmlSequence<Container> *>(that)->containerQueryIndexed(index); }
     static bool deleteIndexedProperty(QV4::Managed *that, uint index)
index 33d9b7d..ed01efa 100644 (file)
@@ -151,11 +151,11 @@ void String::put(Managed *m, ExecutionContext *ctx, String *name, const Value &v
     o->put(ctx, name, value);
 }
 
-void String::putIndexed(Managed *m, ExecutionContext *ctx, uint index, const Value &value)
+void String::putIndexed(Managed *m, uint index, const Value &value)
 {
     String *that = static_cast<String *>(m);
-    Object *o = ctx->engine->newStringObject(Value::fromString(that));
-    o->putIndexed(ctx, index, value);
+    Object *o = m->engine()->newStringObject(Value::fromString(that));
+    o->putIndexed(index, value);
 }
 
 PropertyAttributes String::query(const Managed *m, String *name)
index 3fee3a0..bafeb21 100644 (file)
@@ -123,7 +123,7 @@ protected:
     static Value get(Managed *m, String *name, bool *hasProperty);
     static Value getIndexed(Managed *m, uint index, bool *hasProperty);
     static void put(Managed *m, ExecutionContext *ctx, String *name, const Value &value);
-    static void putIndexed(Managed *m, ExecutionContext *ctx, uint index, const Value &value);
+    static void putIndexed(Managed *m, uint index, const Value &value);
     static PropertyAttributes query(const Managed *m, String *name);
     static PropertyAttributes queryIndexed(const Managed *m, uint index);
     static bool deleteProperty(Managed *, String *);
index 28234af..df54418 100644 (file)
@@ -901,7 +901,7 @@ void QJSValue::setProperty(quint32 arrayIndex, const QJSValue& value)
     QV4::ExecutionContext *ctx = engine->current;
     try {
         if (arrayIndex != UINT_MAX)
-            o->putIndexed(ctx, arrayIndex, value.d->getValue(engine));
+            o->putIndexed(arrayIndex, value.d->getValue(engine));
         else
             o->put(ctx, engine->id_uintMax, value.d->getValue(engine));
     } catch (QV4::Exception &e) {
index f670faa..d7d956d 100644 (file)
@@ -596,7 +596,7 @@ struct QQuickJSContext2DPixelData : public QV4::Object
         static_cast<QQuickJSContext2DPixelData *>(that)->~QQuickJSContext2DPixelData();
     }
     static QV4::Value getIndexed(QV4::Managed *m, uint index, bool *hasProperty);
-    static void putIndexed(QV4::Managed *m, QV4::ExecutionContext *ctx, uint index, const QV4::Value &value);
+    static void putIndexed(QV4::Managed *m, uint index, const QV4::Value &value);
 
     static QV4::Value proto_get_length(QV4::SimpleCallContext *ctx);
 
@@ -2709,11 +2709,11 @@ QV4::Value QQuickJSContext2DPixelData::getIndexed(QV4::Managed *m, uint index, b
     return QV4::Value::undefinedValue();
 }
 
-void QQuickJSContext2DPixelData::putIndexed(QV4::Managed *m, QV4::ExecutionContext *ctx, uint index, const QV4::Value &value)
+void QQuickJSContext2DPixelData::putIndexed(QV4::Managed *m, uint index, const QV4::Value &value)
 {
     QQuickJSContext2DPixelData *r = m->as<QQuickJSContext2DPixelData>();
     if (!r)
-        ctx->throwTypeError();
+        m->engine()->current->throwTypeError();
 
     const int v = value.toInt32();
     if (r && index < static_cast<quint32>(r->image.width() * r->image.height() * 4) && v >= 0 && v <= 255) {