diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-03-21 19:59:03 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-22 02:08:15 +0100 |
commit | 324f709d29daf05035b545f00b73ddd631899c2c (patch) | |
tree | 720977d5752c34b8f258019402078a5c35f30e26 /Meta | |
parent | dc94879b83f72e670773a8a05b2a547520c002d8 (diff) | |
download | serenity-324f709d29daf05035b545f00b73ddd631899c2c.zip |
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.
Diffstat (limited to 'Meta')
-rw-r--r-- | Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp index f5fc02ecd3..280755f003 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp @@ -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()) |