Improve yield support and restrict usage of strict
- Partially reverting91cdb93e57andeaf3911c31and 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:
@@ -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;
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user