aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsapi/qjsvalue_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-12-10 18:07:26 +0100
committerUlf Hermann <ulf.hermann@qt.io>2020-12-18 14:23:29 +0100
commitd2e331dfa02475e773e51af6e7532951f4d1a233 (patch)
treed16f2ef9cfd363ff09d06fed70b226ccb212f3ca /src/qml/jsapi/qjsvalue_p.h
parent31211f1415f221ed1a974663fdde117fd6de357d (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/jsapi/qjsvalue_p.h')
-rw-r--r--src/qml/jsapi/qjsvalue_p.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/jsapi/qjsvalue_p.h b/src/qml/jsapi/qjsvalue_p.h
index 5533682144..9e371118cc 100644
--- a/src/qml/jsapi/qjsvalue_p.h
+++ b/src/qml/jsapi/qjsvalue_p.h
@@ -89,9 +89,9 @@ class Q_AUTOTEST_EXPORT QJSValuePrivate
return (m & IsString) ? reinterpret_cast<QString *>(m & ~IsString) : nullptr;
}
- static QV4::ReturnedValue encode(const QString &string)
+ static QV4::ReturnedValue encode(QString string)
{
- const quintptr m = quintptr(new QString(string)) | IsString;
+ const quintptr m = quintptr(new QString(std::move(string))) | IsString;
return encodeRawValue(m);
}
@@ -160,9 +160,9 @@ public:
return QV4::Encode::undefined();
}
- static void setString(QJSValue *jsval, const QString &s)
+ static void setString(QJSValue *jsval, QString s)
{
- jsval->d = encode(s);
+ jsval->d = encode(std::move(s));
}
static void setValue(QJSValue *jsval, const QV4::Value &v)