Introduce new compress option unsafe_arrows (#2278)
* Not always safe to convert a function expression to an arrow function when code depends on the function prototype existing. Fixes #2271
This commit is contained in:
@@ -84,6 +84,7 @@ function Compressor(options, false_by_default) {
|
||||
toplevel : !!(options && options["top_retain"]),
|
||||
typeofs : !false_by_default,
|
||||
unsafe : false,
|
||||
unsafe_arrows : false,
|
||||
unsafe_comps : false,
|
||||
unsafe_Func : false,
|
||||
unsafe_math : false,
|
||||
@@ -4748,7 +4749,7 @@ merge(Compressor.prototype, {
|
||||
|
||||
OPT(AST_Function, function(self, compressor){
|
||||
tighten_body(self.body, compressor);
|
||||
if (compressor.option("arrows")
|
||||
if (compressor.option("unsafe_arrows")
|
||||
&& compressor.option("ecma") >= 6
|
||||
&& !self.name
|
||||
&& !self.is_generator
|
||||
|
||||
Reference in New Issue
Block a user