diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp index 9d0a96af6a..565d8f347e 100644 --- a/Libraries/LibJS/AST.cpp +++ b/Libraries/LibJS/AST.cpp @@ -51,7 +51,7 @@ namespace JS { -static void update_function_name(Value& value, const FlyString& name, HashTable& visited) +static void update_function_name(Value value, const FlyString& name, HashTable& visited) { if (!value.is_object()) return; @@ -65,12 +65,13 @@ static void update_function_name(Value& value, const FlyString& name, HashTable< static_cast(function).set_name(name); } else if (object.is_array()) { auto& array = static_cast(object); - for (auto& entry : array.indexed_properties().values_unordered()) - update_function_name(entry.value, name, visited); + array.indexed_properties().for_each_value([&](auto& array_element_value) { + update_function_name(array_element_value, name, visited); + }); } } -static void update_function_name(Value& value, const FlyString& name) +static void update_function_name(Value value, const FlyString& name) { HashTable visited; update_function_name(value, name, visited); diff --git a/Libraries/LibJS/Runtime/IndexedProperties.cpp b/Libraries/LibJS/Runtime/IndexedProperties.cpp index 146296287c..7dc1b4b9a3 100644 --- a/Libraries/LibJS/Runtime/IndexedProperties.cpp +++ b/Libraries/LibJS/Runtime/IndexedProperties.cpp @@ -387,24 +387,6 @@ Vector IndexedProperties::indices() const return indices; } -Vector IndexedProperties::values_unordered() const -{ - if (m_storage->is_simple_storage()) { - const auto& elements = static_cast(*m_storage).elements(); - Vector with_attributes; - for (auto& value : elements) - with_attributes.append({ value, default_attributes }); - return with_attributes; - } - - auto& storage = static_cast(*m_storage); - auto values = storage.packed_elements(); - values.ensure_capacity(values.size() + storage.sparse_elements().size()); - for (auto& entry : storage.sparse_elements()) - values.unchecked_append(entry.value); - return values; -} - void IndexedProperties::switch_to_generic_storage() { auto& storage = static_cast(*m_storage); diff --git a/Libraries/LibJS/Runtime/IndexedProperties.h b/Libraries/LibJS/Runtime/IndexedProperties.h index 3509e81689..984c3cef4c 100644 --- a/Libraries/LibJS/Runtime/IndexedProperties.h +++ b/Libraries/LibJS/Runtime/IndexedProperties.h @@ -167,8 +167,6 @@ public: Vector indices() const; - Vector values_unordered() const; - template void for_each_value(Callback callback) {