diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-06-22 22:59:43 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-07-02 19:29:29 +0000 |
commit | db695c5b1d07275f208446dad178b1131b20bb0a (patch) | |
tree | c2175a065f4918d31249ca1ce46a2811733b8093 /src/imports | |
parent | 98263a01373f5b225d64da216537165ae27d7ff1 (diff) |
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 <simon.hausmann@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/localstorage/plugin.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index 60c1f89c9b..1a8c8b60c8 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -147,7 +147,7 @@ public: ~QQmlSqlDatabaseWrapper() { } - static ReturnedValue getIndexed(const Managed *m, uint index, bool *hasProperty); + static ReturnedValue get(const Managed *m, Identifier id, const Value *receiver, bool *hasProperty); }; } @@ -237,12 +237,16 @@ static ReturnedValue qmlsqldatabase_rows_index(const QQmlSqlDatabaseWrapper *r, } } -ReturnedValue QQmlSqlDatabaseWrapper::getIndexed(const Managed *m, uint index, bool *hasProperty) +ReturnedValue QQmlSqlDatabaseWrapper::get(const Managed *m, Identifier id, const Value *receiver, bool *hasProperty) { + if (!id.isArrayIndex()) + return Object::get(m, id, receiver, hasProperty); + + uint index = id.asArrayIndex(); Q_ASSERT(m->as<QQmlSqlDatabaseWrapper>()); const QQmlSqlDatabaseWrapper *r = static_cast<const QQmlSqlDatabaseWrapper *>(m); if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Rows) - return Object::getIndexed(m, index, hasProperty); + return Object::get(m, id, receiver, hasProperty); return qmlsqldatabase_rows_index(r, r->engine(), index, hasProperty); } @@ -297,7 +301,7 @@ static ReturnedValue qmlsqldatabase_executeSql(const FunctionObject *b, const Va quint32 size = array->getLength(); QV4::ScopedValue v(scope); for (quint32 ii = 0; ii < size; ++ii) { - query.bindValue(ii, toSqlVariant(scope.engine, (v = array->getIndexed(ii)))); + query.bindValue(ii, toSqlVariant(scope.engine, (v = array->get(ii)))); } } else if (values->as<Object>()) { ScopedObject object(scope, values); |