From 8d30902ba9e8a08945c8ae7cac0cb2feb27bb93c Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sat, 21 Nov 2020 00:05:40 +0000 Subject: fix corner case in `mangle` (#4311) --- test/compress/const.js | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) (limited to 'test/compress') diff --git a/test/compress/const.js b/test/compress/const.js index 8dbe74da..c269f8c0 100644 --- a/test/compress/const.js +++ b/test/compress/const.js @@ -1,3 +1,45 @@ +mangle_block: { + mangle = { + toplevel: false, + } + input: { + var o = "PASS"; + { + const a = "FAIL"; + } + console.log(o); + } + expect: { + var o = "PASS"; + { + const a = "FAIL"; + } + console.log(o); + } + expect_stdout: "PASS" +} + +mangle_block_toplevel: { + mangle = { + toplevel: true, + } + input: { + var o = "PASS"; + { + const a = "FAIL"; + } + console.log(o); + } + expect: { + var o = "PASS"; + { + const c = "FAIL"; + } + console.log(o); + } + expect_stdout: "PASS" +} + mangle_catch_1: { mangle = {} input: { @@ -11,8 +53,8 @@ mangle_catch_1: { expect: { try { throw "eeeee"; - } catch (e) { - const o = typeof d; + } catch (o) { + const e = typeof d; } console.log(typeof a, typeof b); } -- cgit v1.2.3