From 47c91904089ceeb6d09c07f4efaa6e43f2a6152b Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 26 Sep 2015 07:57:39 -0700 Subject: [PATCH] Proper handling of "this" in getSymbolAtLocation --- src/compiler/checker.ts | 2 +- src/services/services.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 300b3d74295..ea704ed3382 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14283,7 +14283,7 @@ namespace ts { case SyntaxKind.ThisKeyword: case SyntaxKind.SuperKeyword: - let type = checkExpression(node); + let type = isExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); return type.symbol; case SyntaxKind.ConstructorKeyword: diff --git a/src/services/services.ts b/src/services/services.ts index eb81a336736..d078571e5a8 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -6249,7 +6249,8 @@ namespace ts { } return node.parent.kind === SyntaxKind.TypeReference || - (node.parent.kind === SyntaxKind.ExpressionWithTypeArguments && !isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)); + (node.parent.kind === SyntaxKind.ExpressionWithTypeArguments && !isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + node.kind === SyntaxKind.ThisKeyword && !isExpression(node); } function isNamespaceReference(node: Node): boolean {