requested changes

This commit is contained in:
kzc 2018-01-17 00:24:20 -05:00
parent f8e3bab500
commit 1080d53f68
2 changed files with 7 additions and 10 deletions

View File

@ -151,11 +151,11 @@ 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
//toplevel.figure_out_scope(options.mangle);
//toplevel.expand_names(options.mangle);
if (0 && options.rename) {
toplevel.figure_out_scope(options.mangle);
toplevel.expand_names(options.mangle);
}
if (timings) timings.compress = Date.now();
if (options.compress) toplevel = new Compressor(options.compress).compress(toplevel);

View File

@ -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)) {}
;
});
@ -1041,18 +1042,14 @@ function OutputStream(options) {
self._do_print_body(output);
});
DEFPRINT(AST_ForIn, function(self, output){
var is_for_of = self instanceof AST_ForOf;
var is_for_of_sequence = is_for_of && self.object instanceof AST_Sequence;
output.print("for");
output.space();
output.with_parens(function(){
self.init.print(output);
output.space();
output.print(is_for_of ? "of" : "in");
output.print(self instanceof AST_ForOf ? "of" : "in");
output.space();
if (is_for_of_sequence) output.print("(");
self.object.print(output);
if (is_for_of_sequence) output.print(")");
});
output.space();
self._do_print_body(output);