From 3b577e6135dc30e44d38f3e5fdf66b019ddf7f6e Mon Sep 17 00:00:00 2001 From: Psychpsyo Date: Wed, 12 Feb 2025 17:26:11 +0100 Subject: [PATCH] Meta: Improve IDL generator for dictionary members This makes it so that the IDL generator no longer assumed that dictionary members with a default value are optional, since they will always, at least, have the default value. --- .../CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index f18c5a7e249..c130a342855 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -950,7 +950,7 @@ 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"; // Required dictionary members cannot be null. - may_be_null &= !member.required; + may_be_null &= !member.required && !member.default_value.has_value(); if (member.type->is_string() && optional && may_be_null) { dictionary_generator.append(R"~~~(