1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

LibJS: Use OrderedHashTable instead of HashTable in the Set built-in

This ensures insertion-order iteration.
This commit is contained in:
Idan Horowitz 2021-06-16 00:01:03 +03:00 committed by Linus Groh
parent a27fbfd45f
commit 08ff148bc3
Notes: sideshowbarker 2024-07-18 12:12:50 +09:00
2 changed files with 4 additions and 4 deletions

View file

@ -22,13 +22,13 @@ public:
explicit Set(Object& prototype); explicit Set(Object& prototype);
virtual ~Set() override; virtual ~Set() override;
HashTable<Value, ValueTraits> const& values() const { return m_values; }; OrderedHashTable<Value, ValueTraits> const& values() const { return m_values; };
HashTable<Value, ValueTraits>& values() { return m_values; }; OrderedHashTable<Value, ValueTraits>& values() { return m_values; };
private: private:
virtual void visit_edges(Visitor& visitor) override; 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;
}; };
} }

View file

@ -33,7 +33,7 @@ private:
Set& m_set; Set& m_set;
bool m_done { false }; bool m_done { false };
Object::PropertyKind m_iteration_kind; Object::PropertyKind m_iteration_kind;
HashTable<Value, ValueTraits>::Iterator m_iterator; OrderedHashTable<Value, ValueTraits>::Iterator m_iterator;
}; };
} }