warn & drop #__PURE__ iff IIFE is dropped (#1511)

- consolidate `side-effects` optimisations
- improve string `+` optimisation
- enhance literal & `conditionals` optimisations
This commit is contained in:
Alex Lam S.L
2017-02-28 02:25:44 +08:00
committed by GitHub
parent 0b0296eb2a
commit 858e6c78a4
8 changed files with 216 additions and 99 deletions

View File

@@ -154,6 +154,17 @@ describe("minify", function() {
var code = result.code;
assert.strictEqual(code, "// comment1 comment2\nbar();");
});
it("should not drop #__PURE__ hint if function is retained", function() {
var result = Uglify.minify("var a = /*#__PURE__*/(function(){return 1})();", {
fromString: true,
output: {
comments: "all",
beautify: false,
}
});
var code = result.code;
assert.strictEqual(code, "var a=/*#__PURE__*/function(){return 1}();");
})
});
describe("JS_Parse_Error", function() {