1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:08:13 +00:00

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
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"
);
});
});