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

LibJS+LibWeb: Refactor GetIterator to use GetIteratorFromMethod

This is an editorial change in the ECMA-262 spec. See:
956e5af

This splits the GetIterator AO into two AOs, to remove some recursion
and to (soon) remove optional parameters.
This commit is contained in:
Timothy Flynn 2023-07-18 14:40:02 -04:00 committed by Andreas Kling
parent b918dcd4db
commit 5703833116
5 changed files with 111 additions and 71 deletions

View file

@ -1533,8 +1533,9 @@ void IDL::ParameterizedType::generate_sequence_from_iterable(SourceGenerator& ge
// 4. Initialize Si to the result of converting nextItem to an IDL value of type T.
// 5. Set i to i + 1.
// FIXME: The WebIDL spec is out of date - it should be using GetIteratorFromMethod.
sequence_generator.append(R"~~~(
auto iterator@recursion_depth@ = TRY(JS::get_iterator(vm, @iterable_cpp_name@, JS::IteratorHint::Sync, @iterator_method_cpp_name@));
auto iterator@recursion_depth@ = TRY(JS::get_iterator_from_method(vm, @iterable_cpp_name@, *@iterator_method_cpp_name@));
)~~~");
if (sequence_cpp_type.sequence_storage_type == SequenceStorageType::Vector) {