From 12e66de410b8835f487ecf19580eeb76495b2587 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Tue, 29 Jun 2021 15:10:02 +0300 Subject: [PATCH] LibJS: Check the target function of a bound function in is_constructor This is not exactly compliant with the specification, but our current bound function implementation isn't either, so its not currently possible to implement it the way the specification requires. --- Userland/Libraries/LibJS/Runtime/Value.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index a31d56e412..99e99b1bda 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -242,7 +242,9 @@ bool Value::is_constructor() const return false; if (is(as_object())) return static_cast(as_object()).has_constructor(); - // OrdinaryFunctionObject or BoundFunction + if (is(as_object())) + return Value(&static_cast(as_object()).target_function()).is_constructor(); + // OrdinaryFunctionObject return true; }