mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 20:42:21 +00:00
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 ("").
This commit is contained in:
parent
7f717b8414
commit
98705ecf71
Notes:
sideshowbarker
2024-07-17 16:23:06 +09:00
Author: https://github.com/kennethmyhra
Commit: 98705ecf71
Pull-request: https://github.com/SerenityOS/serenity/pull/17686
Reviewed-by: https://github.com/linusg
1 changed files with 7 additions and 1 deletions
|
@ -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"~~~(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue