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 committed by Jelle Raaijmakers
parent 7477002e46
commit dba1798de7
Notes: github-actions[bot] 2025-03-27 15:01:55 +00:00

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;