fix invalid transform on const (#1919)

- preserve (re)assignment to `const` for runtime error
- suppress `cascade` on `const`, as runtime behaviour is ill-defined
This commit is contained in:
Alex Lam S.L
2017-05-12 04:51:44 +08:00
committed by GitHub
parent 2b44f4ae30
commit 1d407e761e
4 changed files with 107 additions and 2 deletions

View File

@@ -710,3 +710,27 @@ issue_27: {
})(jQuery);
}
}
reassign_const: {
options = {
cascade: true,
sequences: true,
side_effects: true,
}
input: {
function f() {
const a = 1;
a++;
return a;
}
console.log(f());
}
expect: {
function f() {
const a = 1;
return a++, a;
}
console.log(f());
}
expect_stdout: true
}