aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsapi
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-03-10 19:58:05 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-11 08:37:01 +0100
commit8ed6c62dc76ebc2e510ecc028c34c160018af86c (patch)
tree335e73bcdb52b1a8300a67c1f91299e7bc97972a /src/qml/jsapi
parentdfed088a50298fe4a9d0eb8a9d0a2711dfc206c1 (diff)
Cleanup our runtime methods
Move all our runtime methods into the QV4::Runtime struct and give them nicer names without underscores. Sort them logically and remove a few unused methods. Change-Id: Ib69b71764ff194d0ba211aac581f9a99734d8180 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsapi')
-rw-r--r--src/qml/jsapi/qjsengine.cpp2
-rw-r--r--src/qml/jsapi/qjsvalue.cpp16
2 files changed, 9 insertions, 9 deletions
diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp
index 1cf67a1c47..1ff6f509e0 100644
--- a/src/qml/jsapi/qjsengine.cpp
+++ b/src/qml/jsapi/qjsengine.cpp
@@ -391,7 +391,7 @@ bool QJSEngine::convertV2(const QJSValue &value, int type, void *ptr)
*reinterpret_cast<QString*>(ptr) = vp->string;
return true;
}
- double d = QV4::__qmljs_string_to_number(vp->string);
+ double d = QV4::RuntimeHelpers::stringToNumber(vp->string);
switch (type) {
case QMetaType::Int:
*reinterpret_cast<int*>(ptr) = QV4::Primitive::toInt32(d);
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp
index 38a8e40cb2..5fba40edac 100644
--- a/src/qml/jsapi/qjsvalue.cpp
+++ b/src/qml/jsapi/qjsvalue.cpp
@@ -381,7 +381,7 @@ QString QJSValue::toString() const
double QJSValue::toNumber() const
{
if (d->value.isEmpty())
- return __qmljs_string_to_number(d->string);
+ return RuntimeHelpers::stringToNumber(d->string);
QV4::ExecutionContext *ctx = d->engine ? d->engine->currentContext() : 0;
double dbl = d->value.toNumber();
@@ -433,7 +433,7 @@ bool QJSValue::toBool() const
qint32 QJSValue::toInt() const
{
if (d->value.isEmpty())
- return QV4::Primitive::toInt32(__qmljs_string_to_number(d->string));
+ return QV4::Primitive::toInt32(RuntimeHelpers::stringToNumber(d->string));
QV4::ExecutionContext *ctx = d->engine ? d->engine->currentContext() : 0;
qint32 i = d->value.toInt32();
@@ -459,7 +459,7 @@ qint32 QJSValue::toInt() const
quint32 QJSValue::toUInt() const
{
if (d->value.isEmpty())
- return QV4::Primitive::toUInt32(__qmljs_string_to_number(d->string));
+ return QV4::Primitive::toUInt32(RuntimeHelpers::stringToNumber(d->string));
QV4::ExecutionContext *ctx = d->engine ? d->engine->currentContext() : 0;
quint32 u = d->value.toUInt32();
@@ -744,12 +744,12 @@ static bool js_equal(const QString &string, QV4::ValueRef value)
if (value->isString())
return string == value->stringValue()->toQString();
if (value->isNumber())
- return __qmljs_string_to_number(string) == value->asDouble();
+ return RuntimeHelpers::stringToNumber(string) == value->asDouble();
if (value->isBoolean())
- return __qmljs_string_to_number(string) == double(value->booleanValue());
+ return RuntimeHelpers::stringToNumber(string) == double(value->booleanValue());
if (value->isObject()) {
Scope scope(value->objectValue()->engine());
- ScopedValue p(scope, __qmljs_to_primitive(value, PREFERREDTYPE_HINT));
+ ScopedValue p(scope, RuntimeHelpers::toPrimitive(value, PREFERREDTYPE_HINT));
return js_equal(string, p);
}
return false;
@@ -789,7 +789,7 @@ bool QJSValue::equals(const QJSValue& other) const
if (other.d->value.isEmpty())
return other.equals(*this);
- return __qmljs_cmp_eq(QV4::ValueRef(d), QV4::ValueRef(other.d));
+ return Runtime::compareEqual(QV4::ValueRef(d), QV4::ValueRef(other.d));
}
/*!
@@ -826,7 +826,7 @@ bool QJSValue::strictlyEquals(const QJSValue& other) const
if (other.d->value.isEmpty())
return other.strictlyEquals(*this);
- return __qmljs_strict_equal(QV4::ValueRef(d), QV4::ValueRef(other.d));
+ return RuntimeHelpers::strictEqual(QV4::ValueRef(d), QV4::ValueRef(other.d));
}
/*!