@@ -2351,20 +2351,25 @@ Compressor.prototype.compress = function(node) {
|
||||
// Scan computed keys, static fields & initializers in class
|
||||
if (node instanceof AST_Class) {
|
||||
if (node.name) node.name = node.name.transform(tt);
|
||||
if (node.extends) node.extends = node.extends.transform(tt);
|
||||
node.properties.reduce(function(props, prop) {
|
||||
if (!abort && node.extends) node.extends = node.extends.transform(tt);
|
||||
var fields = [], stats = [];
|
||||
for (var i = 0; !abort && i < node.properties.length; i++) {
|
||||
var prop = node.properties[i];
|
||||
if (prop.key instanceof AST_Node) prop.key = prop.key.transform(tt);
|
||||
if (prop.static) {
|
||||
if (prop instanceof AST_ClassField) {
|
||||
if (prop.value) props.push(prop);
|
||||
} else if (prop instanceof AST_ClassInit) {
|
||||
props.unshift(prop);
|
||||
}
|
||||
if (!prop.static) continue;
|
||||
if (prop instanceof AST_ClassField) {
|
||||
if (prop.value) fields.push(prop);
|
||||
} else if (prop instanceof AST_ClassInit) {
|
||||
[].push.apply(stats, prop.value.body);
|
||||
}
|
||||
return props;
|
||||
}, []).forEach(function(prop) {
|
||||
}
|
||||
for (var i = 0; !abort && i < stats.length; i++) {
|
||||
stats[i].transform(tt);
|
||||
}
|
||||
for (var i = 0; !abort && i < fields.length; i++) {
|
||||
var prop = fields[i];
|
||||
prop.value = prop.value.transform(tt);
|
||||
});
|
||||
}
|
||||
return node;
|
||||
}
|
||||
// Scan object only in a for-in/of statement
|
||||
|
||||
Reference in New Issue
Block a user