diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-06-29 15:10:02 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-06-29 16:03:21 +0100 |
commit | 12e66de410b8835f487ecf19580eeb76495b2587 (patch) | |
tree | 8b1f8babc3cdeb78c43418d84ca896d50b320acb /Userland/Libraries/LibJS/Runtime | |
parent | 1d94d7a36760753d950d0fa88f9cbfe1a402d88f (diff) | |
download | serenity-12e66de410b8835f487ecf19580eeb76495b2587.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Value.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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<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; } |