diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-08-28 11:00:20 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-08-28 13:20:22 +0000 |
commit | 4c66a78e2f72a2767a7a4b7587436ecdfb3aebdb (patch) | |
tree | a05d52f91b4abcb51e4a5ea118571430736ed8ae /src/qml/jsruntime/qv4runtime_p.h | |
parent | ca7bbd7edfdfe4e8b563418ed73c25e489bcb5be (diff) |
Cleanups in the runtime API
Change-Id: I0a669d3b643f1120c00767a104622453decd212b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4runtime_p.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4runtime_p.h b/src/qml/jsruntime/qv4runtime_p.h index ed9f65056a..3a26c23990 100644 --- a/src/qml/jsruntime/qv4runtime_p.h +++ b/src/qml/jsruntime/qv4runtime_p.h @@ -99,14 +99,14 @@ enum TypeHint { struct Q_QML_PRIVATE_EXPORT RuntimeHelpers { static ReturnedValue objectDefaultValue(const Object *object, int typeHint); - static ReturnedValue toPrimitive(const Value &value, int typeHint); + static ReturnedValue toPrimitive(const Value &value, TypeHint typeHint); static double stringToNumber(const QString &s); static Heap::String *stringFromNumber(ExecutionEngine *engine, double number); static double toNumber(const Value &value); static void numberToString(QString *result, double num, int radix = 10); - static Heap::String *convertToString(ExecutionEngine *engine, const Value &value); + static Heap::String *convertToString(ExecutionEngine *engine, Value value, TypeHint = STRING_HINT); static Heap::Object *convertToObject(ExecutionEngine *engine, const Value &value); static Bool equalHelper(const Value &x, const Value &y); @@ -118,12 +118,11 @@ struct Q_QML_PRIVATE_EXPORT RuntimeHelpers { // type conversion and testing #ifndef V4_BOOTSTRAP -inline ReturnedValue RuntimeHelpers::toPrimitive(const Value &value, int typeHint) +inline ReturnedValue RuntimeHelpers::toPrimitive(const Value &value, TypeHint typeHint) { - const Object *o = value.as<Object>(); - if (!o) + if (!value.isObject()) return value.asReturnedValue(); - return RuntimeHelpers::objectDefaultValue(o, typeHint); + return RuntimeHelpers::objectDefaultValue(&reinterpret_cast<const Object &>(value), typeHint); } #endif |