1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:37:36 +00:00

LibJS: Replace StringOrSymbol::from_value with Value::to_property_key

This is a more specification compliant implementation of the
abstract operation 7.1.19 ToPropertyKey which should handle boxed
symbols correctly.
This commit is contained in:
Idan Horowitz 2021-06-05 15:22:11 +03:00 committed by Linus Groh
parent e72e621d89
commit eb0b1c432a
8 changed files with 29 additions and 29 deletions

View file

@ -15,18 +15,6 @@ namespace JS {
class StringOrSymbol {
public:
static StringOrSymbol from_value(GlobalObject& global_object, Value value)
{
if (value.is_empty())
return {};
if (value.is_symbol())
return &value.as_symbol();
auto string = value.to_string(global_object);
if (string.is_null())
return {};
return string;
}
StringOrSymbol() = default;
StringOrSymbol(const char* chars)