diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-02-19 00:26:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-19 08:26:57 +0800 |
commit | 5f60c1b830fec648974b3ea7cbd6f53a6bfd7c75 (patch) | |
tree | 4c9d12f39be736a2f000ce1e5d88a3af45bc6933 /lib/compress.js | |
parent | 10de27ca3d2010f45a1fb86b2707fa82e73b36b2 (diff) | |
download | tracifyjs-5f60c1b830fec648974b3ea7cbd6f53a6bfd7c75.tar.gz tracifyjs-5f60c1b830fec648974b3ea7cbd6f53a6bfd7c75.zip |
fix corner cases in arrow functions & `rests` (#4667)
fixes #4666
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/compress.js b/lib/compress.js index 325c0cd0..c3e315de 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -762,10 +762,11 @@ merge(Compressor.prototype, { 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; |