summaryrefslogtreecommitdiff
path: root/Meta
diff options
context:
space:
mode:
authorKenneth Myhra <kennethmyhra@gmail.com>2023-02-23 12:22:33 +0100
committerSam Atkins <atkinssj@gmail.com>2023-02-23 15:48:38 +0000
commit836cb73d29dda1d1a90193fa07b1a36b37bf8ec4 (patch)
tree8ef9671adc0841b5c6a61920a08de1b79b1ec3da /Meta
parent98ef76b1448e451e1e3c5ecbadae78e37ac0c8c5 (diff)
downloadserenity-836cb73d29dda1d1a90193fa07b1a36b37bf8ec4.zip
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.
Diffstat (limited to 'Meta')
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp
index a2c60ffe00..ca044870fc 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp
+++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp
@@ -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"~~~(
}