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 /src/qml/jsruntime/qv4object.cpp | |
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>
Diffstat (limited to 'src/qml/jsruntime/qv4object.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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()) |