1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 19:07:34 +00:00

LibJS: Convert GetIterator AO to ThrowCompletionOr

This commit is contained in:
Timothy Flynn 2021-10-20 08:24:54 -04:00 committed by Linus Groh
parent a3b3800cd4
commit 860a37640b
9 changed files with 56 additions and 48 deletions

View file

@ -41,9 +41,7 @@ ThrowCompletionOr<MarkedValueList> iterable_to_list_of_type(GlobalObject& global
auto& heap = global_object.heap();
// 1. Let iteratorRecord be ? GetIterator(items, sync).
auto iterator_record = get_iterator(global_object, items, IteratorHint::Sync);
if (auto* exception = vm.exception())
return throw_completion(exception->value());
auto iterator_record = TRY(get_iterator(global_object, items, IteratorHint::Sync));
// 2. Let values be a new empty List.
MarkedValueList values(heap);

View file

@ -492,9 +492,7 @@ JS_DEFINE_OLD_NATIVE_FUNCTION(CalendarPrototype::fields)
VERIFY(calendar->identifier() == "iso8601"sv);
// 4. Let iteratorRecord be ? Getiterator(fields, sync).
auto* iterator_record = get_iterator(global_object, fields, IteratorHint::Sync);
if (vm.exception())
return {};
auto* iterator_record = TRY_OR_DISCARD(get_iterator(global_object, fields, IteratorHint::Sync));
// 5. Let fieldNames be a new empty List.
auto field_names = MarkedValueList { vm.heap() };