aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-12-22 01:08:56 +0000
committerGitHub <noreply@github.com>2019-12-22 01:08:56 +0000
commit519a00bd8adc72888ccf8d39161f835608a39ac3 (patch)
tree20215354e06ddf299fc87d50783c051943d96cf8 /lib
parent3ff0feddee0f293649d87be28d3cd0cf587dd195 (diff)
downloadtracifyjs-519a00bd8adc72888ccf8d39161f835608a39ac3.tar.gz
tracifyjs-519a00bd8adc72888ccf8d39161f835608a39ac3.zip
fix corner case in `collapse_vars` (#3642)
fixes #3641
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 3b40a5d3..c5b67569 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1569,6 +1569,7 @@ merge(Compressor.prototype, {
var parent = scanner.parent(level);
if (parent instanceof AST_Array) return find_stop_value(parent, level + 1);
if (parent instanceof AST_Assign) {
+ if (may_throw(parent)) return node;
if (parent.left instanceof AST_SymbolRef) {
var name = parent.left.name;
if (lhs.name == name) return node;
@@ -1647,7 +1648,9 @@ merge(Compressor.prototype, {
if (is_last_node(node, parent)) return node;
if (in_conditional(node, parent)) return node;
if (parent instanceof AST_Array) return find_stop_unused(parent, level + 1);
- if (parent instanceof AST_Assign) return find_stop_unused(parent, level + 1);
+ if (parent instanceof AST_Assign) {
+ return may_throw(parent) ? node : find_stop_unused(parent, level + 1);
+ }
if (parent instanceof AST_Binary) return find_stop_unused(parent, level + 1);
if (parent instanceof AST_Call) return find_stop_unused(parent, level + 1);
if (parent instanceof AST_Case) return find_stop_unused(parent, level + 1);