diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-09 13:38:10 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-11 13:02:23 +0200 |
commit | 262d7261033df7650938c38401112a4767d926ff (patch) | |
tree | 8a9ecd61f546d40afa796e5ec3e786301fba1258 /src/qml/jsruntime/qv4dateobject.cpp | |
parent | 6324e987e23b4fefc622f1fc6493baa1a3e47ee9 (diff) |
Continue conversion to using scoped values
This converts all methods in qv4runtime_p.h to not
use raw values in arguments anymore.
The conversion of return values will be done in a separate
commit.
Change-Id: Ie6e8f3bed459d09cb831f7f87920b7eada161502
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4dateobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4dateobject.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp index 5d9abfe74e..1ef4aec246 100644 --- a/src/qml/jsruntime/qv4dateobject.cpp +++ b/src/qml/jsruntime/qv4dateobject.cpp @@ -662,16 +662,17 @@ Value DateCtor::construct(Managed *m, CallData *callData) t = currentTime(); else if (callData->argc == 1) { - Value arg = callData->args[0]; - if (DateObject *d = arg.asDateObject()) + ValueScope scope(m->engine()); + ScopedValue arg(scope, callData->args[0]); + if (DateObject *d = arg->asDateObject()) arg = d->value; else arg = __qmljs_to_primitive(arg, PREFERREDTYPE_HINT); - if (arg.isString()) - t = ParseString(arg.stringValue()->toQString()); + if (arg->isString()) + t = ParseString(arg->stringValue()->toQString()); else - t = TimeClip(arg.toNumber()); + t = TimeClip(arg->toNumber()); } else { // d.argc > 1 @@ -1290,13 +1291,14 @@ Value DatePrototype::method_toISOString(SimpleCallContext *ctx) Value DatePrototype::method_toJSON(SimpleCallContext *ctx) { - Value O = __qmljs_to_object(ctx, ctx->thisObject); - Value tv = __qmljs_to_primitive(O, NUMBER_HINT); + ValueScope scope(ctx); + ScopedValue O(scope, __qmljs_to_object(ctx, ValueRef(&ctx->thisObject))); + ScopedValue tv(scope, __qmljs_to_primitive(O, NUMBER_HINT)); - if (tv.isNumber() && !std::isfinite(tv.toNumber())) + if (tv->isNumber() && !std::isfinite(tv->toNumber())) return Value::nullValue(); - FunctionObject *toIso = O.objectValue()->get(ctx->engine->newString(QStringLiteral("toISOString"))).asFunctionObject(); + FunctionObject *toIso = O->objectValue()->get(ctx->engine->newString(QStringLiteral("toISOString"))).asFunctionObject(); if (!toIso) ctx->throwTypeError(); |