mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:57:46 +00:00
LibJS: Convert IteratorStep AO to ThrowCompletionOr
This commit is contained in:
parent
c981d7b9bd
commit
8be1caa05d
7 changed files with 12 additions and 20 deletions
|
@ -51,9 +51,7 @@ ThrowCompletionOr<MarkedValueList> iterable_to_list_of_type(GlobalObject& global
|
|||
// 4. Repeat, while next is not false,
|
||||
while (next) {
|
||||
// a. Set next to ? IteratorStep(iteratorRecord).
|
||||
auto* iterator_result = iterator_step(global_object, *iterator_record);
|
||||
if (auto* exception = vm.exception())
|
||||
return throw_completion(exception->value());
|
||||
auto* iterator_result = TRY(iterator_step(global_object, *iterator_record));
|
||||
next = iterator_result;
|
||||
|
||||
// b. If next is not false, then
|
||||
|
|
|
@ -501,9 +501,7 @@ JS_DEFINE_OLD_NATIVE_FUNCTION(CalendarPrototype::fields)
|
|||
// 7. Repeat, while next is not false,
|
||||
while (true) {
|
||||
// a. Set next to ? IteratorStep(iteratorRecord).
|
||||
auto* next = iterator_step(global_object, *iterator_record);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
auto* next = TRY_OR_DISCARD(iterator_step(global_object, *iterator_record));
|
||||
|
||||
// b. If next is not false, then
|
||||
if (!next)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue