aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-02-18 18:04:33 +0000
committerGitHub <noreply@github.com>2021-02-19 02:04:33 +0800
commit10de27ca3d2010f45a1fb86b2707fa82e73b36b2 (patch)
tree71622ee56844fba68a0b57f52ea263f3092b39e2 /lib
parent7b4fd858ba23e6c1402ad33d8cc4a8a8e7966614 (diff)
downloadtracifyjs-10de27ca3d2010f45a1fb86b2707fa82e73b36b2.tar.gz
tracifyjs-10de27ca3d2010f45a1fb86b2707fa82e73b36b2.zip
fix corner case in `reduce_vars` (#4665)
fixes #4664
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js
index a58e2816..325c0cd0 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -757,7 +757,9 @@ merge(Compressor.prototype, {
var value = iife.args[i];
scan_declaration(tw, compressor, arg, function() {
var j = fn.argnames.indexOf(arg);
- return (j < 0 ? value : iife.args[j]) || make_node(AST_Undefined, iife);
+ var arg = j < 0 ? value : iife.args[j];
+ if (arg instanceof AST_Sequence && arg.expressions.length < 2) arg = arg.expressions[0];
+ return arg || make_node(AST_Undefined, iife);
}, visit);
});
if (fn.rest) scan_declaration(tw, compressor, fn.rest, compressor.option("rests") && function() {
@@ -3644,7 +3646,7 @@ merge(Compressor.prototype, {
// methods to determine if an expression has a numeric result type
(function(def) {
def(AST_Node, return_false);
- var binary = makePredicate("- * / % & | ^ << >> >>>");
+ var binary = makePredicate("- * / % ** & | ^ << >> >>>");
def(AST_Assign, function(compressor) {
return binary[this.operator.slice(0, -1)]
|| this.operator == "=" && this.right.is_number(compressor);