diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compress.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js index 84f66b3c..3d55ecc1 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -194,12 +194,20 @@ merge(Compressor.prototype, { return statements; function eliminate_spurious_blocks(statements) { + var seen_dirs = []; return statements.reduce(function(a, stat){ if (stat instanceof AST_BlockStatement) { CHANGED = true; a.push.apply(a, eliminate_spurious_blocks(stat.body)); } else if (stat instanceof AST_EmptyStatement) { CHANGED = true; + } else if (stat instanceof AST_Directive) { + if (seen_dirs.indexOf(stat.value) < 0) { + a.push(stat); + seen_dirs.push(stat.value); + } else { + CHANGED = true; + } } else { a.push(stat); } |