mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:07:45 +00:00
LibWeb: Add support for the any type in returning and parameters
Required for CustomEvent.
This commit is contained in:
parent
d30ec4d790
commit
067d839615
1 changed files with 20 additions and 2 deletions
|
@ -897,9 +897,27 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
||||||
}
|
}
|
||||||
)~~~");
|
)~~~");
|
||||||
} else if (parameter.type.name == "any") {
|
} else if (parameter.type.name == "any") {
|
||||||
scoped_generator.append(R"~~~(
|
if (!optional) {
|
||||||
|
scoped_generator.append(R"~~~(
|
||||||
auto @cpp_name@ = @js_name@@js_suffix@;
|
auto @cpp_name@ = @js_name@@js_suffix@;
|
||||||
)~~~");
|
)~~~");
|
||||||
|
} else {
|
||||||
|
scoped_generator.append(R"~~~(
|
||||||
|
JS::Value @cpp_name@;
|
||||||
|
if (!@js_name@@js_suffix@.is_undefined())
|
||||||
|
@cpp_name@ = @js_name@@js_suffix@;
|
||||||
|
)~~~");
|
||||||
|
if (optional_default_value.has_value()) {
|
||||||
|
if (optional_default_value == "null") {
|
||||||
|
scoped_generator.append(R"~~~(
|
||||||
|
else
|
||||||
|
@cpp_name@ = JS::js_null();
|
||||||
|
)~~~");
|
||||||
|
} else {
|
||||||
|
TODO();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dbgln("Unimplemented JS-to-C++ conversion: {}", parameter.type.name);
|
dbgln("Unimplemented JS-to-C++ conversion: {}", parameter.type.name);
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
|
@ -1000,7 +1018,7 @@ static void generate_return_statement(SourceGenerator& generator, IDL::Type cons
|
||||||
scoped_generator.append(R"~~~(
|
scoped_generator.append(R"~~~(
|
||||||
return JS::Value((i32)retval);
|
return JS::Value((i32)retval);
|
||||||
)~~~");
|
)~~~");
|
||||||
} else if (return_type.name == "Uint8ClampedArray") {
|
} else if (return_type.name == "Uint8ClampedArray" || return_type.name == "any") {
|
||||||
scoped_generator.append(R"~~~(
|
scoped_generator.append(R"~~~(
|
||||||
return retval;
|
return retval;
|
||||||
)~~~");
|
)~~~");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue