blob: 69cb8cd8eeb8bcf984427908269891cddf626c8e [file] [log] [blame]
var testCase = function (actual, expected, message) {
if (actual !== expected) {
throw message + ". Expected '" + expected + "', but was '" + actual + "'";
}
};
function Dog(name) {
this.name = name;
this.getName = () => eval("this.name");
this.getNameHard = () => eval("(() => this.name)()");
this.getNameReallyHard = () => eval("eval('(() => this.name)()')");
}
noInline(Dog)
for (var i=0;i<10000; i++) {
var d = new Dog("Max");
testCase(d.getName(), d.name, "Error: this is not lexically binded inside of the arrow function #1");
testCase(d.getNameHard(), d.name, "Error: this is not lexically binded inside of the arrow function #2");
testCase(d.getNameReallyHard(), d.name, "Error: this is not lexically binded inside of the arrow function #3");
}