diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-03-10 19:58:05 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-11 08:37:01 +0100 |
commit | 8ed6c62dc76ebc2e510ecc028c34c160018af86c (patch) | |
tree | 335e73bcdb52b1a8300a67c1f91299e7bc97972a /src/qml/jsruntime/qv4value.cpp | |
parent | dfed088a50298fe4a9d0eb8a9d0a2711dfc206c1 (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/jsruntime/qv4value.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4value.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/qml/jsruntime/qv4value.cpp b/src/qml/jsruntime/qv4value.cpp index a610f0b73a..fa16662b46 100644 --- a/src/qml/jsruntime/qv4value.cpp +++ b/src/qml/jsruntime/qv4value.cpp @@ -88,11 +88,11 @@ double Value::toNumberImpl() const return std::numeric_limits<double>::quiet_NaN(); case QV4::Value::Managed_Type: if (isString()) - return __qmljs_string_to_number(stringValue()->toQString()); + return RuntimeHelpers::stringToNumber(stringValue()->toQString()); { ExecutionContext *ctx = objectValue()->internalClass->engine->currentContext(); Scope scope(ctx); - ScopedValue prim(scope, __qmljs_to_primitive(ValueRef::fromRawValue(this), NUMBER_HINT)); + ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), NUMBER_HINT)); return prim->toNumber(); } case QV4::Value::Null_Type: @@ -126,7 +126,7 @@ QString Value::toQStringNoThrow() const Scope scope(ctx); ScopedValue ex(scope); bool caughtException = false; - ScopedValue prim(scope, __qmljs_to_primitive(ValueRef::fromRawValue(this), STRING_HINT)); + ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), STRING_HINT)); if (scope.hasException()) { ex = ctx->catchException(); caughtException = true; @@ -135,7 +135,7 @@ QString Value::toQStringNoThrow() const } // Can't nest try/catch due to CXX ABI limitations for foreign exception nesting. if (caughtException) { - ScopedValue prim(scope, __qmljs_to_primitive(ex, STRING_HINT)); + ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ex, STRING_HINT)); if (scope.hasException()) { ex = ctx->catchException(); } else if (prim->isPrimitive()) { @@ -146,12 +146,12 @@ QString Value::toQStringNoThrow() const } case Value::Integer_Type: { QString str; - __qmljs_numberToString(&str, (double)int_32, 10); + RuntimeHelpers::numberToString(&str, (double)int_32, 10); return str; } default: { // double QString str; - __qmljs_numberToString(&str, doubleValue(), 10); + RuntimeHelpers::numberToString(&str, doubleValue(), 10); return str; } } // switch @@ -177,17 +177,17 @@ QString Value::toQString() const { ExecutionContext *ctx = objectValue()->internalClass->engine->currentContext(); Scope scope(ctx); - ScopedValue prim(scope, __qmljs_to_primitive(ValueRef::fromRawValue(this), STRING_HINT)); + ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), STRING_HINT)); return prim->toQString(); } case Value::Integer_Type: { QString str; - __qmljs_numberToString(&str, (double)int_32, 10); + RuntimeHelpers::numberToString(&str, (double)int_32, 10); return str; } default: { // double QString str; - __qmljs_numberToString(&str, doubleValue(), 10); + RuntimeHelpers::numberToString(&str, doubleValue(), 10); return str; } } // switch @@ -272,13 +272,13 @@ String *Value::toString(ExecutionContext *ctx) const { if (isString()) return stringValue(); - return __qmljs_convert_to_string(ctx, ValueRef::fromRawValue(this))->getPointer(); + return RuntimeHelpers::convertToString(ctx, ValueRef::fromRawValue(this))->getPointer(); } Object *Value::toObject(ExecutionContext *ctx) const { if (isObject()) return objectValue(); - return __qmljs_convert_to_object(ctx, ValueRef::fromRawValue(this))->getPointer(); + return RuntimeHelpers::convertToObject(ctx, ValueRef::fromRawValue(this))->getPointer(); } |