Skip to content

Commit 4c1b031

Browse files
committed
Make getSymbolAtLocation support class expressions
and parenthesized expressions
1 parent 6ef2904 commit 4c1b031

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43017,6 +43017,8 @@ namespace ts {
4301743017
case SyntaxKind.EqualsGreaterThanToken:
4301843018
case SyntaxKind.ClassKeyword:
4301943019
return getSymbolOfNode(node.parent);
43020+
case SyntaxKind.ClassExpression:
43021+
return node.symbol;
4302043022
case SyntaxKind.ImportType:
4302143023
return isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : undefined;
4302243024

@@ -43028,7 +43030,8 @@ namespace ts {
4302843030
return isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : undefined;
4302943031
case SyntaxKind.MetaProperty:
4303043032
return checkExpression(node as Expression).symbol;
43031-
43033+
case SyntaxKind.ParenthesizedExpression:
43034+
return getSymbolAtLocation((node as ParenthesizedExpression).expression, ignoreErrors);
4303243035
default:
4303343036
return undefined;
4303443037
}

src/services/goToDefinition.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ namespace ts.GoToDefinition {
172172

173173
const baseTypeNode = getEffectiveBaseTypeNode(baseDeclaration);
174174
if (!baseTypeNode) return;
175-
const expression = skipParentheses(baseTypeNode.expression);
176-
const base = isClassExpression(expression) ? expression.symbol : typeChecker.getSymbolAtLocation(expression);
175+
const base = typeChecker.getSymbolAtLocation(baseTypeNode.expression);
177176
if (!base) return;
178177

179178
const name = unescapeLeadingUnderscores(getTextOfPropertyName(classElement.name));

0 commit comments

Comments
 (0)