1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:07:46 +00:00

LibJS: Convert IteratorStep AO to ThrowCompletionOr

This commit is contained in:
Timothy Flynn 2021-10-20 08:56:01 -04:00 committed by Linus Groh
parent c981d7b9bd
commit 8be1caa05d
7 changed files with 12 additions and 20 deletions

View file

@ -75,15 +75,15 @@ Value iterator_value(GlobalObject& global_object, Object& iterator_result)
}
// 7.4.5 IteratorStep ( iteratorRecord ), https://tc39.es/ecma262/#sec-iteratorstep
Object* iterator_step(GlobalObject& global_object, Object& iterator)
ThrowCompletionOr<Object*> iterator_step(GlobalObject& global_object, Object& iterator)
{
auto& vm = global_object.vm();
auto result = TRY_OR_DISCARD(iterator_next(iterator));
auto* result = TRY(iterator_next(iterator));
auto done = iterator_complete(global_object, *result);
if (vm.exception())
return {};
if (auto* exception = vm.exception())
return throw_completion(exception->value());
if (done)
return nullptr;