Skip to content

Commit

Permalink
fix corner case in keep_fargs (#3620)
Browse files Browse the repository at this point in the history
fixes #3619
  • Loading branch information
alexlamsl committed Dec 2, 2019
1 parent 9a6faf3 commit bef856a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/compress.js
Expand Up @@ -5173,8 +5173,7 @@ merge(Compressor.prototype, {
&& !fn.uses_arguments
&& !fn.pinned()) {
var pos = 0, last = 0;
var drop_fargs = exp === fn && compressor.drop_fargs(fn, self)
&& (!fn.name || !fn.name.definition().recursive_refs);
var drop_fargs = exp === fn && !fn.name && compressor.drop_fargs(fn, self);
var side_effects = [];
for (var i = 0; i < self.args.length; i++) {
var trim = i >= fn.argnames.length;
Expand Down
30 changes: 30 additions & 0 deletions test/compress/keep_fargs.js
Expand Up @@ -1425,3 +1425,33 @@ recursive_iife_3: {
}
expect_stdout: "PASS"
}

issue_3619: {
options = {
keep_fargs: false,
unused: true,
}
input: {
var a = 1, b = "FAIL";
(function f(c, d) {
function g() {
d && (b = "PASS", 0 <= --a && g());
0 <= --a && f(0, "function");
}
g();
})();
console.log(b);
}
expect: {
var a = 1, b = "FAIL";
(function f(c, d) {
function g() {
d && (b = "PASS", 0 <= --a && g());
0 <= --a && f(0, "function");
}
g();
})();
console.log(b);
}
expect_stdout: "PASS"
}

0 comments on commit bef856a

Please sign in to comment.