summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/AST.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-10-02 16:00:15 +0200
committerAndreas Kling <kling@serenityos.org>2020-10-02 18:01:27 +0200
commitfa18baf3e84a8688b4ade4d841c909d5940778db (patch)
tree5d43f3a769e2b059d879b0fea65172678b08e925 /Libraries/LibJS/AST.cpp
parentef1b21004fc04efdd1baf01d375d4bac614abc61 (diff)
downloadserenity-fa18baf3e84a8688b4ade4d841c909d5940778db.zip
LibJS: Add Value::is_nullish()
Diffstat (limited to 'Libraries/LibJS/AST.cpp')
-rw-r--r--Libraries/LibJS/AST.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp
index 00687215eb..a8a1b44cdc 100644
--- a/Libraries/LibJS/AST.cpp
+++ b/Libraries/LibJS/AST.cpp
@@ -126,7 +126,7 @@ CallExpression::ThisAndCallee CallExpression::compute_this_and_callee(Interprete
auto lookup_target = is_super_property_lookup ? interpreter.current_environment()->get_super_base() : member_expression.object().execute(interpreter, global_object);
if (interpreter.exception())
return {};
- if (is_super_property_lookup && (lookup_target.is_null() || lookup_target.is_undefined())) {
+ if (is_super_property_lookup && lookup_target.is_nullish()) {
interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::ObjectPrototypeNullOrUndefinedOnSuperPropertyAccess, lookup_target.to_string_without_side_effects().characters());
return {};
}
@@ -543,7 +543,7 @@ Value LogicalExpression::execute(Interpreter& interpreter, GlobalObject& global_
return rhs_result;
}
case LogicalOp::NullishCoalescing:
- if (lhs_result.is_null() || lhs_result.is_undefined()) {
+ if (lhs_result.is_nullish()) {
auto rhs_result = m_rhs->execute(interpreter, global_object);
if (interpreter.exception())
return {};