mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
LibWeb: Fix LegacyNullToEmptyString flag handler in IDL
This commit is contained in:
parent
ec425702a4
commit
d223cf25af
Notes:
github-actions[bot]
2024-11-29 20:24:09 +00:00
Author: https://github.com/shlyakpavel Commit: https://github.com/LadybirdBrowser/ladybird/commit/d223cf25afb Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2630 Reviewed-by: https://github.com/tcl3 ✅
1 changed files with 9 additions and 1 deletions
|
@ -395,11 +395,19 @@ static void generate_to_string(SourceGenerator& scoped_generator, ParameterType
|
|||
)~~~");
|
||||
}
|
||||
|
||||
scoped_generator.append(R"~~~(
|
||||
if (parameter.type->is_nullable()) {
|
||||
scoped_generator.append(R"~~~(
|
||||
if (!@js_name@@js_suffix@.is_undefined()) {
|
||||
if (!@js_name@@js_suffix@.is_null())
|
||||
@cpp_name@ = TRY(WebIDL::@to_string@(vm, @js_name@@js_suffix@));
|
||||
})~~~");
|
||||
} else {
|
||||
scoped_generator.append(R"~~~(
|
||||
if (!@js_name@@js_suffix@.is_undefined()) {
|
||||
if (!@legacy_null_to_empty_string@ || !@js_name@@js_suffix@.is_null())
|
||||
@cpp_name@ = TRY(WebIDL::@to_string@(vm, @js_name@@js_suffix@));
|
||||
})~~~");
|
||||
}
|
||||
if (!may_be_null) {
|
||||
scoped_generator.append(R"~~~( else {
|
||||
@cpp_name@ = MUST(@string_type@::from_utf8(@parameter.optional_default_value@sv));
|
||||
|
|
Loading…
Add table
Reference in a new issue