Merge pull request #14506 from anilanar/babel-traverse/binding-kind-can-be-module

babel-traverse: add "module" as one of possible values for Binding.kind
This commit is contained in:
Arthur Ozga 2017-02-10 13:53:56 -08:00 committed by GitHub
commit 421ea67c5a
2 changed files with 14 additions and 1 deletions

View File

@ -109,3 +109,16 @@ const v1: Visitor = {
path.scope.rename("n");
}
};
// Binding.kind
const BindingKindTest: Visitor = {
Identifier(path) {
const kind = path.scope.getBinding("str").kind;
kind === 'module';
kind === 'const';
kind === 'let';
kind === 'var';
// The following should fail when uncommented
// kind === 'anythingElse';
},
};

View File

@ -126,7 +126,7 @@ export class Binding {
identifier: t.Identifier;
scope: Scope;
path: NodePath<Node>;
kind: 'var' | 'let' | 'const';
kind: 'var' | 'let' | 'const' | 'module';
referenced: boolean;
references: number;
referencePaths: NodePath<Node>[];