fix corner case in collapse_vars (#5018)

fixes #5017
This commit is contained in:
Alex Lam S.L
2021-06-21 04:12:45 +01:00
committed by GitHub
parent e368d39715
commit 111366fca0
4 changed files with 33 additions and 10 deletions

View File

@@ -2625,3 +2625,25 @@ issue_4994: {
expect_stdout: "PASS"
node_version: ">=6"
}
issue_5017: {
options = {
collapse_vars: true,
reduce_vars: true,
toplevel: true,
}
input: {
var a = function() {};
var b = c = a;
var c = [ c ] = [ c ];
console.log(c[0] === a ? "PASS" : "FAIL");
}
expect: {
var a = function() {};
var b = a;
var c = [ c ] = [ c = a ];
console.log(c[0] === a ? "PASS" : "FAIL");
}
expect_stdout: "PASS"
node_version: ">=6"
}