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:
parent
b7404015aa
commit
ff66218631
Notes:
sideshowbarker
2024-07-18 02:45:02 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/ff66218631f Pull-request: https://github.com/SerenityOS/serenity/pull/10462
1 changed files with 5 additions and 0 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue