From 4af39f1d8e2371ea5d913493b23eabffc1fb22c6 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 21 Jun 2013 23:42:08 +0200 Subject: [PATCH] Remove the context argument from Managed::putIndexed Change-Id: If311140333a1c45be6c6d5464d43898e09eb4322 Reviewed-by: Simon Hausmann --- src/qml/qml/v4/qv4arrayobject.cpp | 12 ++++++------ src/qml/qml/v4/qv4managed_p.h | 6 +++--- src/qml/qml/v4/qv4object.cpp | 16 ++++++++-------- src/qml/qml/v4/qv4object_p.h | 6 +++--- src/qml/qml/v4/qv4regexp.cpp | 2 +- src/qml/qml/v4/qv4regexp_p.h | 2 +- src/qml/qml/v4/qv4runtime.cpp | 6 +++--- src/qml/qml/v4/qv4sequenceobject.cpp | 8 ++++---- src/qml/qml/v4/qv4string.cpp | 6 +++--- src/qml/qml/v4/qv4string_p.h | 2 +- src/qml/qml/v8/qjsvalue.cpp | 2 +- src/quick/items/context2d/qquickcontext2d.cpp | 6 +++--- 12 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/qml/qml/v4/qv4arrayobject.cpp b/src/qml/qml/v4/qv4arrayobject.cpp index 5263048..4a36f66 100644 --- a/src/qml/qml/v4/qv4arrayobject.cpp +++ b/src/qml/qml/v4/qv4arrayobject.cpp @@ -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; diff --git a/src/qml/qml/v4/qv4managed_p.h b/src/qml/qml/v4/qv4managed_p.h index 4a8410c..6061f92 100644 --- a/src/qml/qml/v4/qv4managed_p.h +++ b/src/qml/qml/v4/qv4managed_p.h @@ -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 diff --git a/src/qml/qml/v4/qv4object.cpp b/src/qml/qml/v4/qv4object.cpp index 18bea21..85171b8 100644 --- a/src/qml/qml/v4/qv4object.cpp +++ b/src/qml/qml/v4/qv4object.cpp @@ -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(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(m)->internalPutIndexed(ctx, index, value); + static_cast(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 diff --git a/src/qml/qml/v4/qv4object_p.h b/src/qml/qml/v4/qv4object_p.h index 9505d29..287513d 100644 --- a/src/qml/qml/v4/qv4object_p.h +++ b/src/qml/qml/v4/qv4object_p.h @@ -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); diff --git a/src/qml/qml/v4/qv4regexp.cpp b/src/qml/qml/v4/qv4regexp.cpp index 33b962e..621ed89 100644 --- a/src/qml/qml/v4/qv4regexp.cpp +++ b/src/qml/qml/v4/qv4regexp.cpp @@ -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) { } diff --git a/src/qml/qml/v4/qv4regexp_p.h b/src/qml/qml/v4/qv4regexp_p.h index 52a998a..ff6d30c 100644 --- a/src/qml/qml/v4/qv4regexp_p.h +++ b/src/qml/qml/v4/qv4regexp_p.h @@ -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 *); diff --git a/src/qml/qml/v4/qv4runtime.cpp b/src/qml/qml/v4/qv4runtime.cpp index 02dd67a..af4a6e7 100644 --- a/src/qml/qml/v4/qv4runtime.cpp +++ b/src/qml/qml/v4/qv4runtime.cpp @@ -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) diff --git a/src/qml/qml/v4/qv4sequenceobject.cpp b/src/qml/qml/v4/qv4sequenceobject.cpp index cce1957..f4758c6 100644 --- a/src/qml/qml/v4/qv4sequenceobject.cpp +++ b/src/qml/qml/v4/qv4sequenceobject.cpp @@ -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 *>(that)->containerGetIndexed(index, hasProperty); } - static void putIndexed(Managed *that, QV4::ExecutionContext *ctx, uint index, const QV4::Value &value) - { static_cast *>(that)->containerPutIndexed(ctx, index, value); } + static void putIndexed(Managed *that, uint index, const QV4::Value &value) + { static_cast *>(that)->containerPutIndexed(index, value); } static QV4::PropertyAttributes queryIndexed(const QV4::Managed *that, uint index) { return static_cast *>(that)->containerQueryIndexed(index); } static bool deleteIndexedProperty(QV4::Managed *that, uint index) diff --git a/src/qml/qml/v4/qv4string.cpp b/src/qml/qml/v4/qv4string.cpp index 33d9b7d..ed01efa 100644 --- a/src/qml/qml/v4/qv4string.cpp +++ b/src/qml/qml/v4/qv4string.cpp @@ -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(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) diff --git a/src/qml/qml/v4/qv4string_p.h b/src/qml/qml/v4/qv4string_p.h index 3fee3a0..bafeb21 100644 --- a/src/qml/qml/v4/qv4string_p.h +++ b/src/qml/qml/v4/qv4string_p.h @@ -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 *); diff --git a/src/qml/qml/v8/qjsvalue.cpp b/src/qml/qml/v8/qjsvalue.cpp index 28234af..df54418 100644 --- a/src/qml/qml/v8/qjsvalue.cpp +++ b/src/qml/qml/v8/qjsvalue.cpp @@ -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) { diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index f670faa..d7d956d 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -596,7 +596,7 @@ struct QQuickJSContext2DPixelData : public QV4::Object static_cast(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(); if (!r) - ctx->throwTypeError(); + m->engine()->current->throwTypeError(); const int v = value.toInt32(); if (r && index < static_cast(r->image.width() * r->image.height() * 4) && v >= 0 && v <= 255) { -- 2.7.4