Skip to content

Commit d2daec4

Browse files
committed
JS: Add tests explaining why the IIFE in f2 didn't work
1 parent 023dcce commit d2daec4

File tree

1 file changed

+39
-0
lines changed
  • javascript/ql/test/library-tests/TripleDot

1 file changed

+39
-0
lines changed

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,42 @@ function f4() {
4141
sink(inner(source("f4.1"))); // $ hasValueFlow=f4.1
4242
sink(inner(source("f4.2"))); // $ hasValueFlow=f4.2
4343
}
44+
45+
function f5() {
46+
function inner(x) {
47+
let y;
48+
function nested(p) {
49+
y = p;
50+
}
51+
nested(x);
52+
return y;
53+
}
54+
sink(inner(source("f5.1"))); // $ hasValueFlow=f5.1
55+
sink(inner(source("f5.2"))); // $ hasValueFlow=f5.2
56+
}
57+
58+
function f6() {
59+
function inner(x) {
60+
let y;
61+
function nested(p) {
62+
y = p;
63+
}
64+
(nested)(x); // same as f5, except the callee is parenthesised here
65+
return y;
66+
}
67+
sink(inner(source("f6.1"))); // $ MISSING: hasValueFlow=f6.1
68+
sink(inner(source("f6.2"))); // $ MISSING: hasValueFlow=f6.2
69+
}
70+
71+
function f7() {
72+
function inner(x) {
73+
let y;
74+
let nested = (function (p) {
75+
y = p;
76+
});
77+
nested(x); // same as f5, except the function definition is parenthesised
78+
return y;
79+
}
80+
sink(inner(source("f7.1"))); // $ MISSING: hasValueFlow=f7.1
81+
sink(inner(source("f7.2"))); // $ MISSING: hasValueFlow=f7.2
82+
}

0 commit comments

Comments
 (0)