diff options
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/compress.js b/lib/compress.js index 591f28a8..1d8c71c7 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -347,7 +347,7 @@ merge(Compressor.prototype, { && !parent.is_expr_pure(compressor) && (!(value instanceof AST_LambdaExpression) || !(parent instanceof AST_New) && value.contains_this()); } - if (parent instanceof AST_ForIn) return parent.init === node; + if (parent instanceof AST_ForEnumeration) return parent.init === node; if (parent instanceof AST_ObjectKeyVal) { if (parent.value !== node) return; var obj = tw.parent(level + 1); @@ -930,7 +930,7 @@ merge(Compressor.prototype, { tw.in_loop = saved_loop; return true; }); - def(AST_ForIn, function(tw, descend, compressor) { + def(AST_ForEnumeration, function(tw, descend, compressor) { this.variables.each(function(def) { reset_def(tw, compressor, def); }); @@ -1802,8 +1802,8 @@ merge(Compressor.prototype, { abort = true; return node; } - // Scan object only in a for-in statement - if (node instanceof AST_ForIn) { + // Scan object only in a for-in/of statement + if (node instanceof AST_ForEnumeration) { node.object = node.object.transform(tt); abort = true; return node; @@ -2117,7 +2117,7 @@ merge(Compressor.prototype, { if (!(expr.body instanceof AST_Block)) { extract_candidates(expr.body); } - } else if (expr instanceof AST_ForIn) { + } else if (expr instanceof AST_ForEnumeration) { extract_candidates(expr.object); if (!(expr.body instanceof AST_Block)) { extract_candidates(expr.body); @@ -2232,7 +2232,7 @@ merge(Compressor.prototype, { if (parent.init !== node && parent.condition !== node) return node; return find_stop_value(parent, level + 1); } - if (parent instanceof AST_ForIn) { + if (parent instanceof AST_ForEnumeration) { if (parent.init !== node) return node; return find_stop_value(parent, level + 1); } @@ -3190,7 +3190,7 @@ merge(Compressor.prototype, { } else if (stat.init instanceof AST_Var) { defs = stat.init; } - } else if (stat instanceof AST_ForIn) { + } else if (stat instanceof AST_ForEnumeration) { if (defs && defs.TYPE == stat.init.TYPE) { var defns = defs.definitions.slice(); stat.init = stat.init.definitions[0].name.convert_symbol(AST_SymbolRef, function(ref, name) { @@ -3237,7 +3237,7 @@ merge(Compressor.prototype, { if (defs === node) return node; if (defs.TYPE != node.TYPE) return node; var parent = this.parent(); - if (parent instanceof AST_ForIn && parent.init === node) return node; + if (parent instanceof AST_ForEnumeration && parent.init === node) return node; if (!declarations_only(node)) return node; defs.definitions = defs.definitions.concat(node.definitions); CHANGED = true; @@ -5155,7 +5155,7 @@ merge(Compressor.prototype, { pop(); return true; } - if (node instanceof AST_ForIn) { + if (node instanceof AST_ForEnumeration) { node.object.walk(tw); push(); segment.block = node; @@ -5788,7 +5788,7 @@ merge(Compressor.prototype, { if (node instanceof AST_Catch && node.argname instanceof AST_Destructured) { node.argname.transform(trimmer); } - if (node instanceof AST_Definitions && !(parent instanceof AST_ForIn && parent.init === node)) { + if (node instanceof AST_Definitions && !(parent instanceof AST_ForEnumeration && parent.init === node)) { // place uninitialized names at the start var body = [], head = [], tail = []; // for unused names whose initialization has @@ -6456,7 +6456,7 @@ merge(Compressor.prototype, { }); var seq = node.to_assignments(); var p = tt.parent(); - if (p instanceof AST_ForIn && p.init === node) { + if (p instanceof AST_ForEnumeration && p.init === node) { if (seq) return seq; var def = node.definitions[0].name; return make_node(AST_SymbolRef, def, def); @@ -7330,7 +7330,7 @@ merge(Compressor.prototype, { return if_break_in_loop(self, compressor); }); - OPT(AST_ForIn, function(self, compressor) { + OPT(AST_ForEnumeration, function(self, compressor) { if (compressor.option("varify") && (self.init instanceof AST_Const || self.init instanceof AST_Let)) { var name = self.init.definitions[0].name; if ((name instanceof AST_Destructured || name instanceof AST_SymbolLet) @@ -8661,7 +8661,7 @@ merge(Compressor.prototype, { } else if (scope instanceof AST_For) { if (scope.init === child) continue; in_loop = []; - } else if (scope instanceof AST_ForIn) { + } else if (scope instanceof AST_ForEnumeration) { if (scope.init === child) continue; if (scope.object === child) continue; in_loop = []; @@ -10734,7 +10734,7 @@ merge(Compressor.prototype, { if (assigned) return self; if (compressor.option("sequences") && parent.TYPE != "Call" - && !(parent instanceof AST_ForIn && parent.init === self)) { + && !(parent instanceof AST_ForEnumeration && parent.init === self)) { var seq = lift_sequence_in_expression(self, compressor); if (seq !== self) return seq.optimize(compressor); } @@ -10857,7 +10857,7 @@ merge(Compressor.prototype, { if (is_lhs(compressor.self(), parent)) return self; if (compressor.option("sequences") && parent.TYPE != "Call" - && !(parent instanceof AST_ForIn && parent.init === self)) { + && !(parent instanceof AST_ForEnumeration && parent.init === self)) { var seq = lift_sequence_in_expression(self, compressor); if (seq !== self) return seq.optimize(compressor); } |