improve inline efficiency (#2924)
This commit is contained in:
@@ -4487,6 +4487,8 @@ merge(Compressor.prototype, {
|
|||||||
})) {
|
})) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else if (line instanceof AST_EmptyStatement) {
|
||||||
|
continue;
|
||||||
} else if (stat) {
|
} else if (stat) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -292,11 +292,12 @@ issue_2084: {
|
|||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
var c = 0;
|
var c = 0;
|
||||||
!function(c) {
|
!function() {
|
||||||
c = 1 + c,
|
var c;
|
||||||
|
c = 1 + (c = -1),
|
||||||
c = 1 + (c = 0),
|
c = 1 + (c = 0),
|
||||||
0 !== 23..toString() && (c = 1 + c);
|
0 !== 23..toString() && (c = 1 + c);
|
||||||
}(-1),
|
}(),
|
||||||
console.log(c);
|
console.log(c);
|
||||||
}
|
}
|
||||||
expect_stdout: "0"
|
expect_stdout: "0"
|
||||||
@@ -1051,11 +1052,9 @@ issue_2616: {
|
|||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
var c = "FAIL";
|
var c = "FAIL";
|
||||||
(function() {
|
!function(NaN) {
|
||||||
!function(NaN) {
|
(true << NaN) - 0/0 || (c = "PASS");
|
||||||
(true << NaN) - 0/0 || (c = "PASS");
|
}([]);
|
||||||
}([]);
|
|
||||||
})();
|
|
||||||
console.log(c);
|
console.log(c);
|
||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
@@ -1086,13 +1085,11 @@ issue_2620_1: {
|
|||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
var c = "FAIL";
|
var c = "FAIL";
|
||||||
(function() {
|
!function(a) {
|
||||||
(function(a) {
|
if (function(a) {
|
||||||
if (function(a) {
|
a && a();
|
||||||
a && a();
|
}(), a) c = "PASS";
|
||||||
}(), a) c = "PASS";
|
}(1),
|
||||||
})(1);
|
|
||||||
})(),
|
|
||||||
console.log(c);
|
console.log(c);
|
||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
@@ -1160,18 +1157,16 @@ issue_2620_3: {
|
|||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
var c = "FAIL";
|
var c = "FAIL";
|
||||||
(function() {
|
!function(a, NaN) {
|
||||||
(function(a, NaN) {
|
(function() {
|
||||||
(function() {
|
switch (a) {
|
||||||
switch (a) {
|
case a:
|
||||||
case a:
|
break;
|
||||||
break;
|
case c = "PASS", NaN:
|
||||||
case c = "PASS", NaN:
|
break;
|
||||||
break;
|
}
|
||||||
}
|
})();
|
||||||
})();
|
}(NaN);
|
||||||
})(NaN);
|
|
||||||
})();
|
|
||||||
console.log(c);
|
console.log(c);
|
||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
@@ -1341,11 +1336,9 @@ issue_2630_4: {
|
|||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
var x = 3, a = 1, b = 2;
|
var x = 3, a = 1, b = 2;
|
||||||
(function() {
|
!function() {
|
||||||
(function() {
|
while (--x >= 0 && void (b += ++a));
|
||||||
while (--x >= 0 && void (b += ++a));
|
}();
|
||||||
})();
|
|
||||||
})();
|
|
||||||
console.log(a);
|
console.log(a);
|
||||||
}
|
}
|
||||||
expect_stdout: "2"
|
expect_stdout: "2"
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ describe("minify", function() {
|
|||||||
content: "inline"
|
content: "inline"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
assert.strictEqual(result.code, "var bar=function(){return function(bar){return bar}}();");
|
assert.strictEqual(result.code, "var bar=function(bar){return bar};");
|
||||||
assert.strictEqual(warnings.length, 1);
|
assert.strictEqual(warnings.length, 1);
|
||||||
assert.strictEqual(warnings[0], "inline source map not found");
|
assert.strictEqual(warnings[0], "inline source map not found");
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user