@@ -1776,36 +1776,6 @@ namespace ts {
17761776 }
17771777 }
17781778
1779- export function getNameOfDeclaration ( declaration : Declaration ) : DeclarationName {
1780- if ( ! declaration ) {
1781- return undefined ;
1782- }
1783- if ( declaration . kind === SyntaxKind . BinaryExpression ) {
1784- const kind = getSpecialPropertyAssignmentKind ( declaration as BinaryExpression ) ;
1785- const lhs = ( declaration as BinaryExpression ) . left ;
1786- switch ( kind ) {
1787- case SpecialPropertyAssignmentKind . None :
1788- case SpecialPropertyAssignmentKind . ModuleExports :
1789- return undefined ;
1790- case SpecialPropertyAssignmentKind . ExportsProperty :
1791- if ( lhs . kind === SyntaxKind . Identifier ) {
1792- return ( lhs as PropertyAccessExpression ) . name ;
1793- }
1794- else {
1795- return ( ( lhs as PropertyAccessExpression ) . expression as PropertyAccessExpression ) . name ;
1796- }
1797- case SpecialPropertyAssignmentKind . ThisProperty :
1798- case SpecialPropertyAssignmentKind . Property :
1799- return ( lhs as PropertyAccessExpression ) . name ;
1800- case SpecialPropertyAssignmentKind . PrototypeProperty :
1801- return ( ( lhs as PropertyAccessExpression ) . expression as PropertyAccessExpression ) . name ;
1802- }
1803- }
1804- else {
1805- return ( declaration as NamedDeclaration ) . name ;
1806- }
1807- }
1808-
18091779 export function isLiteralComputedPropertyDeclarationName ( node : Node ) {
18101780 return ( node . kind === SyntaxKind . StringLiteral || node . kind === SyntaxKind . NumericLiteral ) &&
18111781 node . parent . kind === SyntaxKind . ComputedPropertyName &&
@@ -4729,4 +4699,34 @@ namespace ts {
47294699 export function unescapeIdentifier ( identifier : string ) : string {
47304700 return identifier . length >= 3 && identifier . charCodeAt ( 0 ) === CharacterCodes . _ && identifier . charCodeAt ( 1 ) === CharacterCodes . _ && identifier . charCodeAt ( 2 ) === CharacterCodes . _ ? identifier . substr ( 1 ) : identifier ;
47314701 }
4702+
4703+ export function getNameOfDeclaration ( declaration : Declaration ) : DeclarationName {
4704+ if ( ! declaration ) {
4705+ return undefined ;
4706+ }
4707+ 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 ;
4714+ case SpecialPropertyAssignmentKind . ExportsProperty :
4715+ if ( lhs . kind === SyntaxKind . Identifier ) {
4716+ return ( lhs as PropertyAccessExpression ) . name ;
4717+ }
4718+ else {
4719+ return ( ( lhs as PropertyAccessExpression ) . expression as PropertyAccessExpression ) . name ;
4720+ }
4721+ case SpecialPropertyAssignmentKind . ThisProperty :
4722+ case SpecialPropertyAssignmentKind . Property :
4723+ return ( lhs as PropertyAccessExpression ) . name ;
4724+ case SpecialPropertyAssignmentKind . PrototypeProperty :
4725+ return ( ( lhs as PropertyAccessExpression ) . expression as PropertyAccessExpression ) . name ;
4726+ }
4727+ }
4728+ else {
4729+ return ( declaration as NamedDeclaration ) . name ;
4730+ }
4731+ }
47324732}
0 commit comments