diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-12-10 18:07:26 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-12-18 14:23:29 +0100 |
commit | d2e331dfa02475e773e51af6e7532951f4d1a233 (patch) | |
tree | d16f2ef9cfd363ff09d06fed70b226ccb212f3ca /src/qml/jsruntime/qv4value_p.h | |
parent | 31211f1415f221ed1a974663fdde117fd6de357d (diff) |
Allow JavaScript primitive type transformations inline in C++
We don't want to call into the engine just for adding two numbers.
This implements the most common operators on primitive JavaScript
values. More are to follow in the future.
Change-Id: Id51a5af59a3af9fec78a2d8f293e59e6567e9204
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4value_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4value_p.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index 530c8eaf27..44383689b4 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -434,9 +434,9 @@ inline int Value::toInt32() const return int_32(); if (Q_LIKELY(isDouble())) - return Double::toInt32(doubleValue()); + return QJSNumberCoercion::toInteger(doubleValue()); - return Double::toInt32(toNumberImpl()); + return QJSNumberCoercion::toInteger(toNumberImpl()); } inline unsigned int Value::toUInt32() const |