diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-06-23 20:08:40 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-07-02 19:29:32 +0000 |
commit | 56602df447c5f16257874f2e97b078dcf76f2467 (patch) | |
tree | 901c76eb6262dad80e6ab94af810c645355cb6d5 | |
parent | db695c5b1d07275f208446dad178b1131b20bb0a (diff) |
Cleanups in the Identifier API
Rename from/asHeapObject to from/asStringOrSymbol and fix
the signature.
Add a isStringOrSymbol() method and redefine isValid() to also
include array indices.
Change-Id: Ic8272bfbe84d15421e2ebe86ddda7fdaa8db4f3e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/qml/jsruntime/qv4identifier.cpp | 14 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4identifier_p.h | 7 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4identifiertable.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4internalclass.cpp | 8 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4internalclass_p.h | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 12 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4objectiterator.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4objectproto.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4proxy.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4qmlcontext.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4string.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4symbol.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmltypewrapper.cpp | 8 | ||||
-rw-r--r-- | src/qml/qml/qqmlvaluetypewrapper.cpp | 6 | ||||
-rw-r--r-- | src/qml/qml/v8/qv8engine.cpp | 4 | ||||
-rw-r--r-- | src/qml/types/qqmllistmodel.cpp | 2 |
17 files changed, 45 insertions, 44 deletions
diff --git a/src/qml/jsruntime/qv4identifier.cpp b/src/qml/jsruntime/qv4identifier.cpp index 7efd980139..1e9a807848 100644 --- a/src/qml/jsruntime/qv4identifier.cpp +++ b/src/qml/jsruntime/qv4identifier.cpp @@ -46,26 +46,26 @@ namespace QV4 { bool Identifier::isString() const { - return isValid() && asHeapObject()->internalClass->vtable->isString; + return isStringOrSymbol() && asStringOrSymbol()->internalClass->vtable->isString; } bool Identifier::isSymbol() const { - return isValid() && !asHeapObject()->internalClass->vtable->isString && asHeapObject()->internalClass->vtable->isStringOrSymbol; + return isStringOrSymbol() && !asStringOrSymbol()->internalClass->vtable->isString && asStringOrSymbol()->internalClass->vtable->isStringOrSymbol; } Heap::StringOrSymbol *Identifier::toStringOrSymbol(ExecutionEngine *e) { if (isArrayIndex()) return Primitive::fromUInt32(asArrayIndex()).toString(e); - return static_cast<Heap::StringOrSymbol *>(asHeapObject()); + return static_cast<Heap::StringOrSymbol *>(asStringOrSymbol()); } QString Identifier::toQString() const { if (isArrayIndex()) return QString::number(asArrayIndex()); - Heap::Base *b = asHeapObject(); + Heap::Base *b = asStringOrSymbol(); Q_ASSERT(b->internalClass->vtable->isStringOrSymbol); Heap::StringOrSymbol *s = static_cast<Heap::StringOrSymbol *>(b); return s->toQString(); @@ -130,7 +130,7 @@ void IdentifierHash::detach() IdentifierHashEntry *IdentifierHash::addEntry(Identifier identifier) { - Q_ASSERT(identifier.isValid()); + Q_ASSERT(identifier.isStringOrSymbol()); // fill up to max 50% bool grow = (d->alloc <= d->size*2); @@ -169,7 +169,7 @@ IdentifierHashEntry *IdentifierHash::addEntry(Identifier identifier) const IdentifierHashEntry *IdentifierHash::lookup(Identifier identifier) const { - if (!d || !identifier.isValid()) + if (!d || !identifier.isStringOrSymbol()) return nullptr; Q_ASSERT(d->entries); @@ -232,7 +232,7 @@ void IdentifierHashData::markObjects(MarkStack *markStack) const IdentifierHashEntry *e = entries; IdentifierHashEntry *end = e + alloc; while (e < end) { - if (Heap::Base *o = e->identifier.asHeapObject()) + if (Heap::Base *o = e->identifier.asStringOrSymbol()) o->mark(markStack); ++e; } diff --git a/src/qml/jsruntime/qv4identifier_p.h b/src/qml/jsruntime/qv4identifier_p.h index 58eddcc4bb..bf6d5cb7f6 100644 --- a/src/qml/jsruntime/qv4identifier_p.h +++ b/src/qml/jsruntime/qv4identifier_p.h @@ -67,12 +67,13 @@ struct Identifier static Identifier invalid() { return Identifier{ 0 }; } static Identifier fromArrayIndex(uint idx) { return Identifier{ (quint64(idx) << 1) | 1 }; } - bool isValid() const { return id && !(id & 1); } + bool isStringOrSymbol() const { return id && !(id & 1); } uint asArrayIndex() const { return (id & 1) ? (id >> 1) : std::numeric_limits<uint>::max(); } uint isArrayIndex() const { return (id & 1); } - static Identifier fromHeapObject(Heap::Base *b) { return Identifier{ reinterpret_cast<quintptr>(b) }; } - Heap::Base *asHeapObject() const { return (id & 1) ? nullptr : reinterpret_cast<Heap::Base *>(id); } + static Identifier fromStringOrSymbol(Heap::StringOrSymbol *b) { return Identifier{ reinterpret_cast<quintptr>(b) }; } + Heap::StringOrSymbol *asStringOrSymbol() const { return (id & 1) ? nullptr : reinterpret_cast<Heap::StringOrSymbol *>(id); } + bool isValid() const { return id != 0; } bool isString() const; bool isSymbol() const; diff --git a/src/qml/jsruntime/qv4identifiertable.cpp b/src/qml/jsruntime/qv4identifiertable.cpp index ee741e4abb..b4e12cab17 100644 --- a/src/qml/jsruntime/qv4identifiertable.cpp +++ b/src/qml/jsruntime/qv4identifiertable.cpp @@ -81,7 +81,7 @@ void IdentifierTable::addEntry(Heap::StringOrSymbol *str) if (str->subtype == Heap::String::StringType_ArrayIndex) return; - str->identifier = Identifier::fromHeapObject(str); + str->identifier = Identifier::fromStringOrSymbol(str); bool grow = (alloc <= size*2); diff --git a/src/qml/jsruntime/qv4internalclass.cpp b/src/qml/jsruntime/qv4internalclass.cpp index a913d5ca75..da8b581639 100644 --- a/src/qml/jsruntime/qv4internalclass.cpp +++ b/src/qml/jsruntime/qv4internalclass.cpp @@ -227,7 +227,7 @@ static void removeFromPropertyData(QV4::Object *object, int idx, bool accessor = void InternalClass::changeMember(QV4::Object *object, Identifier id, PropertyAttributes data, uint *index) { - Q_ASSERT(id.isValid()); + Q_ASSERT(id.isStringOrSymbol()); uint idx; Heap::InternalClass *oldClass = object->internalClass(); Heap::InternalClass *newClass = oldClass->changeMember(id, data, &idx); @@ -385,7 +385,7 @@ Heap::InternalClass *InternalClass::nonExtensible() void InternalClass::addMember(QV4::Object *object, Identifier id, PropertyAttributes data, uint *index) { - Q_ASSERT(id.isValid()); + Q_ASSERT(id.isStringOrSymbol()); data.resolve(); if (object->internalClass()->propertyTable.lookup(id) < object->internalClass()->size) { changeMember(object, id, data, index); @@ -402,7 +402,7 @@ void InternalClass::addMember(QV4::Object *object, Identifier id, PropertyAttrib Heap::InternalClass *InternalClass::addMember(Identifier identifier, PropertyAttributes data, uint *index) { - Q_ASSERT(identifier.isValid()); + Q_ASSERT(identifier.isStringOrSymbol()); data.resolve(); if (propertyTable.lookup(identifier) < size) @@ -633,7 +633,7 @@ void InternalClass::markObjects(Heap::Base *b, MarkStack *stack) for (uint i = 0; i < ic->size; ++i) { Identifier id = ic->nameMap.at(i); - if (Heap::Base *b = id.asHeapObject()) + if (Heap::Base *b = id.asStringOrSymbol()) b->mark(stack); } } diff --git a/src/qml/jsruntime/qv4internalclass_p.h b/src/qml/jsruntime/qv4internalclass_p.h index 290251f4ba..5a1a3ff687 100644 --- a/src/qml/jsruntime/qv4internalclass_p.h +++ b/src/qml/jsruntime/qv4internalclass_p.h @@ -294,7 +294,7 @@ struct InternalClass : Base { static void removeMember(QV4::Object *object, Identifier identifier); uint find(const Identifier id) { - Q_ASSERT(id.isValid()); + Q_ASSERT(id.isStringOrSymbol()); uint index = propertyTable.lookup(id); if (index < size) diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index 948db67c29..38e5b14b89 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -322,7 +322,7 @@ ReturnedValue Object::get(const Managed *m, Identifier id, const Value *receiver if (id.isArrayIndex()) return static_cast<const Object *>(m)->internalGetIndexed(id.asArrayIndex(), receiver, hasProperty); Scope scope(m); - Scoped<StringOrSymbol> name(scope, id.asHeapObject()); + Scoped<StringOrSymbol> name(scope, id.asStringOrSymbol()); return static_cast<const Object *>(m)->internalGet(name, receiver, hasProperty); } @@ -384,7 +384,7 @@ void Object::advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint * while (it->memberIndex < o->internalClass()->size) { Identifier n = o->internalClass()->nameMap.at(it->memberIndex); - if (!n.isValid() || !n.asHeapObject()->internalClass->vtable->isString) { + if (!n.isStringOrSymbol() || !n.asStringOrSymbol()->internalClass->vtable->isString) { // accessor properties have a dummy entry with n == 0 // symbol entries are supposed to be skipped ++it->memberIndex; @@ -395,7 +395,7 @@ void Object::advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint * PropertyAttributes a = o->internalClass()->propertyData[it->memberIndex]; ++it->memberIndex; if (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable()) { - name->setM(n.asHeapObject()); + name->setM(n.asStringOrSymbol()); *attrs = a; pd->value = *o->propertyData(idx); if (a.isAccessor()) @@ -556,7 +556,7 @@ bool Object::internalPut(Identifier id, const Value &value, Value *receiver) if (index != UINT_MAX) { arraySet(index, value); } else { - Scoped<StringOrSymbol> name(scope, id.asHeapObject()); + Scoped<StringOrSymbol> name(scope, id.asStringOrSymbol()); insertMember(name, value); } return true; @@ -792,7 +792,7 @@ PropertyAttributes Object::getOwnProperty(Managed *m, Identifier id, Property *p return attrs; } } else { - Q_ASSERT(id.asHeapObject()); + Q_ASSERT(id.asStringOrSymbol()); uint member = o->internalClass()->find(id); if (member < UINT_MAX) { @@ -845,7 +845,7 @@ bool Object::defineOwnProperty(Managed *m, Identifier id, const Property *p, Pro } uint memberIndex = o->internalClass()->find(id); - Scoped<StringOrSymbol> name(scope, id.asHeapObject()); + Scoped<StringOrSymbol> name(scope, id.asStringOrSymbol()); if (memberIndex == UINT_MAX) { if (!o->isExtensible()) diff --git a/src/qml/jsruntime/qv4objectiterator.cpp b/src/qml/jsruntime/qv4objectiterator.cpp index fc4a06747f..b656c16739 100644 --- a/src/qml/jsruntime/qv4objectiterator.cpp +++ b/src/qml/jsruntime/qv4objectiterator.cpp @@ -105,7 +105,7 @@ void ObjectIterator::next(Value *name, uint *index, Property *pd, PropertyAttrib bool shadowed = false; while (o->d() != current->heapObject()) { Identifier id = n ? (n->makeIdentifier(), n->identifier()) : Identifier::fromArrayIndex(*index); - if ((id.isValid() ||id.isArrayIndex()) && o->getOwnProperty(id) != Attr_Invalid) { + if (id.isValid() && o->getOwnProperty(id) != Attr_Invalid) { shadowed = true; break; } diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp index 290c5a7a5b..daf31833d7 100644 --- a/src/qml/jsruntime/qv4objectproto.cpp +++ b/src/qml/jsruntime/qv4objectproto.cpp @@ -199,7 +199,7 @@ ReturnedValue ObjectPrototype::method_getOwnPropertySymbols(const FunctionObject ScopedArrayObject array(scope, scope.engine->newArrayObject()); for (uint i = 0; i < ic->size; ++i) { Identifier id = ic->nameMap.at(i); - n = id.asHeapObject(); + n = id.asStringOrSymbol(); if (!n || !n->isSymbol()) continue; array->push_back(n); diff --git a/src/qml/jsruntime/qv4proxy.cpp b/src/qml/jsruntime/qv4proxy.cpp index a17b6085f9..c5c7480f9a 100644 --- a/src/qml/jsruntime/qv4proxy.cpp +++ b/src/qml/jsruntime/qv4proxy.cpp @@ -193,7 +193,7 @@ bool ProxyObject::hasProperty(const Managed *m, Identifier id) JSCallData cdata(scope, 2, nullptr, handler); cdata.args[0] = target; - cdata.args[1] = id.isArrayIndex() ? Primitive::fromUInt32(id.asArrayIndex()).toString(scope.engine) : id.asHeapObject(); + cdata.args[1] = id.isArrayIndex() ? Primitive::fromUInt32(id.asArrayIndex()).toString(scope.engine) : id.asStringOrSymbol(); ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata)); bool result = trapResult->toBoolean(); @@ -233,7 +233,7 @@ PropertyAttributes ProxyObject::getOwnProperty(Managed *m, Identifier id, Proper JSCallData cdata(scope, 2, nullptr, handler); cdata.args[0] = target; - cdata.args[1] = id.isArrayIndex() ? Primitive::fromUInt32(id.asArrayIndex()).toString(scope.engine) : id.asHeapObject(); + cdata.args[1] = id.isArrayIndex() ? Primitive::fromUInt32(id.asArrayIndex()).toString(scope.engine) : id.asStringOrSymbol(); ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata)); if (!trapResult->isObject() && !trapResult->isUndefined()) { @@ -303,7 +303,7 @@ bool ProxyObject::defineOwnProperty(Managed *m, Identifier id, const Property *p JSCallData cdata(scope, 3, nullptr, handler); cdata.args[0] = target; - cdata.args[1] = id.isArrayIndex() ? Primitive::fromUInt32(id.asArrayIndex()).toString(scope.engine) : id.asHeapObject(); + cdata.args[1] = id.isArrayIndex() ? Primitive::fromUInt32(id.asArrayIndex()).toString(scope.engine) : id.asStringOrSymbol(); cdata.args[2] = ObjectPrototype::fromPropertyDescriptor(scope.engine, p, attrs); ScopedValue trapResult(scope, static_cast<const FunctionObject *>(trap.ptr)->call(cdata)); diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp index bbf2ff6352..e04d8bb0e9 100644 --- a/src/qml/jsruntime/qv4qmlcontext.cpp +++ b/src/qml/jsruntime/qv4qmlcontext.cpp @@ -124,7 +124,7 @@ ReturnedValue QQmlContextWrapper::get(const Managed *m, Identifier id, const Val QObject *scopeObject = resource->getScopeObject(); - ScopedString name(scope, id.asHeapObject()); + ScopedString name(scope, id.asStringOrSymbol()); if (context->imports && name->startsWithUpper()) { // Search for attached properties, enums and imported scripts QQmlTypeNameCache::Result r = context->imports->query(name, QQmlImport::AllowRecursion); @@ -270,7 +270,7 @@ bool QQmlContextWrapper::put(Managed *m, Identifier id, const Value &value, Valu // See QV8ContextWrapper::Getter for resolution order QObject *scopeObject = wrapper->getScopeObject(); - ScopedString name(scope, id.asHeapObject()); + ScopedString name(scope, id.asStringOrSymbol()); while (context) { const QV4::IdentifierHash &properties = context->propertyNames(); diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index cd8563d06a..3fd5564847 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -700,7 +700,7 @@ QV4::ReturnedValue QObjectWrapper::get(const Managed *m, Identifier id, const Va const QObjectWrapper *that = static_cast<const QObjectWrapper*>(m); Scope scope(that); - ScopedString n(scope, id.asHeapObject()); + ScopedString n(scope, id.asStringOrSymbol()); QQmlContextData *qmlContext = that->engine()->callingQmlContext(); return that->getQmlProperty(qmlContext, n, IgnoreRevision, hasProperty, /*includeImports*/ true); } @@ -712,7 +712,7 @@ bool QObjectWrapper::put(Managed *m, Identifier id, const Value &value, Value *r Scope scope(m); QObjectWrapper *that = static_cast<QObjectWrapper*>(m); - ScopedString name(scope, id.asHeapObject()); + ScopedString name(scope, id.asStringOrSymbol()); if (scope.engine->hasException || QQmlData::wasDeleted(that->d()->object())) return false; @@ -742,7 +742,7 @@ PropertyAttributes QObjectWrapper::getOwnProperty(Managed *m, Identifier id, Pro const QObject *thatObject = that->d()->object(); if (!QQmlData::wasDeleted(thatObject)) { Scope scope(m); - ScopedString n(scope, id.asHeapObject()); + ScopedString n(scope, id.asStringOrSymbol()); QQmlContextData *qmlContext = scope.engine->callingQmlContext(); QQmlPropertyData local; if (that->findProperty(scope.engine, qmlContext, n, IgnoreRevision, &local) diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp index cfd2d0a5b2..50943525f1 100644 --- a/src/qml/jsruntime/qv4string.cpp +++ b/src/qml/jsruntime/qv4string.cpp @@ -55,7 +55,7 @@ using namespace QV4; void Heap::StringOrSymbol::markObjects(Heap::Base *that, MarkStack *markStack) { StringOrSymbol *s = static_cast<StringOrSymbol *>(that); - Heap::Base *id = s->identifier.asHeapObject(); + Heap::Base *id = s->identifier.asStringOrSymbol(); if (id) id->mark(markStack); } diff --git a/src/qml/jsruntime/qv4symbol.cpp b/src/qml/jsruntime/qv4symbol.cpp index 7bb33dce69..ff1d47cd84 100644 --- a/src/qml/jsruntime/qv4symbol.cpp +++ b/src/qml/jsruntime/qv4symbol.cpp @@ -50,7 +50,7 @@ DEFINE_OBJECT_VTABLE(SymbolObject); void Heap::Symbol::init(const QString &s) { Q_ASSERT(s.at(0) == QLatin1Char('@')); - identifier = Identifier::fromHeapObject(this); + identifier = Identifier::fromStringOrSymbol(this); QString desc(s); text = desc.data_ptr(); text->ref.ref(); diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp index a1bfc109da..2e28a9e222 100644 --- a/src/qml/qml/qqmltypewrapper.cpp +++ b/src/qml/qml/qqmltypewrapper.cpp @@ -176,7 +176,7 @@ ReturnedValue QQmlTypeWrapper::get(const Managed *m, Identifier id, const Value QV4::ExecutionEngine *v4 = static_cast<const QQmlTypeWrapper *>(m)->engine(); QV4::Scope scope(v4); - ScopedString name(scope, id.asHeapObject()); + ScopedString name(scope, id.asStringOrSymbol()); Scoped<QQmlTypeWrapper> w(scope, static_cast<const QQmlTypeWrapper *>(m)); @@ -316,7 +316,7 @@ bool QQmlTypeWrapper::put(Managed *m, Identifier id, const Value &value, Value * if (scope.engine->hasException) return false; - ScopedString name(scope, id.asHeapObject()); + ScopedString name(scope, id.asStringOrSymbol()); QQmlContextData *context = scope.engine->callingQmlContext(); QQmlType type = w->d()->type(); @@ -354,7 +354,7 @@ PropertyAttributes QQmlTypeWrapper::getOwnProperty(Managed *m, Identifier id, Pr { if (id.isString()) { Scope scope(m); - ScopedString n(scope, id.asHeapObject()); + ScopedString n(scope, id.asStringOrSymbol()); // ### Implement more efficiently. bool hasProperty = false; static_cast<Object *>(m)->get(n, &hasProperty); @@ -437,7 +437,7 @@ ReturnedValue QQmlScopedEnumWrapper::get(const Managed *m, Identifier id, const const QQmlScopedEnumWrapper *resource = static_cast<const QQmlScopedEnumWrapper *>(m); QV4::ExecutionEngine *v4 = resource->engine(); QV4::Scope scope(v4); - ScopedString name(scope, id.asHeapObject()); + ScopedString name(scope, id.asStringOrSymbol()); QQmlType type = resource->d()->type(); int index = resource->d()->scopeEnumIndex; diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp index b1993da0a2..bd612221be 100644 --- a/src/qml/qml/qqmlvaluetypewrapper.cpp +++ b/src/qml/qml/qqmlvaluetypewrapper.cpp @@ -245,7 +245,7 @@ PropertyAttributes QQmlValueTypeWrapper::getOwnProperty(Managed *m, Identifier i { if (id.isString()) { Scope scope(m); - ScopedString n(scope, id.asHeapObject()); + ScopedString n(scope, id.asStringOrSymbol()); const QQmlValueTypeWrapper *r = static_cast<const QQmlValueTypeWrapper *>(m); QQmlPropertyData *result = r->d()->propertyCache()->property(n.getPointer(), nullptr, nullptr); return result ? Attr_Data : Attr_Invalid; @@ -369,7 +369,7 @@ ReturnedValue QQmlValueTypeWrapper::get(const Managed *m, Identifier id, const V const QQmlValueTypeWrapper *r = static_cast<const QQmlValueTypeWrapper *>(m); QV4::ExecutionEngine *v4 = r->engine(); Scope scope(v4); - ScopedString name(scope, id.asHeapObject()); + ScopedString name(scope, id.asStringOrSymbol()); // Note: readReferenceValue() can change the reference->type. if (const QQmlValueTypeReference *reference = r->as<QQmlValueTypeReference>()) { @@ -448,7 +448,7 @@ bool QQmlValueTypeWrapper::put(Managed *m, Identifier id, const Value &value, Va writeBackPropertyType = writebackProperty.userType(); } - ScopedString name(scope, id.asHeapObject()); + ScopedString name(scope, id.asStringOrSymbol()); const QMetaObject *metaObject = r->d()->propertyCache()->metaObject(); const QQmlPropertyData *pd = r->d()->propertyCache()->property(name.getPointer(), nullptr, nullptr); diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index f99c4def45..6b6449c20e 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -207,7 +207,7 @@ void QV8Engine::initializeGlobal() { for (uint i = 0; i < m_v4Engine->globalObject->internalClass()->size; ++i) { - if (m_v4Engine->globalObject->internalClass()->nameMap.at(i).isValid()) { + if (m_v4Engine->globalObject->internalClass()->nameMap.at(i).isString()) { QV4::Identifier id = m_v4Engine->globalObject->internalClass()->nameMap.at(i); m_illegalNames.insert(id.toQString()); } @@ -241,7 +241,7 @@ static void freeze_recursive(QV4::ExecutionEngine *v4, QV4::Object *object) QV4::ScopedObject o(scope); for (uint i = 0; i < frozen->size; ++i) { - if (!frozen->nameMap.at(i).isValid()) + if (!frozen->nameMap.at(i).isStringOrSymbol()) continue; o = *object->propertyData(i); if (o) diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 8ddacdfd9b..6933f1e432 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -1591,7 +1591,7 @@ ReturnedValue ModelObject::get(const Managed *m, Identifier id, const Value *rec const ModelObject *that = static_cast<const ModelObject*>(m); Scope scope(that); - ScopedString name(scope, id.asHeapObject()); + ScopedString name(scope, id.asStringOrSymbol()); const ListLayout::Role *role = that->d()->m_model->m_listModel->getExistingRole(name); if (!role) return QObjectWrapper::get(m, id, receiver, hasProperty); |