add support for flow declarations in scope tracking
This commit is contained in:
parent
4596ae48b8
commit
8055ce29f7
@ -447,6 +447,8 @@ export default class Scope {
|
||||
this.registerBinding("let", path);
|
||||
} else if (t.isImportDeclaration(node) || t.isExportDeclaration(node)) {
|
||||
this.registerBinding("module", path);
|
||||
} else if (t.isFlowDeclaration()) {
|
||||
this.registerBinding("type", path);
|
||||
} else {
|
||||
this.registerBinding("unknown", path);
|
||||
}
|
||||
|
||||
@ -83,15 +83,15 @@
|
||||
"ArrayTypeAnnotation": ["Flow"],
|
||||
"BooleanTypeAnnotation": ["Flow", "FlowBaseAnnotation"],
|
||||
"ClassImplements": ["Flow"],
|
||||
"DeclareClass": ["Flow", "FlowStatement", "Statement", "FlowDeclaration"],
|
||||
"DeclareFunction": ["Flow", "FlowStatement", "Statement", "FlowDeclaration"],
|
||||
"DeclareModule": ["Flow", "FlowStatement", "Statement", "FlowDeclaration"],
|
||||
"DeclareVariable": ["Flow", "FlowStatement", "Statement", "FlowDeclaration"],
|
||||
"DeclareClass": ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
"DeclareFunction": ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
"DeclareModule": ["Flow", "FlowDeclaration", "Statement"],
|
||||
"DeclareVariable": ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
"FunctionTypeAnnotation": ["Flow"],
|
||||
"FunctionTypeParam": ["Flow"],
|
||||
"GenericTypeAnnotation": ["Flow"],
|
||||
"InterfaceExtends": ["Flow"],
|
||||
"InterfaceDeclaration": ["Flow", "FlowStatement", "Statement", "Declaration"],
|
||||
"InterfaceDeclaration": ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
"IntersectionTypeAnnotation": ["Flow"],
|
||||
"MixedTypeAnnotation": ["Flow", "FlowBaseAnnotation"],
|
||||
"NullableTypeAnnotation": ["Flow"],
|
||||
@ -100,7 +100,7 @@
|
||||
"StringTypeAnnotation": ["Flow", "FlowBaseAnnotation"],
|
||||
"TupleTypeAnnotation": ["Flow"],
|
||||
"TypeofTypeAnnotation": ["Flow"],
|
||||
"TypeAlias": ["Flow", "FlowStatement", "Statement"],
|
||||
"TypeAlias": ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
"TypeAnnotation": ["Flow"],
|
||||
"TypeCastExpression": ["Flow"],
|
||||
"TypeParameterDeclaration": ["Flow"],
|
||||
|
||||
@ -30,6 +30,13 @@ export function getBindingIdentifiers(node: Object): Object {
|
||||
}
|
||||
|
||||
getBindingIdentifiers.keys = {
|
||||
DeclareClass: "id",
|
||||
DeclareFunction: "id",
|
||||
DeclareModule: "id",
|
||||
DeclareVariable: "id",
|
||||
InterfaceDeclaration: "id",
|
||||
TypeAlias: "id",
|
||||
|
||||
ComprehensionExpression: "blocks",
|
||||
ComprehensionBlock: "left",
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user