mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:57:46 +00:00
LibJS: Convert to_utf16_string() to ThrowCompletionOr
This commit is contained in:
parent
4d8912a92b
commit
da59c77fe3
5 changed files with 30 additions and 90 deletions
|
@ -363,12 +363,12 @@ ThrowCompletionOr<String> Value::to_string(GlobalObject& global_object) const
|
|||
}
|
||||
}
|
||||
|
||||
Utf16String Value::to_utf16_string(GlobalObject& global_object) const
|
||||
ThrowCompletionOr<Utf16String> Value::to_utf16_string(GlobalObject& global_object) const
|
||||
{
|
||||
if (m_type == Type::String)
|
||||
return m_value.as_string->utf16_string();
|
||||
|
||||
auto utf8_string = TRY_OR_DISCARD(to_string(global_object));
|
||||
auto utf8_string = TRY(to_string(global_object));
|
||||
return Utf16String(utf8_string);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue