extend collapse_vars to let and const (#2252)

fixes #2250
This commit is contained in:
Alex Lam S.L
2017-07-25 22:07:21 +08:00
committed by GitHub
parent 69861824b5
commit d3df2f985d
4 changed files with 71 additions and 2 deletions

View File

@@ -302,6 +302,7 @@ merge(Compressor.prototype, {
if (reduce_vars) {
if (node instanceof AST_Toplevel) node.globals.each(reset_def);
if (node instanceof AST_Scope) node.variables.each(reset_def);
if (node.block_scope) node.block_scope.variables.each(reset_def);
if (node instanceof AST_SymbolRef) {
var d = node.definition();
d.references.push(node);