aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-01-14 12:50:34 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2015-01-21 18:22:47 +0100
commitd8131513b07d3f0a6d749c9961b294fc955fed6d (patch)
tree8d757fffe19623bd1ea78a40240dc41c25b81a8f /src/qml/jsruntime
parent630f118f043edb88501e387d779c62c86b1030d4 (diff)
Add C++11 move operators, and a simpler internal constructor
Move semantics should optimize some copy operations on QJSValues, and the internal constructor will simplify refactoring the QJSValue class to get rid of the extra allocated private. Change-Id: I24863b30523af2432aa81ad6b87fda7fe35749c4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4engine.cpp6
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index b42d4bec1c..359b24d5ab 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -1183,7 +1183,7 @@ static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::ValueRef value, in
return QVariant::fromValue(QV4::JsonObject::toJsonValue(value));
if (typeHint == qMetaTypeId<QJSValue>())
- return QVariant::fromValue(QJSValue(new QJSValuePrivate(e, value)));
+ return QVariant::fromValue(QJSValue(e, value.asReturnedValue()));
if (value->asObject()) {
QV4::ScopedObject object(scope, value);
@@ -1255,7 +1255,7 @@ static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::ValueRef value, in
return re->toQRegExp();
if (createJSValueForObjects)
- return QVariant::fromValue(QJSValue(new QJSValuePrivate(scope.engine, o->asReturnedValue())));
+ return QVariant::fromValue(QJSValue(scope.engine, o->asReturnedValue()));
return objectToVariant(e, o, visitedObjects);
}
@@ -1799,7 +1799,7 @@ bool ExecutionEngine::metaTypeFromJS(const QV4::ValueRef value, int type, void *
*reinterpret_cast<void* *>(data) = 0;
return true;
} else if (type == qMetaTypeId<QJSValue>()) {
- *reinterpret_cast<QJSValue*>(data) = QJSValuePrivate::get(new QJSValuePrivate(this, value));
+ *reinterpret_cast<QJSValue*>(data) = QJSValue(this, value.asReturnedValue());
return true;
}
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index e4c141c15d..3bacba117e 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -510,7 +510,7 @@ void QObjectWrapper::setProperty(QObject *object, ExecutionContext *ctx, QQmlPro
} else if (value->isUndefined() && property->propType == QMetaType::QJsonValue) {
PROPERTY_STORE(QJsonValue, QJsonValue(QJsonValue::Undefined));
} else if (!newBinding && property->propType == qMetaTypeId<QJSValue>()) {
- PROPERTY_STORE(QJSValue, new QJSValuePrivate(ctx->d()->engine, value));
+ PROPERTY_STORE(QJSValue, QJSValue(ctx->d()->engine, value.asReturnedValue()));
} else if (value->isUndefined() && property->propType != qMetaTypeId<QQmlScriptString>()) {
QString error = QLatin1String("Cannot assign [undefined] to ");
if (!QMetaType::typeName(property->propType))
@@ -1573,7 +1573,7 @@ void CallArgument::fromValue(int callType, QV4::ExecutionEngine *engine, const Q
bool queryEngine = false;
if (callType == qMetaTypeId<QJSValue>()) {
- qjsValuePtr = new (&allocData) QJSValue(new QJSValuePrivate(scope.engine, value));
+ qjsValuePtr = new (&allocData) QJSValue(scope.engine, value.asReturnedValue());
type = qMetaTypeId<QJSValue>();
} else if (callType == QMetaType::Int) {
intValue = quint32(value->toInt32());