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.
This commit is contained in:
Idan Horowitz 2021-06-29 15:10:02 +03:00 committed by Linus Groh
parent 1d94d7a367
commit 12e66de410
Notes: sideshowbarker 2024-07-18 11:20:58 +09:00

View file

@ -242,7 +242,9 @@ bool Value::is_constructor() const
return false;
if (is<NativeFunction>(as_object()))
return static_cast<const NativeFunction&>(as_object()).has_constructor();
// OrdinaryFunctionObject or BoundFunction
if (is<BoundFunction>(as_object()))
return Value(&static_cast<const BoundFunction&>(as_object()).target_function()).is_constructor();
// OrdinaryFunctionObject
return true;
}