Fix #8415: Add method declaration to contextually typed locations when searching for symbols

This commit is contained in:
Mohamed Hegazy
2016-05-03 17:08:06 -07:00
parent 7f82bebb03
commit 13aff17975
3 changed files with 97 additions and 2 deletions

View File

@@ -2583,8 +2583,17 @@ namespace ts {
/** Returns true if node is a name of an object literal property, e.g. "a" in x = { "a": 1 } */
function isNameOfPropertyAssignment(node: Node): boolean {
return (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.StringLiteral || node.kind === SyntaxKind.NumericLiteral) &&
(node.parent.kind === SyntaxKind.PropertyAssignment || node.parent.kind === SyntaxKind.ShorthandPropertyAssignment) && (<PropertyDeclaration>node.parent).name === node;
if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.StringLiteral || node.kind === SyntaxKind.NumericLiteral) {
switch (node.parent.kind) {
case SyntaxKind.PropertyAssignment:
case SyntaxKind.ShorthandPropertyAssignment:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
return (<PropertyDeclaration>node.parent).name === node;
}
}
return false;
}
function isLiteralNameOfPropertyDeclarationOrIndexAccess(node: Node): boolean {