finish minification.removeConsoleCall transformer #740

This commit is contained in:
Sebastian McKenzie 2015-02-10 17:56:31 +11:00
parent 825d84ba52
commit 6266f5b924
2 changed files with 8 additions and 8 deletions

View File

@ -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();
}
}
};

View File

@ -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;
}
}