aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-04-17 14:03:29 +0800
committerGitHub <noreply@github.com>2017-04-17 14:03:29 +0800
commit71a8d0d236d29015df2d1df18de11d661d17af2e (patch)
treeb671ba60c5ddc75a840af8453cdf468ef0e33cbc /lib/compress.js
parent1a498db2d3e520d1711144c423312c62a2673115 (diff)
downloadtracifyjs-71a8d0d236d29015df2d1df18de11d661d17af2e.tar.gz
tracifyjs-71a8d0d236d29015df2d1df18de11d661d17af2e.zip
fix `reduce_vars` within try-block (#1818)
Possible partial execution due to exceptions.
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 640fcecc..cc42c46e 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -382,7 +382,19 @@ merge(Compressor.prototype, {
pop();
return true;
}
- if (node instanceof AST_Catch || node instanceof AST_SwitchBranch) {
+ if (node instanceof AST_Try) {
+ push();
+ walk_body(node, tw);
+ pop();
+ if (node.bcatch) {
+ push();
+ node.bcatch.walk(tw);
+ pop();
+ }
+ if (node.bfinally) node.bfinally.walk(tw);
+ return true;
+ }
+ if (node instanceof AST_SwitchBranch) {
push();
descend();
pop();