mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
IDLGenerators: Do not generate required dictionary members as Optional
This commit is contained in:
@@ -945,6 +945,9 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
|||||||
|
|
||||||
bool may_be_null = !optional_default_value.has_value() || parameter.type->is_nullable() || optional_default_value.value() == "null";
|
bool may_be_null = !optional_default_value.has_value() || parameter.type->is_nullable() || optional_default_value.value() == "null";
|
||||||
|
|
||||||
|
// Required dictionary members cannot be null.
|
||||||
|
may_be_null &= !member.required;
|
||||||
|
|
||||||
if (member.type->is_string() && optional && may_be_null) {
|
if (member.type->is_string() && optional && may_be_null) {
|
||||||
dictionary_generator.append(R"~~~(
|
dictionary_generator.append(R"~~~(
|
||||||
if (@member_value_name@.has_value())
|
if (@member_value_name@.has_value())
|
||||||
|
|||||||
Reference in New Issue
Block a user