Merge pull request #2522 from Microsoft/visitWorkaround

Use a function declaration vs a function expression to help deal with a reported Atom+IO.js issue.
This commit is contained in:
CyrusNajmabadi 2015-04-02 13:30:43 -07:00
commit feabcd044b

View file

@ -769,10 +769,20 @@ module ts {
public getNamedDeclarations() {
if (!this.namedDeclarations) {
let sourceFile = this;
this.namedDeclarations = this.computeNamedDeclarations();
}
return this.namedDeclarations;
}
private computeNamedDeclarations() {
let namedDeclarations: Declaration[] = [];
forEachChild(sourceFile, function visit(node: Node): void {
forEachChild(this, visit);
return namedDeclarations;
function visit(node: Node): void {
switch (node.kind) {
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.MethodDeclaration:
@ -882,12 +892,7 @@ module ts {
}
break;
}
});
this.namedDeclarations = namedDeclarations;
}
return this.namedDeclarations;
}
}