1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

LibJS: Convert IteratorNext AO to ThrowCompletionOr

This commit is contained in:
Timothy Flynn 2021-10-20 08:44:30 -04:00 committed by Linus Groh
parent f4c8f2102f
commit c981d7b9bd
4 changed files with 31 additions and 30 deletions

View file

@ -144,9 +144,10 @@ void IteratorToArray::execute_impl(Bytecode::Interpreter& interpreter) const
size_t index = 0;
while (true) {
auto iterator_result = iterator_next(*iterator);
if (!iterator_result)
auto iterator_result_or_error = iterator_next(*iterator);
if (iterator_result_or_error.is_error())
return;
auto* iterator_result = iterator_result_or_error.release_value();
auto complete = iterator_complete(global_object, *iterator_result);
if (vm.exception())
@ -490,7 +491,13 @@ void IteratorNext::execute_impl(Bytecode::Interpreter& interpreter) const
if (object_or_error.is_error())
return;
auto* object = object_or_error.release_value();
interpreter.accumulator() = iterator_next(*object);
auto iterator_result_or_error = iterator_next(*object);
if (iterator_result_or_error.is_error())
return;
auto* iterator_result = iterator_result_or_error.release_value();
interpreter.accumulator() = iterator_result;
}
void IteratorResultDone::execute_impl(Bytecode::Interpreter& interpreter) const