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/qml/qqmltypewrapper.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/qml/qml/qqmltypewrapper.cpp') diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp index 943cbc80d3..a1bfc109da 100644 --- a/src/qml/qml/qqmltypewrapper.cpp +++ b/src/qml/qml/qqmltypewrapper.cpp @@ -167,16 +167,16 @@ static ReturnedValue throwLowercaseEnumError(QV4::ExecutionEngine *v4, String *n return v4->throwTypeError(message); } -ReturnedValue QQmlTypeWrapper::get(const Managed *m, StringOrSymbol *n, bool *hasProperty) +ReturnedValue QQmlTypeWrapper::get(const Managed *m, Identifier id, const Value *receiver, bool *hasProperty) { Q_ASSERT(m->as()); - if (n->isSymbol()) - return Object::get(m, n, hasProperty); - String *name = static_cast(n); + if (!id.isString()) + return Object::get(m, id, receiver, hasProperty); QV4::ExecutionEngine *v4 = static_cast(m)->engine(); QV4::Scope scope(v4); + ScopedString name(scope, id.asHeapObject()); Scoped w(scope, static_cast(m)); @@ -272,7 +272,7 @@ ReturnedValue QQmlTypeWrapper::get(const Managed *m, StringOrSymbol *n, bool *ha return create(scope.engine, object, r.type, w->d()->mode); } else if (r.scriptIndex != -1) { QV4::ScopedObject scripts(scope, context->importedScripts.valueRef()); - return scripts->getIndexed(r.scriptIndex); + return scripts->get(r.scriptIndex); } else if (r.importNamespace) { return create(scope.engine, object, context->imports, r.importNamespace); } @@ -288,7 +288,7 @@ ReturnedValue QQmlTypeWrapper::get(const Managed *m, StringOrSymbol *n, bool *ha } bool ok = false; - const ReturnedValue result = Object::get(m, name, &ok); + const ReturnedValue result = Object::get(m, id, receiver, &ok); if (hasProperty) *hasProperty = ok; @@ -428,16 +428,16 @@ QQmlType Heap::QQmlScopedEnumWrapper::type() const return QQmlType(typePrivate); } -ReturnedValue QQmlScopedEnumWrapper::get(const Managed *m, StringOrSymbol *n, bool *hasProperty) +ReturnedValue QQmlScopedEnumWrapper::get(const Managed *m, Identifier id, const Value *receiver, bool *hasProperty) { Q_ASSERT(m->as()); - if (n->isSymbol()) - return Object::get(m, n, hasProperty); - String *name = static_cast(n); + if (!id.isString()) + return Object::get(m, id, receiver, hasProperty); const QQmlScopedEnumWrapper *resource = static_cast(m); QV4::ExecutionEngine *v4 = resource->engine(); QV4::Scope scope(v4); + ScopedString name(scope, id.asHeapObject()); QQmlType type = resource->d()->type(); int index = resource->d()->scopeEnumIndex; -- cgit v1.2.3