diff options
author | Kenneth Myhra <kennethmyhra@gmail.com> | 2023-02-28 21:29:52 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-03-01 22:44:20 +0000 |
commit | 98705ecf71e22413b21ea4099399cf7d30ce6791 (patch) | |
tree | ff3466d2897efec0682926dc0bd55e359c708611 /Meta/Lagom | |
parent | 7f717b841475449b244529eb9e7c21eef801e940 (diff) | |
download | serenity-98705ecf71e22413b21ea4099399cf7d30ce6791.zip |
LibWeb: Add new String support for parameters with empty string defaults
This adds new string support for parameters with an optional default
value of empty string ("").
Diffstat (limited to 'Meta/Lagom')
-rw-r--r-- | Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index e08646b48e..f10710578d 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -1314,9 +1314,15 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter )~~~"); } else { if (optional_default_value == "\"\"") { - union_generator.append(R"~~~( + if (!interface.extended_attributes.contains("UseNewAKString")) { + union_generator.append(R"~~~( @union_type@ @cpp_name@ = @js_name@@js_suffix@.is_undefined() ? DeprecatedString::empty() : TRY(@js_name@@js_suffix@_to_variant(@js_name@@js_suffix@)); )~~~"); + } else { + union_generator.append(R"~~~( + @union_type@ @cpp_name@ = @js_name@@js_suffix@.is_undefined() ? String {} : TRY(@js_name@@js_suffix@_to_variant(@js_name@@js_suffix@)); +)~~~"); + } } else if (optional_default_value == "{}") { VERIFY(dictionary_type); union_generator.append(R"~~~( |