mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +00:00
LibWeb: Use is_nullish instead of is_null for nullable types
As according to: https://heycam.github.io/webidl/#es-nullable-type Both null and undefined are treated as IDL null, but we were only treating null as IDL null.
This commit is contained in:
parent
339ccba354
commit
85bd454b48
1 changed files with 2 additions and 2 deletions
|
@ -555,7 +555,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
||||||
if (parameter.type.nullable) {
|
if (parameter.type.nullable) {
|
||||||
scoped_generator.append(R"~~~(
|
scoped_generator.append(R"~~~(
|
||||||
RefPtr<EventListener> @cpp_name@;
|
RefPtr<EventListener> @cpp_name@;
|
||||||
if (!@js_name@@js_suffix@.is_null()) {
|
if (!@js_name@@js_suffix@.is_nullish()) {
|
||||||
if (!@js_name@@js_suffix@.is_function()) {
|
if (!@js_name@@js_suffix@.is_function()) {
|
||||||
vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "Function");
|
vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "Function");
|
||||||
@return_statement@
|
@return_statement@
|
||||||
|
@ -589,7 +589,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
||||||
} else {
|
} else {
|
||||||
scoped_generator.append(R"~~~(
|
scoped_generator.append(R"~~~(
|
||||||
@parameter.type.name@* @cpp_name@ = nullptr;
|
@parameter.type.name@* @cpp_name@ = nullptr;
|
||||||
if (!@js_name@@js_suffix@.is_null()) {
|
if (!@js_name@@js_suffix@.is_nullish()) {
|
||||||
auto @cpp_name@_object = @js_name@@js_suffix@.to_object(global_object);
|
auto @cpp_name@_object = @js_name@@js_suffix@.to_object(global_object);
|
||||||
if (vm.exception())
|
if (vm.exception())
|
||||||
@return_statement@
|
@return_statement@
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue