forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtst.js
More file actions
46 lines (41 loc) · 673 Bytes
/
tst.js
File metadata and controls
46 lines (41 loc) · 673 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function f(x) {
var y, z;
if (x)
y = x;
z = y;
while (x)
z++;
}
function g(x) {
function h() { // no SSA definition, since `h` is dead
return x;
}
x = 42;
}
function k() {
var x = 0;
function* iter() {
console.log(x);
yield;
console.log(x);
}
var gen = iter();
gen.next();
++x;
gen.next();
}
function l() {
function inner() {
// capture both `x` and `y`
x += y;
}
var x = 0, y = 1;
inner(); // induces capture of `x`, but not of `y`
return x + y;
}
function *m() {
var x = 0, y = 1;
var inc = () => /* capture x */ ++x;
yield inc; // induces capture of `x`, but not of `y`
return x + y;
}