From db695c5b1d07275f208446dad178b1131b20bb0a Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 22 Jun 2018 22:59:43 +0200 Subject: Unify the get and getIndexed vtable functions of QV4::Object This finalizes the refactoring of Object's vtable API. Also added the receiver argument to the method as required by the ES7 spec. Change-Id: I36f9989211c47458788fe9f7e929862bcfe7b845 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4sequenceobject.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/qml/jsruntime/qv4sequenceobject.cpp') diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp index 74964916ee..0826384614 100644 --- a/src/qml/jsruntime/qv4sequenceobject.cpp +++ b/src/qml/jsruntime/qv4sequenceobject.cpp @@ -538,7 +538,7 @@ public: quint32 length = array->getLength(); QV4::ScopedValue v(scope); for (quint32 i = 0; i < length; ++i) - result.push_back(convertValueToElement((v = array->getIndexed(i)))); + result.push_back(convertValueToElement((v = array->get(i)))); return QVariant::fromValue(result); } @@ -563,8 +563,12 @@ public: QMetaObject::metacall(d()->object, QMetaObject::WriteProperty, d()->propertyIndex, a); } - static QV4::ReturnedValue getIndexed(const QV4::Managed *that, uint index, bool *hasProperty) - { return static_cast *>(that)->containerGetIndexed(index, hasProperty); } + static QV4::ReturnedValue get(const QV4::Managed *that, Identifier id, const Value *receiver, bool *hasProperty) + { + if (!id.isArrayIndex()) + return Object::get(that, id, receiver, hasProperty); + return static_cast *>(that)->containerGetIndexed(id.asArrayIndex(), hasProperty); + } static bool put(Managed *that, Identifier id, const QV4::Value &value, Value *receiver) { if (id.isArrayIndex()) -- cgit v1.2.3