diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2022-02-09 16:34:52 +0330 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-02-09 20:57:41 +0000 |
commit | 4a73ec07c53326c6ae9f8e90f551c1c9bce7d736 (patch) | |
tree | 97fedaf9ee7423ab4b0ce89d27cbfefd5220c379 /Userland/Utilities | |
parent | e7dea10381578628e492fa2d6dc6b77e9821f306 (diff) | |
download | serenity-4a73ec07c53326c6ae9f8e90f551c1c9bce7d736.zip |
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.
Diffstat (limited to 'Userland/Utilities')
-rw-r--r-- | Userland/Utilities/js.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index 3219136226..066bc1d0ef 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -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(" => "); |