summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke <luke.wilde@live.co.uk>2021-07-05 19:36:45 +0100
committerAndreas Kling <kling@serenityos.org>2021-07-05 21:36:45 +0200
commit85bd454b4811a2601d357b5a67ec23b258382baf (patch)
treea6a550033faa7c5bad6186db492bb3b9bf65c670
parent339ccba3545c40dfa99f5594806563ca4026c200 (diff)
downloadserenity-85bd454b4811a2601d357b5a67ec23b258382baf.zip
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.
-rw-r--r--Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp
index 8de7548a58..de238ece47 100644
--- a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp
+++ b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp
@@ -555,7 +555,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
if (parameter.type.nullable) {
scoped_generator.append(R"~~~(
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()) {
vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotA, "Function");
@return_statement@
@@ -589,7 +589,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
} else {
scoped_generator.append(R"~~~(
@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);
if (vm.exception())
@return_statement@