fix accounting after conversion to assignment (#2847)

Missing reference to `AST_SymbolRef` created by `unused` causes `collapse_vars` to misbehave.

fixes #2846
This commit is contained in:
Alex Lam S.L
2018-01-26 14:21:11 +08:00
committed by GitHub
parent 95cfce68ea
commit 193612ac67
2 changed files with 30 additions and 1 deletions

View File

@@ -1692,3 +1692,30 @@ issue_2768: {
}
expect_stdout: "PASS undefined"
}
issue_2846: {
options = {
collapse_vars: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
function f(a, b) {
var a = 0;
b && b(a);
return a++;
}
var c = f();
console.log(c);
}
expect: {
var c = function(a, b) {
a = 0;
b && b(a);
return a++;
}();
console.log(c);
}
expect_stdout: "0"
}