mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
LibJS: Use OrderedHashMap instead of HashMap in the Map built-in
This ensures insertion-order iteration.
This commit is contained in:
parent
f1f00be691
commit
a27fbfd45f
Notes:
sideshowbarker
2024-07-18 12:12:53 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/a27fbfd45f0 Pull-request: https://github.com/SerenityOS/serenity/pull/8076 Reviewed-by: https://github.com/linusg ✅
2 changed files with 4 additions and 4 deletions
|
@ -22,13 +22,13 @@ public:
|
|||
explicit Map(Object& prototype);
|
||||
virtual ~Map() override;
|
||||
|
||||
HashMap<Value, Value, ValueTraits> const& entries() const { return m_entries; };
|
||||
HashMap<Value, Value, ValueTraits>& entries() { return m_entries; };
|
||||
OrderedHashMap<Value, Value, ValueTraits> const& entries() const { return m_entries; };
|
||||
OrderedHashMap<Value, Value, ValueTraits>& entries() { return m_entries; };
|
||||
|
||||
private:
|
||||
virtual void visit_edges(Visitor& visitor) override;
|
||||
|
||||
HashMap<Value, Value, ValueTraits> m_entries; // FIXME: Replace with a HashMap that maintains a linked list of insertion order for correct iteration order
|
||||
OrderedHashMap<Value, Value, ValueTraits> m_entries;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ private:
|
|||
Map& m_map;
|
||||
bool m_done { false };
|
||||
Object::PropertyKind m_iteration_kind;
|
||||
HashMap<Value, Value, ValueTraits>::IteratorType m_iterator;
|
||||
OrderedHashMap<Value, Value, ValueTraits>::IteratorType m_iterator;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue