diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-26 22:07:27 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-30 08:05:38 +0200 |
commit | aacebc74b2d6d982caa4ba0952fd848ffdc54c7a (patch) | |
tree | d71c8520255ee7309641e7ace32f6dbf677c3183 /src/qml/jsruntime/qv4objectproto.cpp | |
parent | 72af16f7f48fec3d13e6537953d723cc7a50841e (diff) |
Remove more occurrences of QV4::Value
Change-Id: I66c370680d7e6bee2e73a7a940aa96ab4009ec57
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4objectproto.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4objectproto.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp index 02f8cb6e95..65fd2188ac 100644 --- a/src/qml/jsruntime/qv4objectproto.cpp +++ b/src/qml/jsruntime/qv4objectproto.cpp @@ -91,7 +91,7 @@ ReturnedValue ObjectCtor::construct(Managed *that, CallData *callData) obj->setPrototype(proto.getPointer()); return obj.asReturnedValue(); } - return Value::fromReturnedValue(__qmljs_to_object(v4->current, ValueRef(&callData->args[0]))).asReturnedValue(); + return __qmljs_to_object(v4->current, ValueRef(&callData->args[0])); } ReturnedValue ObjectCtor::call(Managed *m, CallData *callData) @@ -220,6 +220,7 @@ ReturnedValue ObjectPrototype::method_defineProperties(SimpleCallContext *ctx) ctx->throwTypeError(); Scoped<Object> o(scope, ctx->argument(1), Scoped<Object>::Convert); + ScopedValue val(scope); ObjectIterator it(o.getPointer(), ObjectIterator::EnumerableOnly); while (1) { @@ -233,7 +234,8 @@ ReturnedValue ObjectPrototype::method_defineProperties(SimpleCallContext *ctx) break; Property n; PropertyAttributes nattrs; - toPropertyDescriptor(ctx, Value::fromReturnedValue(o->getValue(pd, attrs)), &n, &nattrs); + val = o->getValue(pd, attrs); + toPropertyDescriptor(ctx, val, &n, &nattrs); bool ok; if (name) ok = O->__defineOwnProperty__(ctx, name, n, nattrs); @@ -541,7 +543,7 @@ ReturnedValue ObjectPrototype::method_set_proto(SimpleCallContext *ctx) return Encode::undefined(); } -void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, Value v, Property *desc, PropertyAttributes *attrs) +void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, const ValueRef v, Property *desc, PropertyAttributes *attrs) { Scope scope(ctx); ScopedObject o(scope, v); @@ -551,12 +553,13 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, Value v, Prope attrs->clear(); desc->setGetter(0); desc->setSetter(0); + ScopedValue tmp(scope); if (o->__hasProperty__(ctx->engine->id_enumerable)) - attrs->setEnumerable(Value::fromReturnedValue(o->get(ctx->engine->id_enumerable)).toBoolean()); + attrs->setEnumerable((tmp = o->get(ctx->engine->id_enumerable))->toBoolean()); if (o->__hasProperty__(ctx->engine->id_configurable)) - attrs->setConfigurable(Value::fromReturnedValue(o->get(ctx->engine->id_configurable)).toBoolean()); + attrs->setConfigurable((tmp = o->get(ctx->engine->id_configurable))->toBoolean()); if (o->__hasProperty__(ctx->engine->id_get)) { ScopedValue get(scope, o->get(ctx->engine->id_get)); @@ -587,7 +590,7 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, Value v, Prope if (o->__hasProperty__(ctx->engine->id_writable)) { if (attrs->isAccessor()) ctx->throwTypeError(); - attrs->setWritable(Value::fromReturnedValue(o->get(ctx->engine->id_writable)).toBoolean()); + attrs->setWritable((tmp = o->get(ctx->engine->id_writable))->toBoolean()); // writable forces it to be a data descriptor desc->value = Primitive::undefinedValue(); } @@ -595,7 +598,7 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, Value v, Prope if (o->__hasProperty__(ctx->engine->id_value)) { if (attrs->isAccessor()) ctx->throwTypeError(); - desc->value = Value::fromReturnedValue(o->get(ctx->engine->id_value)); + desc->value = o->get(ctx->engine->id_value); attrs->setType(PropertyAttributes::Data); } @@ -613,7 +616,7 @@ ReturnedValue ObjectPrototype::fromPropertyDescriptor(ExecutionContext *ctx, con Scope scope(engine); // Let obj be the result of creating a new object as if by the expression new Object() where Object // is the standard built-in constructor with that name. - Scoped<Object> o(scope, engine->newObject()); + ScopedObject o(scope, engine->newObject()); ScopedString s(scope); Property pd; @@ -625,10 +628,10 @@ ReturnedValue ObjectPrototype::fromPropertyDescriptor(ExecutionContext *ctx, con s = engine->newString(QStringLiteral("writable")); o->__defineOwnProperty__(ctx, s, pd, Attr_Data); } else { - pd.value = desc->getter() ? Value::fromObject(desc->getter()) : Primitive::undefinedValue(); + pd.value = desc->getter() ? desc->getter()->asReturnedValue() : Encode::undefined(); s = engine->newString(QStringLiteral("get")); o->__defineOwnProperty__(ctx, s, pd, Attr_Data); - pd.value = desc->setter() ? Value::fromObject(desc->setter()) : Primitive::undefinedValue(); + pd.value = desc->setter() ? desc->setter()->asReturnedValue() : Encode::undefined(); s = engine->newString(QStringLiteral("set")); o->__defineOwnProperty__(ctx, s, pd, Attr_Data); } |