LibJS: Bring Reflect.construct() closer to the specification

This includes checking that the target is a constructor, not just a
function, as well as switching the order of the list creation and
argument validation to match the specification, to ensure correct
exception throwing order.
This commit is contained in:
Idan Horowitz 2021-06-28 13:49:35 +03:00 committed by Linus Groh
parent 596324ae9c
commit 8eb48039c9
Notes: sideshowbarker 2024-07-18 11:25:30 +09:00
3 changed files with 21 additions and 24 deletions

View file

@ -9,7 +9,7 @@ describe("errors", () => {
Reflect.construct(value);
}).toThrowWithMessage(
TypeError,
"First argument of Reflect.construct() must be a function"
"First argument of Reflect.construct() must be a constructor"
);
});
});