Fix compressing `do {...} while (false)`
authorMihai Bazon <mihai@bazon.net>
Tue, 19 Feb 2013 16:12:19 +0000 (18:12 +0200)
committerMihai Bazon <mihai@bazon.net>
Tue, 19 Feb 2013 16:12:19 +0000 (18:12 +0200)
It's not safe to transform it to {...} because the body might contain
`break`.  The solution could be more elaborate (detect if body contains
`break`) but I don't think it's worth the trouble.

Close #129

lib/compress.js

index ca23c40..3d9097e 100644 (file)
@@ -1197,8 +1197,6 @@ merge(Compressor.prototype, {
                     extract_declarations_from_unreachable_code(compressor, self.body, a);
                     return make_node(AST_BlockStatement, self, { body: a });
                 }
-            } else {
-                return self.body;
             }
         }
         return self;