diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-10-04 01:24:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-04 08:24:41 +0800 |
commit | 95ef4d5377efc159c7102f134d844ba617b28996 (patch) | |
tree | d3768efb468f24ba872c9ac39a981c0a7e0a7742 /test | |
parent | 04017215cc0bd9a19492cd8792dac556a0912043 (diff) | |
download | tracifyjs-95ef4d5377efc159c7102f134d844ba617b28996.tar.gz tracifyjs-95ef4d5377efc159c7102f134d844ba617b28996.zip |
fix corner case in `mangle` (#4174)
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/functions.js | 27 | ||||
-rw-r--r-- | test/compress/reduce_vars.js | 8 |
2 files changed, 31 insertions, 4 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js index 745de9db..b68a04aa 100644 --- a/test/compress/functions.js +++ b/test/compress/functions.js @@ -4960,3 +4960,30 @@ issue_4171_2: { } expect_stdout: "undefined" } + +catch_defun: { + mangle = { + toplevel: true, + } + input: { + try { + throw 42; + } catch (a) { + function f() { + return typeof a; + } + } + console.log(f()); + } + expect: { + try { + throw 42; + } catch (o) { + function t() { + return typeof o; + } + } + console.log(t()); + } + expect_stdout: true +} diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js index a79dd068..414d6646 100644 --- a/test/compress/reduce_vars.js +++ b/test/compress/reduce_vars.js @@ -5374,11 +5374,11 @@ defun_catch_4: { try { throw 42; } catch (a) { + function a() {} console.log(a); } } - expect_stdout: "42" - node_version: "<=4" + expect_stdout: true } defun_catch_5: { @@ -5400,10 +5400,10 @@ defun_catch_5: { throw 42; } catch (a) { console.log(a); + function a() {} } } - expect_stdout: "42" - node_version: "<=4" + expect_stdout: true } defun_catch_6: { |