ignore function params, rest and catch clauses - webpack/webpack#688
This commit is contained in:
@@ -193,6 +193,17 @@ t.isReferenced = function (node, parent) {
|
||||
// we're a property key and we aren't computed so we aren't referenced
|
||||
if (t.isProperty(parent) && parent.key === node && !parent.computed) return false;
|
||||
|
||||
if (t.isFunction(parent)) {
|
||||
// we're a function param
|
||||
if (_.contains(parent.params, node)) return false;
|
||||
|
||||
// we're a rest parameter
|
||||
if (_.contains(parent.params, node)) return false;
|
||||
}
|
||||
|
||||
// we're a catch clause param
|
||||
if (t.isCatchClause(parent) && parent.param === node) return false;
|
||||
|
||||
// we're a variable declarator id so we aren't referenced
|
||||
if (t.isVariableDeclarator(parent) && parent.id === node) return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user