diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-11-13 16:45:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-13 16:45:16 +0800 |
commit | fe65ce965885815a30d88aa7d9eccec5443e6a3b (patch) | |
tree | 16aeb373b9efe2a0b2ffdddabd054ded62eee43b /lib/compress.js | |
parent | d6fd18d0b000e1e4fbe01259139043f42d8fdebf (diff) | |
download | tracifyjs-fe65ce965885815a30d88aa7d9eccec5443e6a3b.tar.gz tracifyjs-fe65ce965885815a30d88aa7d9eccec5443e6a3b.zip |
fix corner case in `collapse_vars` (#3582)
fixes #3581
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js index 2bf120b3..de07080f 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -1090,7 +1090,7 @@ merge(Compressor.prototype, { scope = node; break; } else if (node instanceof AST_Try) { - in_try = true; + in_try = node; } } while (node = compressor.parent(level++)); } @@ -1321,6 +1321,10 @@ merge(Compressor.prototype, { function is_last_node(node, parent) { if (node instanceof AST_Call) return true; if (node instanceof AST_Exit) { + if (in_try) { + if (in_try.bfinally) return true; + if (in_try.bcatch && node instanceof AST_Throw) return true; + } return side_effects || lhs instanceof AST_PropAccess || may_modify(lhs); } if (node instanceof AST_Function) { |