From 3c6393afe1b60cf10c6fef72cd39089e9f7927dc Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 19 May 2017 15:18:26 -0700 Subject: [PATCH] More fix+cleanup in getNameOfDeclaration --- src/compiler/utilities.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index aaf9fdd97f3..2a2fcd3820e 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4705,18 +4705,15 @@ namespace ts { return undefined; } if (declaration.kind === SyntaxKind.BinaryExpression) { - const kind = getSpecialPropertyAssignmentKind(declaration as BinaryExpression); - const lhs = (declaration as BinaryExpression).left; - switch (kind) { - case SpecialPropertyAssignmentKind.None: - case SpecialPropertyAssignmentKind.ModuleExports: - return undefined; + const expr = declaration as BinaryExpression; + switch (getSpecialPropertyAssignmentKind(expr)) { case SpecialPropertyAssignmentKind.ExportsProperty: case SpecialPropertyAssignmentKind.ThisProperty: case SpecialPropertyAssignmentKind.Property: - return (lhs as PropertyAccessExpression).name; case SpecialPropertyAssignmentKind.PrototypeProperty: - return ((lhs as PropertyAccessExpression).expression as PropertyAccessExpression).name; + return (expr.left as PropertyAccessExpression).name; + default: + return undefined; } } else {