flow: create var declaration for flow declarations

This commit is contained in:
Henry Zhu 2015-06-17 09:18:51 -04:00
parent d16f726b15
commit 0de733b66a
2 changed files with 6 additions and 1 deletions

View File

@ -309,6 +309,10 @@ function monkeypatch() {
referencer.prototype.DeclareFunction =
referencer.prototype.DeclareVariable =
referencer.prototype.DeclareClass = function(node) {
if (node.id) {
createScopeVariable.call(this, node, node.id);
}
var typeParamScope;
if (node.typeParameters) {
typeParamScope = nestTypeParamScope(this.scopeManager, node);

View File

@ -376,7 +376,8 @@ describe("verify", function () {
"declare class A { static () : number }",
"declare module B { declare var x: number; }",
"declare function foo<T>(): void;",
"declare var bar"
"declare var bar",
"A; B; foo(); bar;"
].join("\n"),
{ "no-undef": 1, "no-unused-vars": 1 },
[]