fix export and import specifier getIds and add support for computed properties to isReferenced
This commit is contained in:
@@ -128,8 +128,8 @@ t.isDynamic = function (node) {
|
||||
};
|
||||
|
||||
t.isReferenced = function (node, parent) {
|
||||
// we're a property key so we aren't referenced
|
||||
if (t.isProperty(parent) && parent.key === node) return false;
|
||||
// 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;
|
||||
|
||||
// we're a variable declarator id so we aren't referenced
|
||||
if (t.isVariableDeclarator(parent) && parent.id === node) return false;
|
||||
@@ -256,8 +256,8 @@ t.getIds = function (node, map, ignoreTypes) {
|
||||
|
||||
t.getIds.nodes = {
|
||||
AssignmentExpression: "left",
|
||||
ImportSpecifier: "id",
|
||||
ExportSpecifier: "id",
|
||||
ImportSpecifier: "name",
|
||||
ExportSpecifier: "name",
|
||||
VariableDeclarator: "id",
|
||||
FunctionDeclaration: "id",
|
||||
ClassDeclaration: "id",
|
||||
|
||||
Reference in New Issue
Block a user