mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
LibJS: Use OrderedHashTable instead of HashTable in the Set built-in
This ensures insertion-order iteration.
This commit is contained in:
parent
a27fbfd45f
commit
08ff148bc3
Notes:
sideshowbarker
2024-07-18 12:12:50 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/08ff148bc38 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 Set(Object& prototype);
|
||||
virtual ~Set() override;
|
||||
|
||||
HashTable<Value, ValueTraits> const& values() const { return m_values; };
|
||||
HashTable<Value, ValueTraits>& values() { return m_values; };
|
||||
OrderedHashTable<Value, ValueTraits> const& values() const { return m_values; };
|
||||
OrderedHashTable<Value, ValueTraits>& values() { return m_values; };
|
||||
|
||||
private:
|
||||
virtual void visit_edges(Visitor& visitor) override;
|
||||
|
||||
HashTable<Value, ValueTraits> m_values; // FIXME: Replace with a HashTable that maintains a linked list of insertion order for correct iteration order
|
||||
OrderedHashTable<Value, ValueTraits> m_values;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ private:
|
|||
Set& m_set;
|
||||
bool m_done { false };
|
||||
Object::PropertyKind m_iteration_kind;
|
||||
HashTable<Value, ValueTraits>::Iterator m_iterator;
|
||||
OrderedHashTable<Value, ValueTraits>::Iterator m_iterator;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue