mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
LibWeb: Support IDL default values of "null" for optional arguments
This is a bit strange in the IDL syntax, but e.g., in HTMLSelectElement, we have (simplified): undefined add(optional (HTMLElement or long)? before = null) This could instead become: undefined add(optional (HTMLElement or long) before) This change generates code for the former as if it were the latter.
This commit is contained in:
parent
dc94879b83
commit
324f709d29
Notes:
sideshowbarker
2024-07-17 16:58:06 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/324f709d29 Pull-request: https://github.com/SerenityOS/serenity/pull/13182
1 changed files with 1 additions and 1 deletions
|
@ -1050,7 +1050,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
|||
@union_type@ @cpp_name@ = TRY(@js_name@@js_suffix@_to_variant(@js_name@@js_suffix@));
|
||||
)~~~");
|
||||
} else {
|
||||
if (!optional_default_value.has_value()) {
|
||||
if (!optional_default_value.has_value() || optional_default_value == "null"sv) {
|
||||
union_generator.append(R"~~~(
|
||||
Optional<@union_type@> @cpp_name@;
|
||||
if (!@js_name@@js_suffix@.is_undefined())
|
||||
|
|
Loading…
Add table
Reference in a new issue