Improve yield support and restrict usage of strict

- Partially reverting 91cdb93e57 and eaf3911c31 and reimplement
- Add generators support for objects and classes
- Only classes can have static methods so restrict use of it

Special thanks to @rvanvelzen and @kzc for reviewing this patch and
providing constructive feedback over and over again.
This commit is contained in:
Anthony Van de Gejuchte
2016-05-26 17:00:37 +02:00
parent 8ad8d7b717
commit dcfc514c38
10 changed files with 318 additions and 32 deletions

View File

@@ -1245,7 +1245,7 @@ merge(Compressor.prototype, {
|| this.alternative.has_side_effects(compressor);
});
def(AST_Unary, function(compressor){
return member(this.operator, ["delete", "++", "--", "yield", "yield*"])
return member(this.operator, ["delete", "++", "--"])
|| this.expression.has_side_effects(compressor);
});
def(AST_SymbolRef, function(compressor){
@@ -2968,4 +2968,11 @@ merge(Compressor.prototype, {
return self;
});
OPT(AST_Yield, function(self, compressor){
if (!self.is_star && self.expression instanceof AST_Undefined) {
self.expression = null;
}
return self;
});
})();