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:
parent
f4c8f2102f
commit
c981d7b9bd
4 changed files with 31 additions and 30 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue