diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index 94d93da5aa..8035696b18 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.cpp +++ b/Userland/Libraries/LibJS/Runtime/Object.cpp @@ -445,7 +445,7 @@ ThrowCompletionOr Object::enumerable_own_property_names(Propert } // 7.3.25 CopyDataProperties ( target, source, excludedItems ), https://tc39.es/ecma262/#sec-copydataproperties -ThrowCompletionOr Object::copy_data_properties(Value source, HashTable const& seen_names, GlobalObject& global_object) +ThrowCompletionOr Object::copy_data_properties(Value source, HashTable const& seen_names, GlobalObject& global_object) { if (source.is_nullish()) return this; diff --git a/Userland/Libraries/LibJS/Runtime/Object.h b/Userland/Libraries/LibJS/Runtime/Object.h index 472a2c7e8e..673fa5fd25 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.h +++ b/Userland/Libraries/LibJS/Runtime/Object.h @@ -101,7 +101,7 @@ public: ThrowCompletionOr set_integrity_level(IntegrityLevel); ThrowCompletionOr test_integrity_level(IntegrityLevel) const; ThrowCompletionOr enumerable_own_property_names(PropertyKind kind) const; - ThrowCompletionOr copy_data_properties(Value source, HashTable const& seen_names, GlobalObject& global_object); + ThrowCompletionOr copy_data_properties(Value source, HashTable const& seen_names, GlobalObject& global_object); PrivateElement* private_element_find(PrivateName const& name); ThrowCompletionOr private_field_add(PrivateName const& name, Value value); diff --git a/Userland/Libraries/LibJS/Runtime/PropertyKey.h b/Userland/Libraries/LibJS/Runtime/PropertyKey.h index 29679b3ebb..b6eb92505c 100644 --- a/Userland/Libraries/LibJS/Runtime/PropertyKey.h +++ b/Userland/Libraries/LibJS/Runtime/PropertyKey.h @@ -189,8 +189,13 @@ private: Symbol* m_symbol { nullptr }; }; -struct PropertyNameTraits : public Traits { - static unsigned hash(PropertyKey const& name) +} + +namespace AK { + +template<> +struct Traits : public GenericTraits { + static unsigned hash(JS::PropertyKey const& name) { VERIFY(name.is_valid()); if (name.is_string()) @@ -200,17 +205,17 @@ struct PropertyNameTraits : public Traits { return ptr_hash(name.as_symbol()); } - static bool equals(PropertyKey const& a, PropertyKey const& b) + static bool equals(JS::PropertyKey const& a, JS::PropertyKey const& b) { if (a.type() != b.type()) return false; switch (a.type()) { - case PropertyKey::Type::Number: + case JS::PropertyKey::Type::Number: return a.as_number() == b.as_number(); - case PropertyKey::Type::String: + case JS::PropertyKey::Type::String: return a.as_string() == b.as_string(); - case PropertyKey::Type::Symbol: + case JS::PropertyKey::Type::Symbol: return a.as_symbol() == b.as_symbol(); default: VERIFY_NOT_REACHED(); @@ -218,10 +223,6 @@ struct PropertyNameTraits : public Traits { } }; -} - -namespace AK { - template<> struct Formatter : Formatter { void format(FormatBuilder& builder, JS::PropertyKey const& property_name) diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index b4f7b3f889..c7995a3cd3 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -219,7 +219,7 @@ ThrowCompletionOr VM::property_binding_initialization(BindingPattern const { auto* object = TRY(value.to_object(global_object)); - HashTable seen_names; + HashTable seen_names; for (auto& property : binding.entries) { VERIFY(!property.is_elision()); diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h index 970acaf67f..d54184dddc 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.h +++ b/Userland/Libraries/LibJS/Runtime/VM.h @@ -279,7 +279,7 @@ private: [[nodiscard]] ThrowCompletionOr call_internal(FunctionObject&, Value this_value, Optional arguments); - ThrowCompletionOr copy_data_properties(Object& rest_object, Object const& source, HashTable const& seen_names, GlobalObject& global_object); + ThrowCompletionOr copy_data_properties(Object& rest_object, Object const& source, HashTable const& seen_names, GlobalObject& global_object); ThrowCompletionOr property_binding_initialization(BindingPattern const& binding, Value value, Environment* environment, GlobalObject& global_object); ThrowCompletionOr iterator_binding_initialization(BindingPattern const& binding, Object* iterator, bool& iterator_done, Environment* environment, GlobalObject& global_object);