improve AST_ConciseMethod compression (#2202)

p(){return x;} ---> p:()=>x

Optimization subject to the `compress` option `arrows`.
This commit is contained in:
Alex Lam S.L
2017-07-06 01:21:04 +08:00
committed by GitHub
parent fdbb1d09ef
commit f5c46db738
4 changed files with 177 additions and 20 deletions

View File

@@ -4,7 +4,11 @@ var assert = require("assert");
describe("Object", function() {
it("Should allow objects to have a methodDefinition as property", function() {
var code = "var a = {test() {return true;}}";
assert.equal(Uglify.minify(code).code, "var a={test(){return!0}};");
assert.equal(Uglify.minify(code, {
compress: {
arrows: false
}
}).code, "var a={test(){return!0}};");
});
it("Should not allow objects to use static keywords like in classes", function() {