enhance collapse_vars (#4117)
This commit is contained in:
@@ -1458,9 +1458,15 @@ merge(Compressor.prototype, {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handle_custom_scan_order(node, tt) {
|
function handle_custom_scan_order(node, tt) {
|
||||||
|
// Scan object only in a for-in statement
|
||||||
|
if (node instanceof AST_ForIn) {
|
||||||
|
node.object = node.object.transform(tt);
|
||||||
|
abort = true;
|
||||||
|
return node;
|
||||||
|
}
|
||||||
// Skip (non-executed) functions
|
// Skip (non-executed) functions
|
||||||
if (node instanceof AST_Scope) return node;
|
if (node instanceof AST_Scope) return node;
|
||||||
// Scan case expressions first in a switch statement
|
// Scan first case expression only in a switch statement
|
||||||
if (node instanceof AST_Switch) {
|
if (node instanceof AST_Switch) {
|
||||||
node.expression = node.expression.transform(tt);
|
node.expression = node.expression.transform(tt);
|
||||||
for (var i = 0; !abort && i < node.body.length; i++) {
|
for (var i = 0; !abort && i < node.body.length; i++) {
|
||||||
@@ -1493,7 +1499,7 @@ merge(Compressor.prototype, {
|
|||||||
}
|
}
|
||||||
if (node instanceof AST_Debugger) return true;
|
if (node instanceof AST_Debugger) return true;
|
||||||
if (node instanceof AST_Defun) return funarg && lhs.name === node.name.name;
|
if (node instanceof AST_Defun) return funarg && lhs.name === node.name.name;
|
||||||
if (node instanceof AST_IterationStatement) return !(node instanceof AST_For);
|
if (node instanceof AST_DWLoop) return true;
|
||||||
if (node instanceof AST_LoopControl) return true;
|
if (node instanceof AST_LoopControl) return true;
|
||||||
if (node instanceof AST_Try) return true;
|
if (node instanceof AST_Try) return true;
|
||||||
if (node instanceof AST_With) return true;
|
if (node instanceof AST_With) return true;
|
||||||
|
|||||||
@@ -2181,8 +2181,7 @@ issue_3515_1: {
|
|||||||
expect: {
|
expect: {
|
||||||
var c = 0;
|
var c = 0;
|
||||||
(function() {
|
(function() {
|
||||||
this[c++] = 0;
|
for (var key20 in !(this[c++] = 0));
|
||||||
for (var key20 in !0);
|
|
||||||
})();
|
})();
|
||||||
console.log(c);
|
console.log(c);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user