enhance hoist_vars (#5865)
This commit is contained in:
@@ -10353,7 +10353,6 @@ Compressor.prototype.compress = function(node) {
|
|||||||
def.assignments++;
|
def.assignments++;
|
||||||
}
|
}
|
||||||
def.eliminated++;
|
def.eliminated++;
|
||||||
def.single_use = false;
|
|
||||||
return a;
|
return a;
|
||||||
}, []);
|
}, []);
|
||||||
if (assignments.length == 0) return null;
|
if (assignments.length == 0) return null;
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ issue_4489: {
|
|||||||
evaluate: true,
|
evaluate: true,
|
||||||
hoist_vars: true,
|
hoist_vars: true,
|
||||||
reduce_vars: true,
|
reduce_vars: true,
|
||||||
|
sequences: true,
|
||||||
toplevel: true,
|
toplevel: true,
|
||||||
unused: true,
|
unused: true,
|
||||||
}
|
}
|
||||||
@@ -363,6 +364,7 @@ issue_4893_1: {
|
|||||||
evaluate: true,
|
evaluate: true,
|
||||||
hoist_vars: true,
|
hoist_vars: true,
|
||||||
reduce_vars: true,
|
reduce_vars: true,
|
||||||
|
side_effects: true,
|
||||||
toplevel: true,
|
toplevel: true,
|
||||||
unused: true,
|
unused: true,
|
||||||
}
|
}
|
||||||
@@ -383,9 +385,8 @@ issue_4893_1: {
|
|||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
try{
|
try{
|
||||||
(function f() {
|
(function() {
|
||||||
null.p += 42;
|
null.p += 42;
|
||||||
f;
|
|
||||||
})();
|
})();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("PASS");
|
console.log("PASS");
|
||||||
@@ -422,9 +423,7 @@ issue_4893_2: {
|
|||||||
expect: {
|
expect: {
|
||||||
try{
|
try{
|
||||||
(function() {
|
(function() {
|
||||||
var a;
|
null.p += 42;
|
||||||
a = null;
|
|
||||||
a.p += 42;
|
|
||||||
})();
|
})();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("PASS");
|
console.log("PASS");
|
||||||
@@ -610,6 +609,7 @@ issue_5411_2: {
|
|||||||
evaluate: true,
|
evaluate: true,
|
||||||
hoist_vars: true,
|
hoist_vars: true,
|
||||||
reduce_vars: true,
|
reduce_vars: true,
|
||||||
|
sequences: true,
|
||||||
toplevel: true,
|
toplevel: true,
|
||||||
unused: true,
|
unused: true,
|
||||||
}
|
}
|
||||||
@@ -622,9 +622,9 @@ issue_5411_2: {
|
|||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
var b, c;
|
var b, c;
|
||||||
b++;
|
b++,
|
||||||
b = "PASS",
|
b = "PASS",
|
||||||
c;
|
c,
|
||||||
console.log(b);
|
console.log(b);
|
||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
|
|||||||
Reference in New Issue
Block a user