diff options
Diffstat (limited to 'test/compress/collapse_vars.js')
-rw-r--r-- | test/compress/collapse_vars.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index 4215cebe..0d578d7d 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -2186,3 +2186,49 @@ compound_assignment: { } expect_stdout: "4" } + +reassign_const_1: { + options = { + collapse_vars: true, + } + input: { + function f() { + const a = 1; + a = 2; + return a; + } + console.log(f()); + } + expect: { + function f() { + const a = 1; + a = 2; + return a; + } + console.log(f()); + } + expect_stdout: true +} + +reassign_const_2: { + options = { + collapse_vars: true, + } + input: { + function f() { + const a = 1; + ++a; + return a; + } + console.log(f()); + } + expect: { + function f() { + const a = 1; + ++a; + return a; + } + console.log(f()); + } + expect_stdout: true +} |