diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-05-20 15:24:51 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-05-31 15:03:33 +0200 |
commit | c8c2db3f5b157131542025ce556d248c7a916a00 (patch) | |
tree | 4c91465c8935b880c6dd42cb427fa3b173d52157 /src/qml/jsruntime/qv4value.cpp | |
parent | 0f035c0ad79ca41a1473b64a4c0077e7085d3700 (diff) |
Split QV4::Value into a static and a dynamic part
The static part can be used for compilation and won't resolve managed
objects. This allows us to remove all the remaining V4_BOOTSTRAP.
Change-Id: Id2f6feb64c48beb2a407697881aea8c0d791a532
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4value.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4value.cpp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/qml/jsruntime/qv4value.cpp b/src/qml/jsruntime/qv4value.cpp index 82cf11f148..d29b060b9e 100644 --- a/src/qml/jsruntime/qv4value.cpp +++ b/src/qml/jsruntime/qv4value.cpp @@ -39,13 +39,11 @@ #include <qv4runtime_p.h> #include <qv4propertykey_p.h> -#ifndef V4_BOOTSTRAP #include <qv4string_p.h> #include <qv4symbol_p.h> #include <qv4object_p.h> #include <qv4objectproto_p.h> #include <private/qv4mm_p.h> -#endif #include <wtf/MathExtras.h> @@ -83,12 +81,8 @@ bool Value::toBooleanImpl(Value val) Heap::Base *b = val.m(); if (!b) return false; -#ifdef V4_BOOTSTRAP - Q_UNIMPLEMENTED(); -#else if (b->internalClass->vtable->isString) return static_cast<Heap::String *>(b)->length() > 0; -#endif return true; } @@ -103,10 +97,6 @@ double Value::toNumberImpl(Value val) case QV4::Value::Undefined_Type: return std::numeric_limits<double>::quiet_NaN(); case QV4::Value::Managed_Type: -#ifdef V4_BOOTSTRAP - Q_UNIMPLEMENTED(); - Q_FALLTHROUGH(); -#else if (String *s = val.stringValue()) return RuntimeHelpers::stringToNumber(s->toQString()); if (val.isSymbol()) { @@ -114,16 +104,15 @@ double Value::toNumberImpl(Value val) m.engine()->throwTypeError(); return 0; } - { - Q_ASSERT(val.isObject()); - Scope scope(val.objectValue()->engine()); - ScopedValue protectThis(scope, val); - ScopedValue prim(scope, RuntimeHelpers::toPrimitive(val, NUMBER_HINT)); + { + Q_ASSERT(val.isObject()); + Scope scope(val.objectValue()->engine()); + ScopedValue protectThis(scope, val); + ScopedValue prim(scope, RuntimeHelpers::toPrimitive(val, NUMBER_HINT)); if (scope.engine->hasException) return 0; return prim->toNumber(); } -#endif case QV4::Value::Null_Type: case QV4::Value::Boolean_Type: case QV4::Value::Integer_Type: @@ -133,7 +122,6 @@ double Value::toNumberImpl(Value val) } } -#ifndef V4_BOOTSTRAP QString Value::toQStringNoThrow() const { switch (type()) { @@ -325,4 +313,3 @@ uint Value::asArrayLength(bool *ok) const } return idx; } -#endif // V4_BOOTSTRAP |