inline property access of AST_ConciseMethod

This commit is contained in:
alexlamsl
2017-07-08 14:25:58 +08:00
parent a556dd2dcb
commit 2539fb8096
2 changed files with 100 additions and 1 deletions

View File

@@ -4641,8 +4641,13 @@ merge(Compressor.prototype, {
if (compressor.option("unsafe") && self.expression instanceof AST_Object) {
var values = self.expression.properties;
for (var i = values.length; --i >= 0;) {
if (values[i].key === prop) {
var key = values[i].key;
if ((key instanceof AST_SymbolMethod ? key.name : key) === prop) {
var value = values[i].value;
if (key instanceof AST_SymbolMethod) {
if (values[i].is_generator) break;
value = make_node(AST_Function, value, value);
}
if (value instanceof AST_Function ? !value.contains_this() : !value.has_side_effects(compressor)) {
var obj = self.expression.clone();
obj.properties = obj.properties.slice();