add JSXIdentifier as a valid ReferencedIdentifier - fixes #1584
This commit is contained in:
parent
82254d9d9b
commit
270a8be68d
@ -1,14 +1,14 @@
|
||||
import * as t from "../../types";
|
||||
|
||||
export var ReferencedIdentifier = {
|
||||
type: "Identifier",
|
||||
types: ["Identifier", "JSXIdentifier"],
|
||||
checkPath(path, opts) {
|
||||
return t.isReferencedIdentifier(path.node, path.parent, opts);
|
||||
}
|
||||
};
|
||||
|
||||
export var Scope = {
|
||||
type: "Scopable",
|
||||
types: ["Scopable"],
|
||||
checkPath(path) {
|
||||
return t.isScope(path.node, path.parent);
|
||||
}
|
||||
@ -27,7 +27,7 @@ export var BlockScoped = {
|
||||
};
|
||||
|
||||
export var Var = {
|
||||
type: "VariableDeclaration",
|
||||
types: ["VariableDeclaration"],
|
||||
checkPath(path) {
|
||||
return t.isVar(path.node);
|
||||
}
|
||||
|
||||
@ -29,19 +29,21 @@ export function explode(visitor, mergeConflicts) {
|
||||
|
||||
// wrap all the functions
|
||||
var fns = visitor[nodeType];
|
||||
for (var type in fns) {
|
||||
for (let type in fns) {
|
||||
fns[type] = wrapCheck(wrapper, fns[type]);
|
||||
}
|
||||
|
||||
// clear it from the visitor
|
||||
delete visitor[nodeType];
|
||||
|
||||
if (wrapper.type) {
|
||||
// merge the visitor if necessary or just put it back in
|
||||
if (visitor[wrapper.type]) {
|
||||
mergePair(visitor[wrapper.type], fns);
|
||||
} else {
|
||||
visitor[wrapper.type] = fns;
|
||||
if (wrapper.types) {
|
||||
for (let type of (wrapper.types: Array)) {
|
||||
// merge the visitor if necessary or just put it back in
|
||||
if (visitor[type]) {
|
||||
mergePair(visitor[type], fns);
|
||||
} else {
|
||||
visitor[type] = fns;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mergePair(visitor, fns);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user