diff options
Diffstat (limited to 'src/qml/jsruntime/qv4object.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index e4d670d4f3..718bfbe5ec 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -51,6 +51,7 @@ #include "qv4identifiertable_p.h" #include "qv4jscall_p.h" #include "qv4symbol_p.h" +#include "qv4proxy_p.h" #include <stdint.h> @@ -930,6 +931,32 @@ void Object::initSparseArray() ArrayData::realloc(this, Heap::ArrayData::Sparse, 0, false); } +bool Object::isConcatSpreadable() const +{ + Scope scope(this); + ScopedValue spreadable(scope, get(scope.engine->symbol_isConcatSpreadable())); + if (!spreadable->isUndefined()) + return spreadable->toBoolean(); + return isArray(); +} + +bool Object::isArray() const +{ + if (isArrayObject()) + return true; + if (vtable() == ProxyObject::staticVTable()) { + const ProxyObject *p = static_cast<const ProxyObject *>(this); + Scope scope(this); + if (!p->d()->handler) { + scope.engine->throwTypeError(); + return false; + } + ScopedObject o(scope, p->d()->target); + return o->isArray(); + } + return false; +} + DEFINE_OBJECT_VTABLE(ArrayObject); |