diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-01-16 17:03:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-16 17:03:12 +0800 |
commit | b4aef753e7f65c0919c6c40b2b28d9f149bc81ed (patch) | |
tree | 33b2c9b5ea33dd349237b8e743cdc6415669b51c /test | |
parent | 424173d311cd9c35a10a276abdab1de902158ac2 (diff) | |
download | tracifyjs-b4aef753e7f65c0919c6c40b2b28d9f149bc81ed.tar.gz tracifyjs-b4aef753e7f65c0919c6c40b2b28d9f149bc81ed.zip |
general improvements around `AST_ForIn` (#2796)
- compress using `collapse_vars`
- remove unused `name`
- simplify `loop_body`
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/collapse_vars.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index f252a7f4..9597b67f 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -4062,3 +4062,30 @@ cascade_statement: { } } } + +cascade_forin: { + options = { + collapse_vars: true, + } + input: { + var a; + function f(b) { + return [ b, b, b ]; + } + for (var c in a = console, f(a)) + console.log(c); + } + expect: { + var a; + function f(b) { + return [ b, b, b ]; + } + for (var c in f(a = console)) + console.log(c); + } + expect_stdout: [ + "0", + "1", + "2", + ] +} |