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/jsruntime/qv4qmlcontext.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/jsruntime/qv4qmlcontext.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4qmlcontext.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp index a3e761050c..bbf2ff6352 100644 --- a/src/qml/jsruntime/qv4qmlcontext.cpp +++ b/src/qml/jsruntime/qv4qmlcontext.cpp @@ -78,26 +78,25 @@ void Heap::QQmlContextWrapper::destroy() Object::destroy(); } -ReturnedValue QQmlContextWrapper::get(const Managed *m, StringOrSymbol *n, bool *hasProperty) +ReturnedValue QQmlContextWrapper::get(const Managed *m, Identifier id, const Value *receiver, bool *hasProperty) { Q_ASSERT(m->as<QQmlContextWrapper>()); - 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 QQmlContextWrapper *resource = static_cast<const QQmlContextWrapper *>(m); QV4::ExecutionEngine *v4 = resource->engine(); QV4::Scope scope(v4); if (resource->d()->isNullWrapper) - return Object::get(m, name, hasProperty); + return Object::get(m, id, receiver, hasProperty); if (v4->callingQmlContext() != *resource->d()->context) - return Object::get(m, name, hasProperty); + return Object::get(m, id, receiver, hasProperty); bool hasProp = false; - ScopedValue result(scope, Object::get(m, name, &hasProp)); + ScopedValue result(scope, Object::get(m, id, receiver, &hasProp)); if (hasProp) { if (hasProperty) *hasProperty = hasProp; @@ -125,6 +124,7 @@ ReturnedValue QQmlContextWrapper::get(const Managed *m, StringOrSymbol *n, bool QObject *scopeObject = resource->getScopeObject(); + ScopedString name(scope, id.asHeapObject()); if (context->imports && name->startsWithUpper()) { // Search for attached properties, enums and imported scripts QQmlTypeNameCache::Result r = context->imports->query(name, QQmlImport::AllowRecursion); @@ -135,7 +135,7 @@ ReturnedValue QQmlContextWrapper::get(const Managed *m, StringOrSymbol *n, bool if (r.scriptIndex != -1) { QV4::ScopedObject scripts(scope, context->importedScripts.valueRef()); if (scripts) - return scripts->getIndexed(r.scriptIndex); + return scripts->get(r.scriptIndex); return QV4::Encode::null(); } else if (r.type.isValid()) { return QQmlTypeWrapper::create(v4, scopeObject, r.type); |