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:
parent
e72e621d89
commit
eb0b1c432a
8 changed files with 29 additions and 29 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue