mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
LibJS: Use array-like size for IndexedProperties::is_empty()
Some things, like (the non-generic version of) Array.prototype.pop(), check is_empty() to determine whether an action, like removing elements, can be performed. We need to know the array-like size for that, not the size of the underlying storage, which can be different - and is not something IndexedProperties should expose so I removed its size(). Fixes #3948.
This commit is contained in:
parent
0bb66890c8
commit
dec6c0a207
2 changed files with 7 additions and 2 deletions
|
@ -161,8 +161,7 @@ public:
|
|||
IndexedPropertyIterator begin(bool skip_empty = true) const { return IndexedPropertyIterator(*this, 0, skip_empty); };
|
||||
IndexedPropertyIterator end() const { return IndexedPropertyIterator(*this, array_like_size(), false); };
|
||||
|
||||
size_t size() const { return m_storage->size(); }
|
||||
bool is_empty() const { return size() == 0; }
|
||||
bool is_empty() const { return array_like_size() == 0; }
|
||||
size_t array_like_size() const { return m_storage->array_like_size(); }
|
||||
void set_array_like_size(size_t);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue