LibJS: Make StringOrSymbol::as_string() return a const reference

No need to copy the FlyString here, we can avoid the ref count churn.
This commit is contained in:
Andreas Kling 2025-03-26 14:08:47 +00:00
parent 261774f070
commit 718d6e6927

View file

@ -57,7 +57,7 @@ public:
ALWAYS_INLINE bool is_symbol() const { return is_valid() && (m_bits & 2); }
ALWAYS_INLINE bool is_string() const { return is_valid() && !(m_bits & 2); }
ALWAYS_INLINE FlyString as_string() const
ALWAYS_INLINE FlyString const& as_string() const
{
VERIFY(is_string());
return m_string;