mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
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.
This commit is contained in:
Notes:
github-actions[bot]
2025-02-18 17:19:50 +00:00
Author: https://github.com/Psychpsyo Commit: https://github.com/LadybirdBrowser/ladybird/commit/3b577e6135d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3548 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/Lubrsi Reviewed-by: https://github.com/shannonbooth
@@ -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"~~~(
|
||||
|
||||
Reference in New Issue
Block a user