optimize trivial arrow functions with a return statement in braces (#1681)
fixes #1676
This commit is contained in:
@@ -3943,6 +3943,14 @@ merge(Compressor.prototype, {
|
||||
return self;
|
||||
});
|
||||
|
||||
OPT(AST_Arrow, function(self, compressor){
|
||||
if (self.body.length === 1 && self.body[0] instanceof AST_Return) {
|
||||
var value = self.body[0].value;
|
||||
self.body = value ? value : [];
|
||||
}
|
||||
return self;
|
||||
});
|
||||
|
||||
OPT(AST_Class, function(self, compressor){
|
||||
// HACK to avoid compress failure.
|
||||
// AST_Class is not really an AST_Scope/AST_Block as it lacks a body.
|
||||
|
||||
Reference in New Issue
Block a user