Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 81e74d8

Browse files
committed
JS: Add test case for spurious flow from lack of use-use
1 parent 7363b57 commit 81e74d8

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

  • javascript/ql/test/library-tests/TripleDot
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import 'dummy';
2+
3+
function t1() {
4+
const obj = {};
5+
6+
sink(obj.field); // $ SPURIOUS: hasValueFlow=t1.1 hasValueFlow=t1.2
7+
8+
obj.field = source('t1.1');
9+
sink(obj.field); // $ hasValueFlow=t1.1 SPURIOUS: hasValueFlow=t1.2
10+
11+
obj.field = "safe";
12+
sink(obj.field); // $ SPURIOUS: hasValueFlow=t1.1 hasValueFlow=t1.2
13+
14+
obj.field = source('t1.2');
15+
sink(obj.field); // $ hasValueFlow=t1.2 SPURIOUS: hasValueFlow=t1.1
16+
}
17+
18+
function t2() {
19+
let obj;
20+
21+
if (Math.random()) {
22+
obj = {};
23+
sink(obj.field);
24+
} else {
25+
obj = {};
26+
obj.field = source('t2.1');
27+
sink(obj.field); // $ hasValueFlow=t2.1
28+
}
29+
sink(obj.field); // $ hasValueFlow=t2.1
30+
}

0 commit comments

Comments
 (0)