mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibJS: Convert to_u16() to ThrowCompletionOr
This commit is contained in:
parent
627b1205ce
commit
7bbb92dfe9
Notes:
sideshowbarker
2024-07-18 02:12:31 +09:00
Author: https://github.com/IdanHo
Commit: 7bbb92dfe9
Pull-request: https://github.com/SerenityOS/serenity/pull/10522
Reviewed-by: https://github.com/linusg ✅
5 changed files with 7 additions and 13 deletions
|
@ -105,12 +105,8 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::from_char_code)
|
|||
Vector<u16, 1> string;
|
||||
string.ensure_capacity(vm.argument_count());
|
||||
|
||||
for (size_t i = 0; i < vm.argument_count(); ++i) {
|
||||
auto code_unit = vm.argument(i).to_u16(global_object);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
string.append(code_unit);
|
||||
}
|
||||
for (size_t i = 0; i < vm.argument_count(); ++i)
|
||||
string.append(TRY_OR_DISCARD(vm.argument(i).to_u16(global_object)));
|
||||
|
||||
return js_string(vm, Utf16String(move(string)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue