mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:18:12 +00:00
LibJS: Assign getter/setter function names as early as possible
In case of {get func() {}, set func() {}} we were wrongly setting the function name to 'func' and then later trying to replace an empty name with 'get func'/'set func' which failed. Instead, set the name to 'get func'/'set func' right away. The code in put_by_property_key is kept, for when that is called by put_by_value.
This commit is contained in:
parent
a3f34263fd
commit
b9c9315bcb
2 changed files with 8 additions and 3 deletions
|
@ -221,13 +221,13 @@ describe("naming of anon functions", () => {
|
|||
expect({ func() {} }.func.name).toBe("func");
|
||||
});
|
||||
|
||||
test.xfail("getter has name", () => {
|
||||
test("getter has name", () => {
|
||||
expect(Object.getOwnPropertyDescriptor({ get func() {} }, "func").get.name).toBe(
|
||||
"get func"
|
||||
);
|
||||
});
|
||||
|
||||
test.xfail("setter has name", () => {
|
||||
test("setter has name", () => {
|
||||
expect(Object.getOwnPropertyDescriptor({ set func(v) {} }, "func").set.name).toBe(
|
||||
"set func"
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue