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

LibJS: Use correct this value for tagged template calls

This has to get quite messy because we currently do evaluation to value
and reference separately meaning we have to deal with a lot of edge
cases here.
This commit is contained in:
davidot 2022-11-15 01:18:08 +01:00 committed by Linus Groh
parent b3edd94869
commit 385c2f2eb8
2 changed files with 36 additions and 4 deletions

View file

@ -163,4 +163,17 @@ describe("tagged template literal functionality", () => {
let secondResult = call(value => value, 2);
expect(firstResult).toBe(secondResult);
});
test("this value of call comes from reference", () => {
let thisValue = null;
const obj = {
func() {
thisValue = this;
},
};
obj.func``;
expect(thisValue).toBe(obj);
});
});