mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-29 10:02:14 +00:00
optimize Object::enumeration
Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
96293e2716
commit
abc8d38ff7
14 changed files with 175 additions and 97 deletions
|
|
@ -47,14 +47,14 @@ bool StringObject::deleteOwnProperty(ExecutionState& state, const ObjectProperty
|
|||
return Object::deleteOwnProperty(state, P);
|
||||
}
|
||||
|
||||
void StringObject::enumeration(ExecutionState& state, std::function<bool(const ObjectPropertyName&, const ObjectStructurePropertyDescriptor& desc)> callback) ESCARGOT_OBJECT_SUBCLASS_MUST_REDEFINE
|
||||
void StringObject::enumeration(ExecutionState& state, bool (*callback)(ExecutionState& state, Object* self, const ObjectPropertyName&, const ObjectStructurePropertyDescriptor& desc, void* data), void* data) ESCARGOT_OBJECT_SUBCLASS_MUST_REDEFINE
|
||||
{
|
||||
size_t len = m_primitiveValue->length();
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
if (!callback(ObjectPropertyName(state, Value(i)), ObjectStructurePropertyDescriptor::createDataDescriptor(ObjectStructurePropertyDescriptor::EnumerablePresent))) {
|
||||
if (!callback(state, this, ObjectPropertyName(state, Value(i)), ObjectStructurePropertyDescriptor::createDataDescriptor(ObjectStructurePropertyDescriptor::EnumerablePresent), data)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Object::enumeration(state, callback);
|
||||
Object::enumeration(state, callback, data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue