fix collapse_vars on default function argument (#2299)

Avoid collision with local variable `undefined` under certain corner cases.

fixes #2298
This commit is contained in:
Alex Lam S.L
2017-09-04 02:32:33 +08:00
committed by GitHub
parent 3f355866cf
commit 395a17ccda
2 changed files with 43 additions and 1 deletions

View File

@@ -847,7 +847,7 @@ merge(Compressor.prototype, {
if (sym.name in names) continue;
names[sym.name] = true;
var arg = iife.args[i];
if (!arg) arg = make_node(AST_Undefined, sym);
if (!arg) arg = make_node(AST_Undefined, sym).transform(compressor);
else {
var tw = new TreeWalker(function(node) {
if (!arg) return true;