fix various for-of bugs (#2800)
- disable `rename` pass on harmony due to problem with for-of loops fixes #2794
This commit is contained in:
@@ -151,7 +151,9 @@ function minify(files, options) {
|
||||
toplevel = toplevel.wrap_commonjs(options.wrap);
|
||||
}
|
||||
if (timings) timings.rename = Date.now();
|
||||
if (options.rename) {
|
||||
// disable rename on harmony due to expand_names bug in for-of loops
|
||||
// https://github.com/mishoo/UglifyJS2/issues/2794
|
||||
if (0 && options.rename) {
|
||||
toplevel.figure_out_scope(options.mangle);
|
||||
toplevel.expand_names(options.mangle);
|
||||
}
|
||||
|
||||
@@ -766,6 +766,7 @@ function OutputStream(options) {
|
||||
|| p instanceof AST_Arrow // x => (x, x)
|
||||
|| p instanceof AST_DefaultAssign // x => (x = (0, function(){}))
|
||||
|| p instanceof AST_Expansion // [...(a, b)]
|
||||
|| p instanceof AST_ForOf && this === p.object // for (e of (foo, bar)) {}
|
||||
;
|
||||
});
|
||||
|
||||
@@ -1046,11 +1047,7 @@ function OutputStream(options) {
|
||||
output.with_parens(function(){
|
||||
self.init.print(output);
|
||||
output.space();
|
||||
if (self instanceof AST_ForOf) {
|
||||
output.print("of");
|
||||
} else {
|
||||
output.print("in");
|
||||
}
|
||||
output.print(self instanceof AST_ForOf ? "of" : "in");
|
||||
output.space();
|
||||
self.object.print(output);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user