LibJS: Add support for constructing a PropertyKey from a FlyString

This commit is contained in:
Shannon Booth 2024-03-31 11:56:13 +02:00 committed by Andreas Kling
parent 8fa0730b84
commit 713d8dc0f8
Notes: sideshowbarker 2024-07-17 06:35:16 +09:00

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/DeprecatedFlyString.h>
#include <AK/FlyString.h>
#include <LibJS/Heap/Handle.h>
#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/StringOrSymbol.h>
@ -71,6 +72,12 @@ public:
{
}
PropertyKey(FlyString const& string)
: m_type(Type::String)
, m_string(string.to_deprecated_fly_string())
{
}
PropertyKey(DeprecatedFlyString string, StringMayBeNumber string_may_be_number = StringMayBeNumber::Yes)
: m_string_may_be_number(string_may_be_number == StringMayBeNumber::Yes)
, m_type(Type::String)