enhance dead_code (#3907)

This commit is contained in:
Alex Lam S.L
2020-05-18 20:53:08 +01:00
committed by GitHub
parent f9b3198714
commit 87046410ef
2 changed files with 30 additions and 0 deletions

View File

@@ -1168,3 +1168,28 @@ redundant_assignments: {
}
expect_stdout: "PASS PASS"
}
self_assignments: {
options = {
dead_code: true,
}
input: {
var a = "PASS", b = 0, l = [ "FAIL", "PASS" ], o = { p: "PASS" };
a = a;
l[0] = l[0];
l[b] = l[b];
l[b++] = l[b++];
o.p = o.p;
console.log(a, b, l[0], o.p);
}
expect: {
var a = "PASS", b = 0, l = [ "FAIL", "PASS" ], o = { p: "PASS" };
a;
l[0];
l[b];
l[b++] = l[b++];
o.p;
console.log(a, b, l[0], o.p);
}
expect_stdout: "PASS 2 PASS PASS"
}