mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibIDL+LibWeb: Begin support for async iterator in IDL
This adds support for async iterators of the form:
async iterable<value_type>;
async iterable<value_type>(/* arguments... */);
It does not yet support the value pairs of the form:
async iterable<key_type, value_type>;
async iterable<key_type, value_type>(/* arguments... */);
Async iterators have an optional `return` data property. There's not a
particularly good way to know what interfaces implement this property.
So this adds a new extended attribute, DefinesAsyncIteratorReturn, which
interfaces can use to declare their support.
This commit is contained in:
parent
398f1ce2a0
commit
c0ead1b01a
Notes:
github-actions[bot]
2025-04-14 21:44:24 +00:00
Author: https://github.com/trflynn89
Commit: c0ead1b01a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4338
Reviewed-by: https://github.com/kennethmyhra ✅
10 changed files with 593 additions and 7 deletions
|
|
@ -139,6 +139,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
String prototype_implementation;
|
||||
String iterator_prototype_header;
|
||||
String iterator_prototype_implementation;
|
||||
String async_iterator_prototype_header;
|
||||
String async_iterator_prototype_implementation;
|
||||
String global_mixin_header;
|
||||
String global_mixin_implementation;
|
||||
|
||||
|
|
@ -170,6 +172,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(write_if_changed(&IDL::generate_iterator_prototype_implementation, iterator_prototype_implementation));
|
||||
}
|
||||
|
||||
if (interface.async_value_iterator_type.has_value()) {
|
||||
async_iterator_prototype_header = TRY(String::formatted("{}AsyncIteratorPrototype.h", path_prefix));
|
||||
async_iterator_prototype_implementation = TRY(String::formatted("{}AsyncIteratorPrototype.cpp", path_prefix));
|
||||
|
||||
TRY(write_if_changed(&IDL::generate_async_iterator_prototype_header, async_iterator_prototype_header));
|
||||
TRY(write_if_changed(&IDL::generate_async_iterator_prototype_implementation, async_iterator_prototype_implementation));
|
||||
}
|
||||
|
||||
if (interface.extended_attributes.contains("Global")) {
|
||||
global_mixin_header = TRY(String::formatted("{}GlobalMixin.h", path_prefix));
|
||||
global_mixin_implementation = TRY(String::formatted("{}GlobalMixin.cpp", path_prefix));
|
||||
|
|
@ -182,7 +192,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto depfile = TRY(Core::File::open_file_or_standard_stream(depfile_path, Core::File::OpenMode::Write));
|
||||
|
||||
StringBuilder depfile_builder;
|
||||
for (StringView s : { constructor_header, constructor_implementation, prototype_header, prototype_implementation, namespace_header, namespace_implementation, iterator_prototype_header, iterator_prototype_implementation, global_mixin_header, global_mixin_implementation }) {
|
||||
for (StringView s : { constructor_header, constructor_implementation, prototype_header, prototype_implementation, namespace_header, namespace_implementation, iterator_prototype_header, iterator_prototype_implementation, async_iterator_prototype_header, async_iterator_prototype_implementation, global_mixin_header, global_mixin_implementation }) {
|
||||
if (s.is_empty())
|
||||
continue;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue