From 6be2a6e02a422e526308076a502adb95781d5ced Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 13 Feb 2015 15:09:17 +1100 Subject: [PATCH] add extra note to minification dead code elimination transformer --- .../transformers/minification/dead-code-elimination.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/6to5/transformation/transformers/minification/dead-code-elimination.js b/lib/6to5/transformation/transformers/minification/dead-code-elimination.js index eb94292989..6a7fdb8a57 100644 --- a/lib/6to5/transformation/transformers/minification/dead-code-elimination.js +++ b/lib/6to5/transformation/transformers/minification/dead-code-elimination.js @@ -4,6 +4,7 @@ exports.optional = true; exports.ExpressionStatement = function (node) { // remove consequenceless expressions such as local variables and literals + // note: will remove directives // // var foo = true; foo; -> var foo = true; // "foo"; -> @@ -66,8 +67,7 @@ exports.IfStatement = { // if (foo) {} else { bar; } -> if (!foo) { bar; } // - if (t.blockStatement(consequent) && !consequent.body.length && - t.isBlockStatement(alternate) && alternate.body.length) { + if (t.blockStatement(consequent) && !consequent.body.length && t.isBlockStatement(alternate) && alternate.body.length) { node.consequent = node.alternate; node.alternate = null; node.test = t.unaryExpression("!", test, true);