return arg || make_node(AST_Undefined, iife);
}, visit);
});
- if (fn.rest) scan_declaration(tw, compressor, fn.rest, compressor.option("rests") && function() {
- return make_node(AST_Array, fn, {
+ var rest = fn.rest;
+ if (rest) scan_declaration(tw, compressor, rest, compressor.option("rests") && function() {
+ return fn.rest === rest ? make_node(AST_Array, fn, {
elements: iife.args.slice(fn.argnames.length),
- });
+ }) : rest;
}, visit);
walk_lambda(fn, tw);
var safe_ids = tw.safe_ids;
expect_stdout: "PASS 0 undefined"
node_version: ">=6"
}
+
+issue_4666: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ rests: true,
+ toplevel: true,
+ unsafe: true,
+ unused: true,
+ }
+ input: {
+ var a = 0, b = 0;
+ var o = ((...c) => a++ + c)(b);
+ for (var k in o)
+ b++;
+ console.log(a, b);
+ }
+ expect: {
+ var a = 0, b = 0;
+ var o = (c => +a + c)([ b ]);
+ for(var k in o)
+ b++;
+ console.log(1, b);
+ }
+ expect_stdout: "1 2"
+ node_version: ">=6"
+}