fix & enhance collapse_vars (#4447)

fixes #4446
This commit is contained in:
Alex Lam S.L
2020-12-24 09:02:18 +00:00
committed by GitHub
parent 5f269cd573
commit 1896694532
7 changed files with 125 additions and 27 deletions

View File

@@ -974,3 +974,41 @@ issue_4444: {
expect_stdout: "PASS"
node_version: ">=6"
}
issue_4446_1: {
options = {
collapse_vars: true,
}
input: {
a = 42;
[ b = 42 ] = [ "PASS" ];
c = 42;
console.log(b, a);
}
expect: {
[ b = 42 ] = [ "PASS" ];
c = a = 42;
console.log(b, a);
}
expect_stdout: "PASS 42"
node_version: ">=6"
}
issue_4446_2: {
options = {
collapse_vars: true,
}
input: {
a = 42;
var [ b = 42 ] = [ "PASS" ];
c = 42;
console.log(b, a);
}
expect: {
var [ b = 42 ] = [ "PASS" ];
c = a = 42;
console.log(b, a);
}
expect_stdout: "PASS 42"
node_version: ">=6"
}