aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-01-01 15:24:33 +0100
committerLars Knoll <lars.knoll@digia.com>2015-01-09 10:27:52 +0100
commit8a779f65ae3fb830415b9f39d803be57b7f56d50 (patch)
tree09f6ce75d96fd5f6831893557f192c48c7e478d8
parent2569b795c527ea4c875e68cfeca382d5a9d128af (diff)
This method is only used one place, so inline it there
Change-Id: Ia8b75965208c9687163ddaf982c4081c1ee504d4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--src/qml/jsapi/qjsvalue.cpp17
-rw-r--r--src/qml/jsruntime/qv4variantobject.cpp22
-rw-r--r--src/qml/jsruntime/qv4variantobject_p.h2
3 files changed, 16 insertions, 25 deletions
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp
index 4cfae02e9a..11b7dad8eb 100644
--- a/src/qml/jsapi/qjsvalue.cpp
+++ b/src/qml/jsapi/qjsvalue.cpp
@@ -516,7 +516,22 @@ QVariant QJSValue::toVariant() const
if (d->value.isEmpty())
return d->unboundData;
- return QV4::VariantObject::toVariant(d->value);
+ if (d->value.asObject())
+ return QV8Engine::toVariant(d->value.engine(), d->value, /*typeHint*/ -1, /*createJSValueForObjects*/ false);
+
+ if (d->value.isString())
+ return QVariant(d->value.stringValue()->toQString());
+ if (d->value.isBoolean())
+ return QVariant(d->value.booleanValue());
+ if (d->value.isNumber()) {
+ if (d->value.isInt32())
+ return QVariant(d->value.integerValue());
+ return QVariant(d->value.asDouble());
+ }
+ if (d->value.isNull())
+ return QVariant(QMetaType::VoidStar, 0);
+ Q_ASSERT(d->value.isUndefined());
+ return QVariant();
}
/*!
diff --git a/src/qml/jsruntime/qv4variantobject.cpp b/src/qml/jsruntime/qv4variantobject.cpp
index 4ed9162dbb..5397b96c73 100644
--- a/src/qml/jsruntime/qv4variantobject.cpp
+++ b/src/qml/jsruntime/qv4variantobject.cpp
@@ -51,28 +51,6 @@ Heap::VariantObject::VariantObject(QV4::ExecutionEngine *engine, const QVariant
engine->scarceResources.insert(this);
}
-QVariant VariantObject::toVariant(const QV4::ValueRef v)
-{
- if (v->asObject())
- return QV8Engine::toVariant(v->engine(), v, /*typeHint*/ -1, /*createJSValueForObjects*/ false);
-
- if (v->isString())
- return QVariant(v->stringValue()->toQString());
- if (v->isBoolean())
- return QVariant(v->booleanValue());
- if (v->isNumber()) {
- QV4::Value val;
- val = v;
- if (val.isInt32())
- return QVariant(val.integerValue());
- return QVariant(v->asDouble());
- }
- if (v->isNull())
- return QVariant(QMetaType::VoidStar, 0);
- Q_ASSERT(v->isUndefined());
- return QVariant();
-}
-
bool VariantObject::Data::isScarce() const
{
QVariant::Type t = data.type();
diff --git a/src/qml/jsruntime/qv4variantobject_p.h b/src/qml/jsruntime/qv4variantobject_p.h
index 14ef167e6f..a7a4209913 100644
--- a/src/qml/jsruntime/qv4variantobject_p.h
+++ b/src/qml/jsruntime/qv4variantobject_p.h
@@ -79,8 +79,6 @@ struct VariantObject : Object
V4_OBJECT2(VariantObject, Object)
V4_NEEDS_DESTROY
- static QVariant toVariant(const ValueRef v);
-
void addVmePropertyReference();
void removeVmePropertyReference();