Fix Number.toExponential with parameter
authorSimon Hausmann <simon.hausmann@digia.com>
Tue, 29 Apr 2014 15:15:55 +0000 (17:15 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 21 May 2014 14:20:35 +0000 (16:20 +0200)
The fractionDigits parameter was unfortunately ignored, due to an accidental
double variable declaration, the latter in a narrower scope shadowing the
former in the correct scope.

Task-number: QTBUG-38577
Change-Id: I28f35466d2d744e84b86a3ca6b3371eb86869b55
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/jsruntime/qv4numberobject.cpp

index 1076094..c97e86f 100644 (file)
@@ -227,7 +227,7 @@ ReturnedValue NumberPrototype::method_toExponential(CallContext *ctx)
     int fdigits = -1;
 
     if (ctx->callData->argc && !ctx->callData->args[0].isUndefined()) {
-        int fdigits = ctx->callData->args[0].toInt32();
+        fdigits = ctx->callData->args[0].toInt32();
         if (fdigits < 0 || fdigits > 20) {
             ScopedString error(scope, ctx->engine->newString(QStringLiteral("Number.prototype.toExponential: fractionDigits out of range")));
             return ctx->throwRangeError(error);