diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-12 11:13:03 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-18 13:13:47 +0200 |
commit | 16f92ad85cf665d863ded5eeaaa7fc3f90820b3f (patch) | |
tree | 74b3477b9d6c023730835f1c478ceb6eaec68a2b /src/qml/jsruntime/qv4numberobject.cpp | |
parent | 7d4e61dd824706984030c58684fa844ff9cde251 (diff) |
Convert builtin methods to return a ReturnedValue
Change-Id: I6b75adbf53a5be0deab023d2eed98ce2a7915551
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4numberobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4numberobject.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp index 0f62a68903..f335e73123 100644 --- a/src/qml/jsruntime/qv4numberobject.cpp +++ b/src/qml/jsruntime/qv4numberobject.cpp @@ -106,7 +106,7 @@ inline Value thisNumberValue(ExecutionContext *ctx) return n->value; } -Value NumberPrototype::method_toString(SimpleCallContext *ctx) +ReturnedValue NumberPrototype::method_toString(SimpleCallContext *ctx) { double num = thisNumberValue(ctx).asDouble(); @@ -116,13 +116,13 @@ Value NumberPrototype::method_toString(SimpleCallContext *ctx) if (radix < 2 || radix > 36) { ctx->throwError(QString::fromLatin1("Number.prototype.toString: %0 is not a valid radix") .arg(radix)); - return Value::undefinedValue(); + return Encode::undefined(); } if (std::isnan(num)) { - return Value::fromString(ctx, QStringLiteral("NaN")); + return Value::fromString(ctx, QStringLiteral("NaN")).asReturnedValue(); } else if (qIsInf(num)) { - return Value::fromString(ctx, QLatin1String(num < 0 ? "-Infinity" : "Infinity")); + return Value::fromString(ctx, QLatin1String(num < 0 ? "-Infinity" : "Infinity")).asReturnedValue(); } if (radix != 10) { @@ -152,28 +152,28 @@ Value NumberPrototype::method_toString(SimpleCallContext *ctx) } if (negative) str.prepend(QLatin1Char('-')); - return Value::fromString(ctx, str); + return Value::fromString(ctx, str).asReturnedValue(); } } String *str = Value::fromDouble(num).toString(ctx); - return Value::fromString(str); + return Value::fromString(str).asReturnedValue(); } -Value NumberPrototype::method_toLocaleString(SimpleCallContext *ctx) +ReturnedValue NumberPrototype::method_toLocaleString(SimpleCallContext *ctx) { Value v = thisNumberValue(ctx); String *str = v.toString(ctx); - return Value::fromString(str); + return Value::fromString(str).asReturnedValue(); } -Value NumberPrototype::method_valueOf(SimpleCallContext *ctx) +ReturnedValue NumberPrototype::method_valueOf(SimpleCallContext *ctx) { - return thisNumberValue(ctx); + return thisNumberValue(ctx).asReturnedValue(); } -Value NumberPrototype::method_toFixed(SimpleCallContext *ctx) +ReturnedValue NumberPrototype::method_toFixed(SimpleCallContext *ctx) { double v = thisNumberValue(ctx).asDouble(); @@ -196,11 +196,11 @@ Value NumberPrototype::method_toFixed(SimpleCallContext *ctx) else if (v < 1.e21) str = QString::number(v, 'f', int (fdigits)); else - return Value::fromReturnedValue(__qmljs_string_from_number(ctx, v)); - return Value::fromString(ctx, str); + return __qmljs_string_from_number(ctx, v); + return Value::fromString(ctx, str).asReturnedValue(); } -Value NumberPrototype::method_toExponential(SimpleCallContext *ctx) +ReturnedValue NumberPrototype::method_toExponential(SimpleCallContext *ctx) { double d = thisNumberValue(ctx).asDouble(); @@ -220,10 +220,10 @@ Value NumberPrototype::method_toExponential(SimpleCallContext *ctx) double_conversion::DoubleToStringConverter::EcmaScriptConverter().ToExponential(d, fdigits, &builder); QString result = QString::fromLatin1(builder.Finalize()); - return Value::fromString(ctx, result); + return Value::fromString(ctx, result).asReturnedValue(); } -Value NumberPrototype::method_toPrecision(SimpleCallContext *ctx) +ReturnedValue NumberPrototype::method_toPrecision(SimpleCallContext *ctx) { Scope scope(ctx); @@ -231,7 +231,7 @@ Value NumberPrototype::method_toPrecision(SimpleCallContext *ctx) Value prec = ctx->argument(0); if (prec.isUndefined()) - return Value::fromReturnedValue(__qmljs_to_string(v, ctx)); + return __qmljs_to_string(v, ctx); double precision = prec.toInt32(); if (precision < 1 || precision > 21) { @@ -244,5 +244,5 @@ Value NumberPrototype::method_toPrecision(SimpleCallContext *ctx) double_conversion::DoubleToStringConverter::EcmaScriptConverter().ToPrecision(v->asDouble(), precision, &builder); QString result = QString::fromLatin1(builder.Finalize()); - return Value::fromString(ctx, result); + return Value::fromString(ctx, result).asReturnedValue(); } |