mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
BindingsGenerator: Release value setting members of dictionary
When a constructor has an optional dictionary as argument, and those members are of type new string, make sure that we release_value() setting the dictionary members.
This commit is contained in:
parent
98ef76b144
commit
836cb73d29
Notes:
sideshowbarker
2024-07-17 00:37:23 +09:00
Author: https://github.com/kennethmyhra Commit: https://github.com/SerenityOS/serenity/commit/836cb73d29 Pull-request: https://github.com/SerenityOS/serenity/pull/17577 Reviewed-by: https://github.com/AtkinsSJ
1 changed files with 8 additions and 1 deletions
|
@ -729,9 +729,16 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
|||
}
|
||||
|
||||
generate_to_cpp(dictionary_generator, member, member_property_value_name, "", member_value_name, interface, member.extended_attributes.contains("LegacyNullToEmptyString"), !member.required, member.default_value);
|
||||
dictionary_generator.append(R"~~~(
|
||||
if (optional && interface.extended_attributes.contains("UseNewAKString")) {
|
||||
dictionary_generator.append(R"~~~(
|
||||
if (@member_value_name@.has_value())
|
||||
@cpp_name@.@member_name@ = @member_value_name@.release_value();
|
||||
)~~~");
|
||||
} else {
|
||||
dictionary_generator.append(R"~~~(
|
||||
@cpp_name@.@member_name@ = @member_value_name@;
|
||||
)~~~");
|
||||
}
|
||||
if (!member.required && !member.default_value.has_value()) {
|
||||
dictionary_generator.append(R"~~~(
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue