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

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.
This commit is contained in:
Andreas Kling 2021-10-24 16:25:39 +02:00
parent 7ccb8c8609
commit 65a7296b8f
3 changed files with 3 additions and 3 deletions

View file

@ -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())