JS: add test with self=this variable

This commit is contained in:
Asger F
2019-01-10 13:24:55 +00:00
parent 78bd76048a
commit 107ec3b687

View File

@@ -25,5 +25,16 @@ class C {
addEventListener('hey', () => {
sink(this.x); // NOT OK
});
let self = this;
if (isSafe(self.x)) {
sink(self.x); // OK
}
addEventListener('hey', function() {
if (isSafe(self.x)) {
sink(self.x); // OK
}
});
}
}