From b251091a6a306fb25edd59cd97e56d4da7a6200c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 19 Apr 2020 14:50:27 +0200 Subject: [PATCH] LibJS: CallExpression shouldn't throw TypeError or non-constructor call This unbreaks the entire test suite. :^) --- Libraries/LibJS/AST.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp index f384defa26..6a254a78df 100644 --- a/Libraries/LibJS/AST.cpp +++ b/Libraries/LibJS/AST.cpp @@ -94,7 +94,7 @@ Value CallExpression::execute(Interpreter& interpreter) const if (!callee.is_object() || !callee.as_object().is_function() - || (callee.as_object().is_native_function() && !static_cast(callee.as_object()).has_constructor())) { + || (is_new_expression() && (callee.as_object().is_native_function() && !static_cast(callee.as_object()).has_constructor()))) { String error_message; auto call_type = is_new_expression() ? "constructor" : "function"; if (m_callee->is_identifier() || m_callee->is_member_expression()) {