mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:17:35 +00:00
LibJS: Make Map iterators independent of the underlying hashmap
This implements ordered maps as a pair of an RBTree for key order, and an underlying unordered hash map for storage. Fixes (part of) #11004.
This commit is contained in:
parent
e7dea10381
commit
4a73ec07c5
8 changed files with 153 additions and 19 deletions
|
@ -358,11 +358,10 @@ static void print_proxy_object(JS::Object const& object, HashTable<JS::Object*>&
|
|||
static void print_map(JS::Object const& object, HashTable<JS::Object*>& seen_objects)
|
||||
{
|
||||
auto& map = static_cast<JS::Map const&>(object);
|
||||
auto& entries = map.entries();
|
||||
print_type("Map");
|
||||
js_out(" {{");
|
||||
bool first = true;
|
||||
for (auto& entry : entries) {
|
||||
for (auto& entry : map) {
|
||||
print_separator(first);
|
||||
print_value(entry.key, seen_objects);
|
||||
js_out(" => ");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue