Skip to content

Commit 0ebe8bd

Browse files
committed
JS: Add test for missing capture flow for 'this'
1 parent d31499d commit 0ebe8bd

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

  • javascript/ql/test/library-tests/TripleDot

javascript/ql/test/library-tests/TripleDot/useuse.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,34 @@ function t5() {
6262
const c = new C();
6363
sink(c.field); // $ hasValueFlow=t5.1
6464
}
65+
66+
67+
function t6() {
68+
function invoke(fn) {
69+
fn();
70+
}
71+
class C {
72+
constructor(x, y) {
73+
this.x = x;
74+
invoke(() => {
75+
this.y = y;
76+
});
77+
78+
sink(this.x); // $ MISSING: hasValueFlow=t6.1
79+
sink(this.y); // $ MISSING: hasValueFlow=t6.1
80+
81+
invoke(() => {
82+
sink(this.x); // $ MISSING: hasValueFlow=t6.1
83+
sink(this.y); // $ MISSING: hasValueFlow=t6.2
84+
});
85+
86+
this.methodLike = function() {
87+
sink(this.x); // $ MISSING: hasValueFlow=t6.1
88+
sink(this.y); // $ MISSING: hasValueFlow=t6.2
89+
}
90+
}
91+
}
92+
const c = new C(source('t6.1'), source('t6.2'));
93+
sink(c.x); // $ hasValueFlow=t6.1
94+
sink(c.y); // $ MISSING: hasValueFlow=t6.2
95+
}

0 commit comments

Comments
 (0)