aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-12-08 01:50:38 +0800
committerGitHub <noreply@github.com>2017-12-08 01:50:38 +0800
commite20935c3f2a03779b15ad225ae4616a1d80c2ec5 (patch)
tree116ddfd714d75af3ed0ebfdd7015448f11200935 /lib
parent3e34f62a1c48ab45db34cfb08d8dd2118c5780f0 (diff)
downloadtracifyjs-e20935c3f2a03779b15ad225ae4616a1d80c2ec5.tar.gz
tracifyjs-e20935c3f2a03779b15ad225ae4616a1d80c2ec5.zip
fix escape analysis for `AST_Conditional` & `AST_Sequence` (#2563)
fixes #2560
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index e59dce63..c80192dc 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -656,7 +656,9 @@ merge(Compressor.prototype, {
|| parent instanceof AST_VarDef && node === parent.value) {
d.escaped = true;
return;
- } else if (parent instanceof AST_Array) {
+ } else if (parent instanceof AST_Array
+ || parent instanceof AST_Conditional && node !== parent.condition
+ || parent instanceof AST_Sequence && node === parent.tail_node()) {
mark_escaped(d, scope, parent, parent, level + 1);
} else if (parent instanceof AST_ObjectKeyVal && node === parent.value) {
var obj = tw.parent(level + 1);