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/qml/qml/qqmlvaluetypewrapper.cpp | |
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/qml/qml/qqmlvaluetypewrapper.cpp')
-rw-r--r-- | src/qml/qml/qqmlvaluetypewrapper.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp index 190d76c1a1..b1993da0a2 100644 --- a/src/qml/qml/qqmlvaluetypewrapper.cpp +++ b/src/qml/qml/qqmlvaluetypewrapper.cpp @@ -359,16 +359,17 @@ ReturnedValue QQmlValueTypeWrapper::method_toString(const FunctionObject *b, con return Encode(b->engine()->newString(result)); } -ReturnedValue QQmlValueTypeWrapper::get(const Managed *m, StringOrSymbol *n, bool *hasProperty) +ReturnedValue QQmlValueTypeWrapper::get(const Managed *m, Identifier id, const Value *receiver, bool *hasProperty) { Q_ASSERT(m->as<QQmlValueTypeWrapper>()); - if (n->isSymbol()) - return Object::get(m, n, hasProperty); - String *name = static_cast<String *>(n); + if (!id.isString()) + return Object::get(m, id, receiver, hasProperty); const QQmlValueTypeWrapper *r = static_cast<const QQmlValueTypeWrapper *>(m); QV4::ExecutionEngine *v4 = r->engine(); + Scope scope(v4); + ScopedString name(scope, id.asHeapObject()); // Note: readReferenceValue() can change the reference->type. if (const QQmlValueTypeReference *reference = r->as<QQmlValueTypeReference>()) { @@ -376,9 +377,9 @@ ReturnedValue QQmlValueTypeWrapper::get(const Managed *m, StringOrSymbol *n, boo return Primitive::undefinedValue().asReturnedValue(); } - QQmlPropertyData *result = r->d()->propertyCache()->property(name, nullptr, nullptr); + QQmlPropertyData *result = r->d()->propertyCache()->property(name.getPointer(), nullptr, nullptr); if (!result) - return Object::get(m, name, hasProperty); + return Object::get(m, id, receiver, hasProperty); if (hasProperty) *hasProperty = true; |