forked from LadybirdBrowser/ladybird
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IDLGenerators: Allow methods with multiple
sequence
arguments
Previously, a method with multiple sequence arguments would cause a compile error, as the same variable name was redeclared when iterating the sequence for each argument. This change disambiguates these variable names.
- Loading branch information
1 parent
aa82ff8
commit 10c5b9c
Showing
1 changed file
with
5 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1030,12 +1030,12 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter | |
if (!@js_name@@[email protected]_object()) | ||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObject, @js_name@@[email protected]_string_without_side_effects()); | ||
auto iterator_method@recursion_depth@ = TRY(@js_name@@[email protected]_method(vm, vm.well_known_symbol_iterator())); | ||
if (!iterator_method@recursion_depth@) | ||
auto @js_name@@js_suffix@_iterator_method@recursion_depth@ = TRY(@js_name@@[email protected]_method(vm, vm.well_known_symbol_iterator())); | ||
if (!@js_name@@js_suffix@_iterator_method@recursion_depth@) | ||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotIterable, @js_name@@[email protected]_string_without_side_effects()); | ||
)~~~"); | ||
|
||
parameterized_type.generate_sequence_from_iterable(sequence_generator, ByteString::formatted("{}{}", acceptable_cpp_name, optional ? "_non_optional" : ""), ByteString::formatted("{}{}", js_name, js_suffix), ByteString::formatted("iterator_method{}", recursion_depth), interface, recursion_depth + 1); | ||
parameterized_type.generate_sequence_from_iterable(sequence_generator, ByteString::formatted("{}{}", acceptable_cpp_name, optional ? "_non_optional" : ""), ByteString::formatted("{}{}", js_name, js_suffix), ByteString::formatted("{}{}_iterator_method{}", js_name, js_suffix, recursion_depth), interface, recursion_depth + 1); | ||
|
||
if (optional) { | ||
sequence_generator.append(R"~~~( | ||
|
@@ -1699,7 +1699,7 @@ void IDL::ParameterizedType::generate_sequence_from_iterable(SourceGenerator& ge | |
|
||
// 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_from_method(vm, @iterable_cpp_name@, *@iterator_method_cpp_name@)); | ||
auto @iterable_cpp_name@_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) { | ||
|
@@ -1714,7 +1714,7 @@ void IDL::ParameterizedType::generate_sequence_from_iterable(SourceGenerator& ge | |
|
||
sequence_generator.append(R"~~~( | ||
for (;;) { | ||
auto next@recursion_depth@ = TRY(JS::iterator_step(vm, iterator@recursion_depth@)); | ||
auto next@recursion_depth@ = TRY(JS::iterator_step(vm, @iterable_cpp_name@_iterator@recursion_depth@)); | ||
if (!next@recursion_depth@) | ||
break; | ||
|