mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
IDLGenerators: Do not generate required dictionary members as Optional
This commit is contained in:
parent
348db1c445
commit
e14511468f
Notes:
github-actions[bot]
2025-02-05 20:19:57 +00:00
Author: https://github.com/devgianlu Commit: https://github.com/LadybirdBrowser/ladybird/commit/e14511468fc Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3117 Reviewed-by: https://github.com/ADKaster ✅
1 changed files with 3 additions and 0 deletions
|
@ -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";
|
||||
|
||||
// Required dictionary members cannot be null.
|
||||
may_be_null &= !member.required;
|
||||
|
||||
if (member.type->is_string() && optional && may_be_null) {
|
||||
dictionary_generator.append(R"~~~(
|
||||
if (@member_value_name@.has_value())
|
||||
|
|
Loading…
Add table
Reference in a new issue