From 1dac47c1418b44cf4a56b42bfca2b277795fd213 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 11 Sep 2018 11:07:32 +0200 Subject: Cleanups in Value/Primitive Get rid of Primitive and move the corresponding methods directly into Value. Mark many methods in Value as constexpr and turn Value into a POD type again. Keep Primitive as a pure alias to Value for source compatibility of other modules that might be using it. Change-Id: Icb47458947dd3482c8852e95782123ea4346f5ec Reviewed-by: Simon Hausmann --- src/qml/jsapi/qjsengine.cpp | 18 +++++++++--------- src/qml/jsapi/qjsvalue.cpp | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/qml/jsapi') diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp index f96414ea3f..4aa7c4b45d 100644 --- a/src/qml/jsapi/qjsengine.cpp +++ b/src/qml/jsapi/qjsengine.cpp @@ -726,16 +726,16 @@ bool QJSEngine::convertV2(const QJSValue &value, int type, void *ptr) double d = QV4::RuntimeHelpers::stringToNumber(string); switch (type) { case QMetaType::Int: - *reinterpret_cast(ptr) = QV4::Primitive::toInt32(d); + *reinterpret_cast(ptr) = QV4::Value::toInt32(d); return true; case QMetaType::UInt: - *reinterpret_cast(ptr) = QV4::Primitive::toUInt32(d); + *reinterpret_cast(ptr) = QV4::Value::toUInt32(d); return true; case QMetaType::LongLong: - *reinterpret_cast(ptr) = QV4::Primitive::toInteger(d); + *reinterpret_cast(ptr) = QV4::Value::toInteger(d); return true; case QMetaType::ULongLong: - *reinterpret_cast(ptr) = QV4::Primitive::toInteger(d); + *reinterpret_cast(ptr) = QV4::Value::toInteger(d); return true; case QMetaType::Double: *reinterpret_cast(ptr) = d; @@ -744,19 +744,19 @@ bool QJSEngine::convertV2(const QJSValue &value, int type, void *ptr) *reinterpret_cast(ptr) = d; return true; case QMetaType::Short: - *reinterpret_cast(ptr) = QV4::Primitive::toInt32(d); + *reinterpret_cast(ptr) = QV4::Value::toInt32(d); return true; case QMetaType::UShort: - *reinterpret_cast(ptr) = QV4::Primitive::toUInt32(d); + *reinterpret_cast(ptr) = QV4::Value::toUInt32(d); return true; case QMetaType::Char: - *reinterpret_cast(ptr) = QV4::Primitive::toInt32(d); + *reinterpret_cast(ptr) = QV4::Value::toInt32(d); return true; case QMetaType::UChar: - *reinterpret_cast(ptr) = QV4::Primitive::toUInt32(d); + *reinterpret_cast(ptr) = QV4::Value::toUInt32(d); return true; case QMetaType::QChar: - *reinterpret_cast(ptr) = QV4::Primitive::toUInt32(d); + *reinterpret_cast(ptr) = QV4::Value::toUInt32(d); return true; default: return false; diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp index bf8000bdd8..9671e82187 100644 --- a/src/qml/jsapi/qjsvalue.cpp +++ b/src/qml/jsapi/qjsvalue.cpp @@ -569,7 +569,7 @@ qint32 QJSValue::toInt() const if (!val) { QVariant *variant = QJSValuePrivate::getVariant(this); if (variant->userType() == QMetaType::QString) - return QV4::Primitive::toInt32(RuntimeHelpers::stringToNumber(variant->toString())); + return QV4::Value::toInt32(RuntimeHelpers::stringToNumber(variant->toString())); else return variant->toInt(); } @@ -603,7 +603,7 @@ quint32 QJSValue::toUInt() const if (!val) { QVariant *variant = QJSValuePrivate::getVariant(this); if (variant->userType() == QMetaType::QString) - return QV4::Primitive::toUInt32(RuntimeHelpers::stringToNumber(variant->toString())); + return QV4::Value::toUInt32(RuntimeHelpers::stringToNumber(variant->toString())); else return variant->toUInt(); } -- cgit v1.2.3