enhance unused (#4129)
This commit is contained in:
@@ -4747,6 +4747,13 @@ merge(Compressor.prototype, {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (node instanceof AST_UnaryPostfix
|
||||||
|
&& node.expression instanceof AST_SymbolRef
|
||||||
|
&& indexOf_assign(node.expression.definition(), node) < 0) {
|
||||||
|
return make_node(AST_UnaryPrefix, node, {
|
||||||
|
operator: "+",
|
||||||
|
expression: node.expression
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node instanceof AST_Call) calls_to_drop_args.push(node);
|
if (node instanceof AST_Call) calls_to_drop_args.push(node);
|
||||||
|
|||||||
@@ -62,18 +62,18 @@ collapse_vars_side_effects_1: {
|
|||||||
expect: {
|
expect: {
|
||||||
function f1() {
|
function f1() {
|
||||||
var s = "abcdef", i = 2;
|
var s = "abcdef", i = 2;
|
||||||
console.log.bind(console)(s.charAt(i++), s.charAt(i++), s.charAt(4), 7);
|
console.log.bind(console)(s.charAt(i++), s.charAt(+i), s.charAt(4), 7);
|
||||||
}
|
}
|
||||||
function f2() {
|
function f2() {
|
||||||
var s = "abcdef", i = 2;
|
var s = "abcdef", i = 2;
|
||||||
console.log.bind(console)(s.charAt(i++), 5, s.charAt(i++), s.charAt(i++), 7);
|
console.log.bind(console)(s.charAt(i++), 5, s.charAt(i++), s.charAt(+i), 7);
|
||||||
}
|
}
|
||||||
function f3() {
|
function f3() {
|
||||||
var s = "abcdef",
|
var s = "abcdef",
|
||||||
i = 2,
|
i = 2,
|
||||||
log = console.log.bind(console),
|
log = console.log.bind(console),
|
||||||
x = s.charAt(i++),
|
x = s.charAt(i++),
|
||||||
y = s.charAt(i++);
|
y = s.charAt(+i);
|
||||||
log(x, s.charAt(4), y, 7);
|
log(x, s.charAt(4), y, 7);
|
||||||
}
|
}
|
||||||
function f4() {
|
function f4() {
|
||||||
@@ -3073,7 +3073,6 @@ issue_2298: {
|
|||||||
expect: {
|
expect: {
|
||||||
!function() {
|
!function() {
|
||||||
(function() {
|
(function() {
|
||||||
0;
|
|
||||||
try {
|
try {
|
||||||
!function(b) {
|
!function(b) {
|
||||||
(void 0)[1] = "foo";
|
(void 0)[1] = "foo";
|
||||||
|
|||||||
@@ -1730,7 +1730,7 @@ chained_3: {
|
|||||||
expect: {
|
expect: {
|
||||||
console.log(function(a, b) {
|
console.log(function(a, b) {
|
||||||
var c = b;
|
var c = b;
|
||||||
b++;
|
+b;
|
||||||
return c;
|
return c;
|
||||||
}(0, 2));
|
}(0, 2));
|
||||||
}
|
}
|
||||||
@@ -2737,7 +2737,7 @@ issue_3962_1: {
|
|||||||
0..toString();
|
0..toString();
|
||||||
} while (0);
|
} while (0);
|
||||||
if (c) console.log("PASS");
|
if (c) console.log("PASS");
|
||||||
}((a--, 1)), 0);
|
}(1), 0);
|
||||||
void 0;
|
void 0;
|
||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
@@ -2770,7 +2770,7 @@ issue_3962_2: {
|
|||||||
0..toString();
|
0..toString();
|
||||||
} while (0);
|
} while (0);
|
||||||
if (c) console.log("PASS");
|
if (c) console.log("PASS");
|
||||||
}((a--, 1)), 0);
|
}(1), 0);
|
||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
@@ -2853,11 +2853,11 @@ issue_4025: {
|
|||||||
console.log(a, b, d);
|
console.log(a, b, d);
|
||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
var d, c = 0;
|
var c = 0;
|
||||||
try {
|
try {
|
||||||
console.log(c);
|
console.log(c);
|
||||||
} finally {
|
} finally {
|
||||||
d = c + 1;
|
var d = c + 1;
|
||||||
c = 0;
|
c = 0;
|
||||||
}
|
}
|
||||||
console.log(1, 1, d);
|
console.log(1, 1, d);
|
||||||
|
|||||||
@@ -306,7 +306,6 @@ issue_2298: {
|
|||||||
expect: {
|
expect: {
|
||||||
!function() {
|
!function() {
|
||||||
(function() {
|
(function() {
|
||||||
0;
|
|
||||||
try {
|
try {
|
||||||
!function() {
|
!function() {
|
||||||
(void 0)[1] = "foo";
|
(void 0)[1] = "foo";
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ modified: {
|
|||||||
expect: {
|
expect: {
|
||||||
function f0() {
|
function f0() {
|
||||||
var b = 2;
|
var b = 2;
|
||||||
b++;
|
+b;
|
||||||
console.log(2);
|
console.log(2);
|
||||||
console.log(4);
|
console.log(4);
|
||||||
}
|
}
|
||||||
@@ -5590,7 +5590,7 @@ lvalues_def_1: {
|
|||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
var b = 1;
|
var b = 1;
|
||||||
var a = b++, b = NaN;
|
var a = +b, b = NaN;
|
||||||
console.log(a, b);
|
console.log(a, b);
|
||||||
}
|
}
|
||||||
expect_stdout: "1 NaN"
|
expect_stdout: "1 NaN"
|
||||||
|
|||||||
Reference in New Issue
Block a user