mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:27:45 +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
2 changed files with 4 additions and 4 deletions
|
@ -22,13 +22,13 @@ public:
|
||||||
explicit Map(Object& prototype);
|
explicit Map(Object& prototype);
|
||||||
virtual ~Map() override;
|
virtual ~Map() override;
|
||||||
|
|
||||||
HashMap<Value, Value, ValueTraits> const& entries() const { return m_entries; };
|
OrderedHashMap<Value, Value, ValueTraits> const& entries() const { return m_entries; };
|
||||||
HashMap<Value, Value, ValueTraits>& entries() { return m_entries; };
|
OrderedHashMap<Value, Value, ValueTraits>& entries() { return m_entries; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void visit_edges(Visitor& visitor) override;
|
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;
|
Map& m_map;
|
||||||
bool m_done { false };
|
bool m_done { false };
|
||||||
Object::PropertyKind m_iteration_kind;
|
Object::PropertyKind m_iteration_kind;
|
||||||
HashMap<Value, Value, ValueTraits>::IteratorType m_iterator;
|
OrderedHashMap<Value, Value, ValueTraits>::IteratorType m_iterator;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue