1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:47:45 +00:00

LibWeb: Emit optional boolean variable definition in WrapperGenerator

The removed if in this commit was inside the else branch of an if with
the same condition, making it a no-op, as well as breaking optional
booleans.
This commit is contained in:
Idan Horowitz 2021-04-15 20:32:15 +03:00 committed by Andreas Kling
parent dbc5b05b7a
commit 0072581693

View file

@ -615,12 +615,10 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
bool @cpp_name@; bool @cpp_name@;
)~~~"); )~~~");
} else { } else {
if (!optional_default_value.is_null()) {
scoped_generator.append(R"~~~( scoped_generator.append(R"~~~(
Optional<bool> @cpp_name@; Optional<bool> @cpp_name@;
)~~~"); )~~~");
} }
}
scoped_generator.append(R"~~~( scoped_generator.append(R"~~~(
if (!@js_name@@js_suffix@.is_undefined()) if (!@js_name@@js_suffix@.is_undefined())
@cpp_name@ = @js_name@@js_suffix@.to_boolean();)~~~"); @cpp_name@ = @js_name@@js_suffix@.to_boolean();)~~~");