From b4aef753e7f65c0919c6c40b2b28d9f149bc81ed Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Tue, 16 Jan 2018 17:03:12 +0800 Subject: general improvements around `AST_ForIn` (#2796) - compress using `collapse_vars` - remove unused `name` - simplify `loop_body` --- test/compress/collapse_vars.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test/compress/collapse_vars.js') 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", + ] +} -- cgit v1.2.3