add in pattern support to t.isReferenced
This commit is contained in:
@@ -238,10 +238,21 @@ t.isReferenced = function (node, parent) {
|
||||
return parent.key === node && parent.computed;
|
||||
}
|
||||
|
||||
if (t.isRestElement(parent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (t.isAssignmentPattern(parent)) {
|
||||
return parent.right !== node;
|
||||
}
|
||||
|
||||
if (t.isPattern(parent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (t.isFunction(parent)) {
|
||||
for (var i = 0; i < parent.params.length; i++) {
|
||||
var param = parent.params[i];
|
||||
if (t.isRestElement(param)) param = param.argument;
|
||||
if (param === node) return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user