1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

LibJS: Use HashTable::take_first in GetObjectPropertyIterator

This is a bit more idiomatic than
```c++
auto it = table.begin();
auto k = *it;
table.remove(it);
```
and also saves us from copying the stored value.
This commit is contained in:
Hediadyoin1 2023-02-21 11:32:30 +01:00 committed by Jelle Raaijmakers
parent fd8c54d720
commit 1c8adac442

View file

@ -939,9 +939,7 @@ ThrowCompletionOr<void> GetObjectPropertyIterator::execute_impl(Bytecode::Interp
return result_object;
}
auto it = items.begin();
auto key = *it;
items.remove(it);
auto key = items.take_first();
// If the key was already seen, skip over it (invariant no. 4)
auto result = seen_items.set(key);