mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibWeb: Support integral default values for IDL unions
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 08:59:31 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/a7f2d46b49 Pull-request: https://github.com/SerenityOS/serenity/pull/13424 Reviewed-by: https://github.com/alimpfard ✅
@@ -1145,6 +1145,10 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
||||
VERIFY(dictionary_type);
|
||||
union_generator.append(R"~~~(
|
||||
@union_type@ @cpp_name@ = @js_name@@js_suffix@.is_undefined() ? TRY(@js_name@@js_suffix@_to_dictionary(@js_name@@js_suffix@)) : TRY(@js_name@@js_suffix@_to_variant(@js_name@@js_suffix@));
|
||||
)~~~");
|
||||
} else if (optional_default_value->to_int().has_value() || optional_default_value->to_uint().has_value()) {
|
||||
union_generator.append(R"~~~(
|
||||
@union_type@ @cpp_name@ = @js_name@@js_suffix@.is_undefined() ? @parameter.optional_default_value@ : TRY(@js_name@@js_suffix@_to_variant(@js_name@@js_suffix@));
|
||||
)~~~");
|
||||
} else {
|
||||
TODO();
|
||||
|
||||
Reference in New Issue
Block a user