1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:27:35 +00:00

LibJS: Update NumberPrototype's this_number_value() to take a Value

This is now about as close to the spec as it gets - instead of querying
the |this| value inside of the function, we now pass it in from the
outside.
Also get rid of the oddly specific error messages, they're nice but
pretty inconsistent with most others. Let's prefer consistency and
simplicity for now.

Other than that, no functionality change.
This commit is contained in:
Linus Groh 2021-06-06 16:31:03 +01:00 committed by Andreas Kling
parent 3cfd9f51f7
commit d255e6892b
4 changed files with 11 additions and 13 deletions

View file

@ -77,7 +77,7 @@ test("errors", () => {
[true, [], {}, Symbol("foo"), "bar", 1n].forEach(value => {
expect(() => Number.prototype.toString.call(value)).toThrowWithMessage(
TypeError,
"Number.prototype.toString() called with incompatible this target"
"Not a Number object"
);
});
});

View file

@ -14,7 +14,7 @@ test("errors", () => {
[true, [], {}, Symbol("foo"), "bar", 1n].forEach(value => {
expect(() => Number.prototype.valueOf.call(value)).toThrowWithMessage(
TypeError,
"Number.prototype.valueOf() called with incompatible this target"
"Not a Number object"
);
});
});