aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4numberobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-01-16 12:44:51 +0100
committerLars Knoll <lars.knoll@digia.com>2015-01-23 12:30:41 +0100
commit0c2ab6e20ca23e74055d0a95539315cf1bf360bf (patch)
treeb36a65f2f32c87c7c11661e82d3a881211a79207 /src/qml/jsruntime/qv4numberobject.cpp
parentef6b4938b9ec309d5faf0c966cb2b58f3de2ca77 (diff)
Store a double in NumberObject
Makes more sense than storing a Value in there. Change-Id: I2e6ca71477100c1e1639bb89cced4f4049b5e5c2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4numberobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4numberobject.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp
index bbe6bb977c..acabe34af5 100644
--- a/src/qml/jsruntime/qv4numberobject.cpp
+++ b/src/qml/jsruntime/qv4numberobject.cpp
@@ -54,8 +54,7 @@ ReturnedValue NumberCtor::construct(Managed *m, CallData *callData)
{
Scope scope(m->cast<NumberCtor>()->engine());
double dbl = callData->argc ? callData->args[0].toNumber() : 0.;
- ScopedValue d(scope, QV4::Primitive::fromDouble(dbl));
- return Encode(scope.engine->newNumberObject(d));
+ return Encode(scope.engine->newNumberObject(dbl));
}
ReturnedValue NumberCtor::call(Managed *, CallData *callData)
@@ -101,7 +100,7 @@ inline ReturnedValue thisNumberValue(ExecutionContext *ctx)
NumberObject *n = ctx->thisObject().asNumberObject();
if (!n)
return ctx->engine()->throwTypeError();
- return n->value().asReturnedValue();
+ return Encode(n->value());
}
inline double thisNumber(ExecutionContext *ctx)
@@ -111,7 +110,7 @@ inline double thisNumber(ExecutionContext *ctx)
NumberObject *n = ctx->thisObject().asNumberObject();
if (!n)
return ctx->engine()->throwTypeError();
- return n->value().asDouble();
+ return n->value();
}
ReturnedValue NumberPrototype::method_toString(CallContext *ctx)