aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-03-26 18:08:44 +0800
committerGitHub <noreply@github.com>2017-03-26 18:08:44 +0800
commite76fb354eb62d8e7b6968f1f77cfbb219814cea3 (patch)
tree8f1523df409bf635fd41ca9a4c2ecdf51e9dc327 /test/compress
parent3276740779077f2ee7b686c4aa7f1bd46fbc1c66 (diff)
downloadtracifyjs-e76fb354eb62d8e7b6968f1f77cfbb219814cea3.tar.gz
tracifyjs-e76fb354eb62d8e7b6968f1f77cfbb219814cea3.zip
fix `cascade` on `delete` operator (#1687)
Conditions including strict mode would make `delete` return `true` or `false`, and are too complex to be evaluated by the compressor. Suppress assignment folding into said operator. fixes #1685
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/sequences.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/compress/sequences.js b/test/compress/sequences.js
index 49b61ae0..af6e0c36 100644
--- a/test/compress/sequences.js
+++ b/test/compress/sequences.js
@@ -306,3 +306,27 @@ unsafe_undefined: {
}
}
}
+
+issue_1685: {
+ options = {
+ cascade: true,
+ side_effects: true,
+ }
+ input: {
+ var a = 100, b = 10;
+ function f() {
+ var a = (a--, delete a && --b);
+ }
+ f();
+ console.log(a, b);
+ }
+ expect: {
+ var a = 100, b = 10;
+ function f() {
+ var a = (a--, delete a && --b);
+ }
+ f();
+ console.log(a, b);
+ }
+ expect_stdout: true
+}