1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +00:00

LibJS: Use IndexedProperties::for_each_value() in update_function_name()

This allows us to get rid of IndexedProperties::values_unordered().
This commit is contained in:
Andreas Kling 2020-12-08 15:08:49 +01:00
parent 6c4b823cef
commit d2e3e038d6
3 changed files with 5 additions and 24 deletions

View file

@ -51,7 +51,7 @@
namespace JS {
static void update_function_name(Value& value, const FlyString& name, HashTable<const JS::Cell*>& visited)
static void update_function_name(Value value, const FlyString& name, HashTable<const JS::Cell*>& visited)
{
if (!value.is_object())
return;
@ -65,12 +65,13 @@ static void update_function_name(Value& value, const FlyString& name, HashTable<
static_cast<ScriptFunction&>(function).set_name(name);
} else if (object.is_array()) {
auto& array = static_cast<Array&>(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<const JS::Cell*> visited;
update_function_name(value, name, visited);