diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-09-23 12:10:12 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-09-27 08:33:55 +0000 |
commit | f63d48d474db7e9eff7583f1b8478228b13d3c82 (patch) | |
tree | 4bc1dd1f4f7b2f9a5df5b40247e1a8245169b903 /src/qml/jsruntime/qv4lookup.cpp | |
parent | 1804fea8893c355dbd585e373cb9644387410a92 (diff) |
Differentiate between finding for get and set in InternalClass
This is required, so we can get rid of the requirement that
getter and setter live next to each other in the member data.
Change-Id: I2ed57a171628af4dfecd1836d00e958c6bed9d4f
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4lookup.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4lookup.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp index 141d9b5afb..994daa864b 100644 --- a/src/qml/jsruntime/qv4lookup.cpp +++ b/src/qml/jsruntime/qv4lookup.cpp @@ -50,7 +50,7 @@ using namespace QV4; void Lookup::resolveProtoGetter(PropertyKey name, const Heap::Object *proto) { while (proto) { - auto index = proto->internalClass->find(name); + auto index = proto->internalClass->findValueOrGetter(name); if (index.isValid()) { PropertyAttributes attrs = index.attrs; protoLookup.data = proto->propertyData(index.index); @@ -77,7 +77,7 @@ ReturnedValue Lookup::resolveGetter(ExecutionEngine *engine, const Object *objec return getter(this, engine, *object); } - auto index = obj->internalClass->find(name); + auto index = obj->internalClass->findValueOrGetter(name); if (index.isValid()) { PropertyAttributes attrs = index.attrs; uint nInline = obj->vtable()->nInlineProperties; @@ -478,9 +478,10 @@ bool Lookup::resolveSetter(ExecutionEngine *engine, Object *object, const Value Heap::InternalClass *c = object->internalClass(); PropertyKey key = name->toPropertyKey(); - auto idx = c->find(key); + auto idx = c->findValueOrSetter(key); if (idx.isValid()) { if (object->isArrayObject() && idx.index == Heap::ArrayObject::LengthPropertyIndex) { + Q_ASSERT(!idx.attrs.isAccessor()); setter = arrayLengthSetter; return setter(this, engine, *object, value); } else if (idx.attrs.isData() && idx.attrs.isWritable()) { @@ -506,8 +507,8 @@ bool Lookup::resolveSetter(ExecutionEngine *engine, Object *object, const Value setter = setterFallback; return true; } - idx = object->internalClass()->find(key); - if (!idx.isValid()) { // ### can this even happen? + idx = object->internalClass()->findValueOrSetter(key); + if (!idx.isValid() || idx.attrs.isAccessor()) { // ### can this even happen? setter = setterFallback; return false; } |