1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibWeb: Allow creating "any" types in IDL with integral default values

This enables defining "any" types in IDL files such as:

    any threshold = 0;

This isn't able to parse decimal values yet.
This commit is contained in:
Timothy Flynn 2021-10-13 13:58:28 -04:00 committed by Andreas Kling
parent b7404015aa
commit ff66218631

View file

@ -1124,6 +1124,11 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
scoped_generator.append(R"~~~(
else
@cpp_name@ = JS::js_null();
)~~~");
} else if (optional_default_value->to_int().has_value() || optional_default_value->to_uint().has_value()) {
scoped_generator.append(R"~~~(
else
@cpp_name@ = JS::Value(@parameter.optional_default_value@);
)~~~");
} else {
TODO();