[ES6] Get compress and global_defs working for AST_Class

This commit is contained in:
kzc
2016-07-17 12:59:38 -04:00
committed by Richard van Velzen
parent 0af42d1831
commit 842ac27efb
3 changed files with 88 additions and 0 deletions

View File

@@ -2988,6 +2988,12 @@ merge(Compressor.prototype, {
return self;
});
OPT(AST_Class, function(self, compressor){
// HACK to avoid compress failure.
// AST_Class is not really an AST_Scope/AST_Block as it lacks a body.
return self;
});
OPT(AST_Yield, function(self, compressor){
if (!self.is_star && self.expression instanceof AST_Undefined) {
self.expression = null;

View File

@@ -227,6 +227,12 @@ TreeTransformer.prototype = new TreeWalker;
self.value = self.value.transform(tw);
});
_(AST_Class, function(self, tw){
if (self.name) self.name = self.name.transform(tw);
if (self.extends) self.extends = self.extends.transform(tw);
self.properties = do_list(self.properties, tw);
});
_(AST_Expansion, function(self, tw){
self.expression = self.expression.transform(tw);
});