diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-26 12:04:52 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-28 13:33:46 +0200 |
commit | d2e2a5b59c617e6cf7236cf36e9c20fe9ea36fdb (patch) | |
tree | 1fc21beff4add85e68a61b7c88b5d5f928bec6e8 /src/qml/jsruntime/qv4numberobject.cpp | |
parent | 18d4794e3f614eec8594f6636d569af8bc112618 (diff) |
Remove Value::fromString()
replaced with call to the GC safe ExceutionEngine::newString()
method.
Change-Id: I7258296e75ca724ff42b94a0d147bc33a05f8f68
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4numberobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4numberobject.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp index 9bf0d506f4..38cf899427 100644 --- a/src/qml/jsruntime/qv4numberobject.cpp +++ b/src/qml/jsruntime/qv4numberobject.cpp @@ -121,9 +121,9 @@ ReturnedValue NumberPrototype::method_toString(SimpleCallContext *ctx) } if (std::isnan(num)) { - return Value::fromString(ctx, QStringLiteral("NaN")).asReturnedValue(); + return ctx->engine->newString(QStringLiteral("NaN"))->asReturnedValue(); } else if (qIsInf(num)) { - return Value::fromString(ctx, QLatin1String(num < 0 ? "-Infinity" : "Infinity")).asReturnedValue(); + return ctx->engine->newString(QLatin1String(num < 0 ? "-Infinity" : "Infinity"))->asReturnedValue(); } if (radix != 10) { @@ -153,7 +153,7 @@ ReturnedValue NumberPrototype::method_toString(SimpleCallContext *ctx) } if (negative) str.prepend(QLatin1Char('-')); - return Value::fromString(ctx, str).asReturnedValue(); + return ctx->engine->newString(str)->asReturnedValue(); } } @@ -198,7 +198,7 @@ ReturnedValue NumberPrototype::method_toFixed(SimpleCallContext *ctx) str = QString::number(v, 'f', int (fdigits)); else return __qmljs_string_from_number(ctx, v)->asReturnedValue(); - return Value::fromString(ctx, str).asReturnedValue(); + return ctx->engine->newString(str)->asReturnedValue(); } ReturnedValue NumberPrototype::method_toExponential(SimpleCallContext *ctx) @@ -221,7 +221,7 @@ ReturnedValue NumberPrototype::method_toExponential(SimpleCallContext *ctx) double_conversion::DoubleToStringConverter::EcmaScriptConverter().ToExponential(d, fdigits, &builder); QString result = QString::fromLatin1(builder.Finalize()); - return Value::fromString(ctx, result).asReturnedValue(); + return ctx->engine->newString(result)->asReturnedValue(); } ReturnedValue NumberPrototype::method_toPrecision(SimpleCallContext *ctx) @@ -244,5 +244,5 @@ ReturnedValue 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).asReturnedValue(); + return ctx->engine->newString(result)->asReturnedValue(); } |