summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/arrow-functions/this-6.js
blob: c5ee4d95a35a9a5d1a2446ce7c73c1e047b1d74a (plain)
1
2
3
4
5
6
7
8
9
10
11
// Eval expressions in arrow functions use the correct |this| value.

function Dog(name) {
    this.name = name;
    this.getName = () => eval("this.name");
    this.getNameHard = () => eval("(() => this.name)()");
}

var d = new Dog("Max");
assertEq(d.getName(), d.name);
assertEq(d.getNameHard(), d.name);