aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/compress.js2
-rw-r--r--test/compress/loops.js26
2 files changed, 26 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 99235987..01fdeeae 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -2132,7 +2132,7 @@ merge(Compressor.prototype, {
}
} else {
// self instanceof AST_Do
- return self.body;
+ return self;
}
}
if (self instanceof AST_While) {
diff --git a/test/compress/loops.js b/test/compress/loops.js
index ca05461c..e26dc79f 100644
--- a/test/compress/loops.js
+++ b/test/compress/loops.js
@@ -213,6 +213,30 @@ evaluate: {
a();
for(;;)
c();
- d();
+ // rule disabled due to issue_1532
+ do d(); while (false);
+ }
+}
+
+issue_1532: {
+ options = {
+ evaluate: true,
+ loops: true,
+ }
+ input: {
+ function f(x, y) {
+ do {
+ if (x) break;
+ foo();
+ } while (false);
+ }
+ }
+ expect: {
+ function f(x, y) {
+ do {
+ if (x) break;
+ foo();
+ } while (false);
+ }
}
}