enhance unused (#4098)

This commit is contained in:
Alex Lam S.L
2020-09-12 18:05:43 +01:00
committed by GitHub
parent d7456a2dc2
commit d33a3a3253
2 changed files with 22 additions and 1 deletions

View File

@@ -4400,6 +4400,7 @@ merge(Compressor.prototype, {
}
return scan_ref_scoped(node, descend, true);
});
tw.directives = Object.create(compressor.directives);
self.walk(tw);
// pass 2: for every used symbol we need to walk its
// initialization code to figure out if it uses other

View File

@@ -1997,7 +1997,7 @@ issue_3146_4: {
expect_stdout: "PASS"
}
issue_3192: {
issue_3192_1: {
options = {
unused: true,
}
@@ -2025,6 +2025,26 @@ issue_3192: {
]
}
issue_3192_2: {
options = {
keep_fargs: "strict",
unused: true,
}
input: {
"use strict";
(function(a) {
console.log(a = "foo", arguments[0]);
})("bar");
}
expect: {
"use strict";
(function() {
console.log("foo", arguments[0]);
})("bar");
}
expect_stdout: "foo bar"
}
issue_3233: {
options = {
pure_getters: "strict",