mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-01 15:18:06 +00:00
LibJS: Convert to_utf16_string() to ThrowCompletionOr
This commit is contained in:
parent
4d8912a92b
commit
da59c77fe3
Notes:
sideshowbarker
2024-07-18 02:47:42 +09:00
Author: https://github.com/linusg
Commit: da59c77fe3
Pull-request: https://github.com/SerenityOS/serenity/pull/10452
Reviewed-by: https://github.com/IdanHo ✅
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