mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
LibJS: Convert IterableToList AO to ThrowCompletionOr
This commit is contained in:
parent
ec54a7b5b0
commit
03b251a704
Notes:
sideshowbarker
2024-07-18 02:06:48 +09:00
Author: https://github.com/trflynn89
Commit: 03b251a704
Pull-request: https://github.com/SerenityOS/serenity/pull/10546
Reviewed-by: https://github.com/IdanHo
Reviewed-by: https://github.com/linusg ✅
5 changed files with 8 additions and 14 deletions
|
@ -147,19 +147,19 @@ Object* create_iterator_result_object(GlobalObject& global_object, Value value,
|
|||
}
|
||||
|
||||
// 7.4.10 IterableToList ( items [ , method ] ), https://tc39.es/ecma262/#sec-iterabletolist
|
||||
MarkedValueList iterable_to_list(GlobalObject& global_object, Value iterable, Value method)
|
||||
ThrowCompletionOr<MarkedValueList> iterable_to_list(GlobalObject& global_object, Value iterable, Value method)
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
MarkedValueList values(vm.heap());
|
||||
|
||||
(void)get_iterator_values(
|
||||
TRY(get_iterator_values(
|
||||
global_object, iterable, [&](auto value) -> Optional<Completion> {
|
||||
values.append(value);
|
||||
return {};
|
||||
},
|
||||
method);
|
||||
method));
|
||||
|
||||
return values;
|
||||
return { move(values) };
|
||||
}
|
||||
|
||||
Completion get_iterator_values(GlobalObject& global_object, Value iterable, IteratorValueCallback callback, Value method)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue