mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:47:44 +00:00
LibJS: Convert IteratorNext AO to ThrowCompletionOr
This commit is contained in:
parent
f4c8f2102f
commit
c981d7b9bd
4 changed files with 31 additions and 30 deletions
|
@ -359,12 +359,12 @@ ThrowCompletionOr<void> VM::iterator_binding_initialization(BindingPattern const
|
|||
|
||||
auto* array = Array::create(global_object, 0);
|
||||
while (!iterator_done) {
|
||||
auto next_object = iterator_next(*iterator);
|
||||
if (!next_object) {
|
||||
auto next_object_or_error = iterator_next(*iterator);
|
||||
if (next_object_or_error.is_throw_completion()) {
|
||||
iterator_done = true;
|
||||
VERIFY(exception());
|
||||
return JS::throw_completion(exception()->value());
|
||||
return JS::throw_completion(next_object_or_error.release_error().value());
|
||||
}
|
||||
auto* next_object = next_object_or_error.release_value();
|
||||
|
||||
auto done_property = TRY(next_object->get(names.done));
|
||||
if (done_property.to_boolean()) {
|
||||
|
@ -378,12 +378,12 @@ ThrowCompletionOr<void> VM::iterator_binding_initialization(BindingPattern const
|
|||
value = array;
|
||||
|
||||
} else if (!iterator_done) {
|
||||
auto next_object = iterator_next(*iterator);
|
||||
if (!next_object) {
|
||||
auto next_object_or_error = iterator_next(*iterator);
|
||||
if (next_object_or_error.is_throw_completion()) {
|
||||
iterator_done = true;
|
||||
VERIFY(exception());
|
||||
return JS::throw_completion(exception()->value());
|
||||
return JS::throw_completion(next_object_or_error.release_error().value());
|
||||
}
|
||||
auto* next_object = next_object_or_error.release_value();
|
||||
|
||||
auto done_property = TRY(next_object->get(names.done));
|
||||
if (done_property.to_boolean()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue