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

LibJS: Use IteratorStepValue in ECMA-262

This is an editorial change in the ECMA-262 spec. See:
12d3687

Note they have not yet updated all potential consumers to use this new
AO.
This commit is contained in:
Timothy Flynn 2024-02-01 14:53:28 -05:00 committed by Tim Flynn
parent 2b96e732dd
commit 18847fca50
9 changed files with 80 additions and 156 deletions

View file

@ -66,12 +66,12 @@ ThrowCompletionOr<NonnullGCPtr<Object>> SetConstructor::construct(FunctionObject
// 7. Let iteratorRecord be ? GetIterator(iterable, sync).
// 8. Repeat,
// a. Let next be ? IteratorStep(iteratorRecord).
// c. Let nextValue be ? IteratorValue(next).
(void)TRY(get_iterator_values(vm, iterable, [&](Value next_value) -> Optional<Completion> {
// d. Let status be Completion(Call(adder, set, « nextValue »)).
// e. IfAbruptCloseIterator(status, iteratorRecord).
TRY(JS::call(vm, adder.as_function(), set, next_value));
(void)TRY(get_iterator_values(vm, iterable, [&](Value next) -> Optional<Completion> {
// a. Let next be ? IteratorStepValue(iteratorRecord).
// b. If next is DONE, return set.
// c. Let status be Completion(Call(adder, set, « nextValue »)).
// d. IfAbruptCloseIterator(status, iteratorRecord).
TRY(JS::call(vm, adder.as_function(), set, next));
return {};
}));