summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-10-24 16:25:39 +0200
committerAndreas Kling <kling@serenityos.org>2021-10-24 17:18:09 +0200
commit65a7296b8f4431eea275b31c1490abd72b1af7c1 (patch)
tree6d4ad41cd9facf7133d9c92d8a527fe66b8e9dcb
parent7ccb8c86093bb05dc25f6a261bb048d1d590eebf (diff)
downloadserenity-65a7296b8f4431eea275b31c1490abd72b1af7c1.zip
LibJS: Make Value::to_property_key() return a JS::PropertyKey
Instead of returning JS::StringOrSymbol, which is a space-optimized type used in Shape property tables, this now returns JS::PropertyKey which is *not* space-optimized, but has other niceties like optimized storage of numeric ("indexed") properties.
-rw-r--r--Userland/Libraries/LibJS/Runtime/ProxyObject.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Value.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Value.h2
3 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp
index f57e763c56..5afd0bf72d 100644
--- a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp
@@ -668,7 +668,7 @@ ThrowCompletionOr<MarkedValueList> ProxyObject::internal_own_property_keys() con
auto trap_result_array = TRY(vm.call(*trap, &m_handler, &m_target));
// 8. Let trapResult be ? CreateListFromArrayLike(trapResultArray, ยซ String, Symbol ยป).
- HashTable<StringOrSymbol> unique_keys;
+ HashTable<PropertyKey> unique_keys;
auto trap_result = TRY(create_list_from_array_like(global_object, trap_result_array, [&](auto value) -> ThrowCompletionOr<void> {
auto& vm = global_object.vm();
if (!value.is_string() && !value.is_symbol())
diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp
index 44474144b2..2e059e092f 100644
--- a/Userland/Libraries/LibJS/Runtime/Value.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Value.cpp
@@ -559,7 +559,7 @@ ThrowCompletionOr<double> Value::to_double(GlobalObject& global_object) const
}
// 7.1.19 ToPropertyKey ( argument ), https://tc39.es/ecma262/#sec-topropertykey
-ThrowCompletionOr<StringOrSymbol> Value::to_property_key(GlobalObject& global_object) const
+ThrowCompletionOr<PropertyKey> Value::to_property_key(GlobalObject& global_object) const
{
auto key = TRY(to_primitive(global_object, PreferredType::String));
if (key.is_symbol())
diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h
index cb1bc76642..4a29327dd0 100644
--- a/Userland/Libraries/LibJS/Runtime/Value.h
+++ b/Userland/Libraries/LibJS/Runtime/Value.h
@@ -314,7 +314,7 @@ public:
ThrowCompletionOr<i64> to_bigint_int64(GlobalObject&) const;
ThrowCompletionOr<u64> to_bigint_uint64(GlobalObject&) const;
ThrowCompletionOr<double> to_double(GlobalObject&) const;
- ThrowCompletionOr<StringOrSymbol> to_property_key(GlobalObject&) const;
+ ThrowCompletionOr<PropertyKey> to_property_key(GlobalObject&) const;
ThrowCompletionOr<i32> to_i32(GlobalObject& global_object) const;
ThrowCompletionOr<u32> to_u32(GlobalObject&) const;
ThrowCompletionOr<i16> to_i16(GlobalObject&) const;