BindingsGenerator: Conditionally check dictionary member is string

This adds the condition member.type->is_string() to the if statement, so
that we now conditionally check the dictionary member is a new string
and associated with an optional constructor parameter.
This commit is contained in:
Kenneth Myhra 2023-02-25 10:16:35 +01:00 committed by Linus Groh
parent 72a48ee1ee
commit 99f094905e
Notes: sideshowbarker 2024-07-17 08:25:15 +09:00

View file

@ -729,7 +729,7 @@ 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);
if (optional && interface.extended_attributes.contains("UseNewAKString")) {
if (member.type->is_string() && 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();