This commit is contained in:
kzc 2017-10-15 13:43:22 -04:00
parent 3a865629ce
commit 044dbd2359

View File

@ -4875,12 +4875,12 @@ merge(Compressor.prototype, {
if (compressor.option("computed_props") if (compressor.option("computed_props")
&& self.key instanceof AST_Constant // save a comparison in the typical case && self.key instanceof AST_Constant // save a comparison in the typical case
&& ( && (
// whitelist acceptable props as AST_Constants are not all constant // whitelist acceptable props as not all AST_Constants are true constants
self.key instanceof AST_String self.key instanceof AST_String
|| self.key instanceof AST_Number || self.key instanceof AST_Number
)) { )) {
self.key = self.key.value; self.key = self.key.value;
// fallthrough - `return self;` not needed as transformed tree in good form // fallthrough - `return self` not needed as transformed tree in good form
} }
// p:function(){} ---> p(){} // p:function(){} ---> p(){}
// p:function*(){} ---> *p(){} // p:function*(){} ---> *p(){}