Skip to content

Commit 3c6393a

Browse files
committed
More fix+cleanup in getNameOfDeclaration
1 parent c70fa1e commit 3c6393a

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/compiler/utilities.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4705,18 +4705,15 @@ namespace ts {
47054705
return undefined;
47064706
}
47074707
if (declaration.kind === SyntaxKind.BinaryExpression) {
4708-
const kind = getSpecialPropertyAssignmentKind(declaration as BinaryExpression);
4709-
const lhs = (declaration as BinaryExpression).left;
4710-
switch (kind) {
4711-
case SpecialPropertyAssignmentKind.None:
4712-
case SpecialPropertyAssignmentKind.ModuleExports:
4713-
return undefined;
4708+
const expr = declaration as BinaryExpression;
4709+
switch (getSpecialPropertyAssignmentKind(expr)) {
47144710
case SpecialPropertyAssignmentKind.ExportsProperty:
47154711
case SpecialPropertyAssignmentKind.ThisProperty:
47164712
case SpecialPropertyAssignmentKind.Property:
4717-
return (lhs as PropertyAccessExpression).name;
47184713
case SpecialPropertyAssignmentKind.PrototypeProperty:
4719-
return ((lhs as PropertyAccessExpression).expression as PropertyAccessExpression).name;
4714+
return (expr.left as PropertyAccessExpression).name;
4715+
default:
4716+
return undefined;
47204717
}
47214718
}
47224719
else {

0 commit comments

Comments
 (0)