Skip to content

Commit

Permalink
fix reduce_vars on AST_Accessor (#2776)
Browse files Browse the repository at this point in the history
fixes #2774
  • Loading branch information
alexlamsl committed Jan 12, 2018
1 parent d4d7d99 commit e49416e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/compress.js
Expand Up @@ -467,8 +467,9 @@ merge(Compressor.prototype, {
if (node instanceof AST_SymbolRef) d.references.push(node);
d.fixed = false;
});
def(AST_Accessor, function(tw, descend) {
def(AST_Accessor, function(tw, descend, compressor) {
push(tw);
reset_variables(tw, compressor, this);
descend();
pop(tw);
return true;
Expand Down
26 changes: 26 additions & 0 deletions test/compress/reduce_vars.js
Expand Up @@ -5276,3 +5276,29 @@ duplicate_lambda_defun_name_2: {
}
expect_stdout: "0"
}

issue_2774: {
options = {
reduce_vars: true,
unused: true,
}
input: {
console.log({
get a() {
var b;
(b = true) && b.c;
b = void 0;
}
}.a);
}
expect: {
console.log({
get a() {
var b;
(b = true) && b.c;
b = void 0;
}
}.a);
}
expect_stdout: "undefined"
}

0 comments on commit e49416e

Please sign in to comment.