mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
IDLGenerators: Support nullable double values
This commit is contained in:
parent
222e3c32cd
commit
f99d6e177f
Notes:
sideshowbarker
2024-07-17 07:11:12 +09:00
Author: https://github.com/mattco98 Commit: https://github.com/SerenityOS/serenity/commit/f99d6e177f Pull-request: https://github.com/SerenityOS/serenity/pull/18109 Reviewed-by: https://github.com/linusg ✅
1 changed files with 13 additions and 1 deletions
|
@ -1583,6 +1583,12 @@ static void generate_wrap_statement(SourceGenerator& generator, DeprecatedString
|
|||
if (!@value@.has_value()) {
|
||||
@result_expression@ JS::js_null();
|
||||
} else {
|
||||
)~~~");
|
||||
} else if (type.is_primitive()) {
|
||||
scoped_generator.append(R"~~~(
|
||||
if (!@value@.has_value()) {
|
||||
@result_expression@ JS::js_null();
|
||||
} else {
|
||||
)~~~");
|
||||
} else {
|
||||
scoped_generator.append(R"~~~(
|
||||
|
@ -1643,9 +1649,15 @@ static void generate_wrap_statement(SourceGenerator& generator, DeprecatedString
|
|||
@result_expression@ new_array@recursion_depth@;
|
||||
)~~~");
|
||||
} else if (type.name() == "boolean" || type.name() == "double" || type.name() == "float") {
|
||||
scoped_generator.append(R"~~~(
|
||||
if (type.is_nullable()) {
|
||||
scoped_generator.append(R"~~~(
|
||||
@result_expression@ JS::Value(@value@.release_value());
|
||||
)~~~");
|
||||
} else {
|
||||
scoped_generator.append(R"~~~(
|
||||
@result_expression@ JS::Value(@value@);
|
||||
)~~~");
|
||||
}
|
||||
} else if (type.name() == "short" || type.name() == "long" || type.name() == "unsigned short") {
|
||||
scoped_generator.append(R"~~~(
|
||||
@result_expression@ JS::Value((i32)@value@);
|
||||
|
|
Loading…
Add table
Reference in a new issue