mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-31 06:38:22 +00:00
Meta: Reuse built-in JS types list for IDL to C++ generation
This opens up the code path for the `ArrayBuffer` type, which can now be used as a method argument.
This commit is contained in:
parent
7a92b47a35
commit
0b9d55b676
Notes:
github-actions[bot]
2024-10-15 08:03:48 +00:00
Author: https://github.com/gmta
Commit: 0b9d55b676
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1802
Reviewed-by: https://github.com/awesomekling ✅
Reviewed-by: https://github.com/shannonbooth
1 changed files with 3 additions and 2 deletions
|
@ -120,7 +120,8 @@ static bool is_javascript_builtin(Type const& type)
|
|||
"ArrayBuffer"sv,
|
||||
"Float32Array"sv,
|
||||
"Float64Array"sv,
|
||||
"Uint8Array"sv
|
||||
"Uint8Array"sv,
|
||||
"Uint8ClampedArray"sv,
|
||||
};
|
||||
|
||||
return types.span().contains_slow(type.name());
|
||||
|
@ -692,7 +693,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
|||
auto @cpp_name@ = JS::make_handle(TRY(@js_name@@js_suffix@.to_object(vm)));
|
||||
)~~~");
|
||||
}
|
||||
} else if (parameter.type->name().is_one_of("BufferSource", "Float32Array", "Float64Array", "Uint8Array", "Uint8ClampedArray")) {
|
||||
} else if (is_javascript_builtin(parameter.type) || parameter.type->name() == "BufferSource"sv) {
|
||||
if (optional) {
|
||||
scoped_generator.append(R"~~~(
|
||||
Optional<JS::Handle<WebIDL::BufferSource>> @cpp_name@;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue