drop lone "use strict" in function body (#2963)

fixes #2961
This commit is contained in:
Alex Lam S.L
2018-02-26 15:22:52 +08:00
committed by GitHub
parent ba7bad0dbd
commit ace5811691
2 changed files with 39 additions and 0 deletions

View File

@@ -3024,6 +3024,16 @@ merge(Compressor.prototype, {
return self;
});
OPT(AST_Lambda, function(self, compressor){
tighten_body(self.body, compressor);
if (compressor.option("side_effects")
&& self.body.length == 1
&& self.body[0] === compressor.has_directive("use strict")) {
self.body.length = 0;
}
return self;
});
AST_Scope.DEFMETHOD("drop_unused", function(compressor){
if (!compressor.option("unused")) return;
if (compressor.has_directive("use asm")) return;