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:
parent
b3edd94869
commit
385c2f2eb8
2 changed files with 36 additions and 4 deletions
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue