diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-01-12 01:12:30 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-12 09:12:30 +0800 |
commit | c12486bab4e445144968635e16b96943ed98b8c1 (patch) | |
tree | 48e5328203affc5ffe4f130622448d86df4b70aa /lib/compress.js | |
parent | 52e94a072350b9d40ff11e8799b7550ce216cd45 (diff) | |
download | tracifyjs-c12486bab4e445144968635e16b96943ed98b8c1.tar.gz tracifyjs-c12486bab4e445144968635e16b96943ed98b8c1.zip |
fix corner case in `rests` (#4539)
fixes #4538
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js index 5526972f..e9985540 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -7778,8 +7778,9 @@ merge(Compressor.prototype, { if (!all(args, function(arg) { return !(arg instanceof AST_Spread); })) return; + var is_iife = fn === exp && !fn.name; if (fn.rest) { - if (!compressor.option("rests")) return; + if (!(is_iife && compressor.option("rests"))) return; var insert = fn.argnames.length; for (var i = args.length; i < insert; i++) { args[i] = make_node(AST_Undefined, call).optimize(compressor); @@ -7789,7 +7790,6 @@ merge(Compressor.prototype, { fn.rest = null; } var pos = 0, last = 0; - var is_iife = fn === exp && !fn.name; var drop_defaults = is_iife && compressor.option("default_values"); var drop_fargs = is_iife && compressor.drop_fargs(fn, call) ? function(argname, arg) { if (!argname) return true; |