1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:55:08 +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

@ -681,16 +681,11 @@ inline ThrowCompletionOr<NonnullGCPtr<Array>> iterator_to_array(VM& vm, Value it
size_t index = 0;
while (true) {
auto iterator_result = TRY(iterator_next(vm, iterator_record));
auto complete = TRY(iterator_complete(vm, iterator_result));
if (complete)
auto value = TRY(iterator_step_value(vm, iterator_record));
if (!value.has_value())
return array;
auto value = TRY(iterator_value(vm, iterator_result));
MUST(array->create_data_property_or_throw(index, value));
MUST(array->create_data_property_or_throw(index, value.release_value()));
index++;
}
}