diff --git a/lib/6to5/transformation/transformers/minification/remove-console-calls.js b/lib/6to5/transformation/transformers/minification/remove-console-calls.js index afdb72f233..3c53dd53bc 100644 --- a/lib/6to5/transformation/transformers/minification/remove-console-calls.js +++ b/lib/6to5/transformation/transformers/minification/remove-console-calls.js @@ -6,8 +6,12 @@ var isConsole = t.buildMatchMemberExpression("console", true); exports.optional = true; -exports.CallExpression = function (node) { +exports.CallExpression = function (node, parent) { if (isConsole(node.callee)) { - this.remove(); + if (t.isExpressionStatement(parent)) { + this.parentPath.remove(); + } else { + this.remove(); + } } }; diff --git a/lib/6to5/types/index.js b/lib/6to5/types/index.js index 8e38945803..a2b4445c00 100644 --- a/lib/6to5/types/index.js +++ b/lib/6to5/types/index.js @@ -444,12 +444,8 @@ t.buildMatchMemberExpression = function (match, allowPartial) { } // too many parts - if (++i > parts.length) { - if (allowPartial) { - return true; - } else { - return false; - } + if (++i >= parts.length) { + return !!allowPartial; } }