@@ -993,9 +993,11 @@ module ts {
993
993
// This is for caching the result of getSymbolDisplayBuilder. Do not access directly.
994
994
var _displayBuilder : SymbolDisplayBuilder ;
995
995
function getSymbolDisplayBuilder ( ) : SymbolDisplayBuilder {
996
- // Enclosing declaration is optional when we don't want to get qualified name in the enclosing declaration scope
997
- // Meaning needs to be specified if the enclosing declaration is given
998
- function buildPlainSymbolName ( symbol : Symbol , writer : SymbolWriter ) : void {
996
+ /**
997
+ * Writes only the name of the symbol out to the writer. Uses the original source text
998
+ * for the name of the symbol if it is available to match how the user inputted the name.
999
+ */
1000
+ function appendSymbolNameOnly ( symbol : Symbol , writer : SymbolWriter ) : void {
999
1001
if ( symbol . declarations && symbol . declarations . length > 0 ) {
1000
1002
var declaration = symbol . declarations [ 0 ] ;
1001
1003
if ( declaration . name ) {
@@ -1007,9 +1009,13 @@ module ts {
1007
1009
writer . writeSymbol ( symbol . name , symbol ) ;
1008
1010
}
1009
1011
1012
+ /**
1013
+ * Enclosing declaration is optional when we don't want to get qualified name in the enclosing declaration scope
1014
+ * Meaning needs to be specified if the enclosing declaration is given
1015
+ */
1010
1016
function buildSymbolDisplay ( symbol : Symbol , writer : SymbolWriter , enclosingDeclaration ?: Node , meaning ?: SymbolFlags , flags ?: SymbolFormatFlags ) : void {
1011
1017
var parentSymbol : Symbol ;
1012
- function appendSymbolName ( symbol : Symbol ) : void {
1018
+ function appendParentTypeArgumentsAndSymbolName ( symbol : Symbol ) : void {
1013
1019
if ( parentSymbol ) {
1014
1020
// Write type arguments of instantiated class/interface here
1015
1021
if ( flags & SymbolFormatFlags . WriteTypeParametersOrArguments ) {
@@ -1024,7 +1030,7 @@ module ts {
1024
1030
writePunctuation ( writer , SyntaxKind . DotToken ) ;
1025
1031
}
1026
1032
parentSymbol = symbol ;
1027
- buildPlainSymbolName ( symbol , writer ) ;
1033
+ appendSymbolNameOnly ( symbol , writer ) ;
1028
1034
}
1029
1035
1030
1036
// Let the writer know we just wrote out a symbol. The declaration emitter writer uses
@@ -1050,7 +1056,7 @@ module ts {
1050
1056
1051
1057
if ( accessibleSymbolChain ) {
1052
1058
for ( var i = 0 , n = accessibleSymbolChain . length ; i < n ; i ++ ) {
1053
- appendSymbolName ( accessibleSymbolChain [ i ] ) ;
1059
+ appendParentTypeArgumentsAndSymbolName ( accessibleSymbolChain [ i ] ) ;
1054
1060
}
1055
1061
}
1056
1062
else {
@@ -1064,7 +1070,7 @@ module ts {
1064
1070
return ;
1065
1071
}
1066
1072
1067
- appendSymbolName ( symbol ) ;
1073
+ appendParentTypeArgumentsAndSymbolName ( symbol ) ;
1068
1074
}
1069
1075
}
1070
1076
}
@@ -1078,7 +1084,7 @@ module ts {
1078
1084
return ;
1079
1085
}
1080
1086
1081
- return appendSymbolName ( symbol ) ;
1087
+ return appendParentTypeArgumentsAndSymbolName ( symbol ) ;
1082
1088
}
1083
1089
1084
1090
function buildTypeDisplay ( type : Type , writer : SymbolWriter , enclosingDeclaration ?: Node , flags ?: TypeFormatFlags , typeStack ?: Type [ ] ) {
@@ -1314,7 +1320,7 @@ module ts {
1314
1320
}
1315
1321
1316
1322
function buildTypeParameterDisplay ( tp : TypeParameter , writer : SymbolWriter , enclosingDeclaration ?: Node , flags ?: TypeFormatFlags , typeStack ?: Type [ ] ) {
1317
- buildPlainSymbolName ( tp . symbol , writer ) ;
1323
+ appendSymbolNameOnly ( tp . symbol , writer ) ;
1318
1324
var constraint = getConstraintOfTypeParameter ( tp ) ;
1319
1325
if ( constraint ) {
1320
1326
writeSpace ( writer ) ;
@@ -1328,7 +1334,7 @@ module ts {
1328
1334
if ( getDeclarationFlagsFromSymbol ( p ) & NodeFlags . Rest ) {
1329
1335
writePunctuation ( writer , SyntaxKind . DotDotDotToken ) ;
1330
1336
}
1331
- buildPlainSymbolName ( p , writer ) ;
1337
+ appendSymbolNameOnly ( p , writer ) ;
1332
1338
if ( p . valueDeclaration . flags & NodeFlags . QuestionMark || ( < VariableDeclaration > p . valueDeclaration ) . initializer ) {
1333
1339
writePunctuation ( writer , SyntaxKind . QuestionToken ) ;
1334
1340
}
0 commit comments