diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-09-08 23:07:31 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-09-09 15:52:10 +0000 |
commit | bcc9aa7daf197e8f2befe215902443d608e07b6a (patch) | |
tree | 89d077b637c683e5b8add795e0b8ba2089dc4a3d /src/qml/jsruntime/qv4object.cpp | |
parent | 166fc4d84729fee683a9ea6b2c27cf51dc5f1c9d (diff) |
Include symbols in getOwnPropertyKeys
And fix getOwnPropertySymbols and getOwnPropertyDescriptors.
Change-Id: Ie0e4c3d308ffe8a904e9a6ab9242b2cda59d779f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4object.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index 267726d22f..cd9ea66297 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -366,25 +366,39 @@ PropertyKey ObjectOwnPropertyKeyIterator::next(const Object *o, Property *pd, Pr arrayIndex = UINT_MAX; } - while (memberIndex < o->internalClass()->size) { - PropertyKey n = o->internalClass()->nameMap.at(memberIndex); - if (!n.isStringOrSymbol()) { - // accessor properties have a dummy entry with n == 0 - ++memberIndex; - continue; - } + while (true) { + while (memberIndex < o->internalClass()->size) { + PropertyKey n = o->internalClass()->nameMap.at(memberIndex); + if (!n.isStringOrSymbol()) { + // accessor properties have a dummy entry with n == 0 + ++memberIndex; + continue; + } + if (!iterateOverSymbols && n.isSymbol()) { + ++memberIndex; + continue; + } + if (iterateOverSymbols && !n.isSymbol()) { + ++memberIndex; + continue; + } - uint index = memberIndex; - PropertyAttributes a = o->internalClass()->propertyData[memberIndex]; - ++memberIndex; - if (pd) { - pd->value = *o->propertyData(index); - if (a.isAccessor()) - pd->set = *o->propertyData(index + Object::SetterOffset); + uint index = memberIndex; + PropertyAttributes a = o->internalClass()->propertyData[memberIndex]; + ++memberIndex; + if (pd) { + pd->value = *o->propertyData(index); + if (a.isAccessor()) + pd->set = *o->propertyData(index + Object::SetterOffset); + } + if (attrs) + *attrs = a; + return n; } - if (attrs) - *attrs = a; - return n; + if (iterateOverSymbols) + break; + iterateOverSymbols = true; + memberIndex = 0; } return PropertyKey::invalid(); |