fix value reference caching in evaluate (#2969)

fixes #2968
This commit is contained in:
Alex Lam S.L
2018-03-02 04:04:29 +08:00
committed by GitHub
parent 56e2a369d0
commit 38f2b4579f
2 changed files with 60 additions and 24 deletions

View File

@@ -1535,3 +1535,34 @@ issue_2926_2: {
}
expect_stdout: "function"
}
issue_2968: {
options = {
collapse_vars: true,
evaluate: true,
inline: true,
passes: 2,
reduce_vars: true,
unused: true,
}
input: {
var c = "FAIL";
(function() {
(function(a, b) {
a <<= 0;
a && (a[(c = "PASS", 0 >>> (b += 1))] = 0);
})(42, -42);
})();
console.log(c);
}
expect: {
var c = "FAIL";
(function() {
b = -(a = 42),
void ((a <<= 0) && (a[(c = "PASS", 0 >>> (b += 1))] = 0));
var a, b;
})();
console.log(c);
}
expect_stdout: "PASS"
}