@@ -410,13 +410,15 @@ namespace ts {
410410 * @param includes - The SymbolFlags that node has in addition to its declaration type (eg: export, ambient, etc.)
411411 * @param excludes - The flags which node cannot be declared alongside in a symbol table. Used to report forbidden declarations.
412412 */
413- function declareSymbol ( symbolTable : SymbolTable , parent : Symbol | undefined , node : Declaration , includes : SymbolFlags , excludes : SymbolFlags , isReplaceableByMethod ?: boolean ) : Symbol {
414- Debug . assert ( ! hasDynamicName ( node ) ) ;
413+ function declareSymbol ( symbolTable : SymbolTable , parent : Symbol | undefined , node : Declaration , includes : SymbolFlags , excludes : SymbolFlags , isReplaceableByMethod ?: boolean , isComputedName ?: boolean ) : Symbol {
414+ Debug . assert ( isComputedName || ! hasDynamicName ( node ) ) ;
415415
416416 const isDefaultExport = hasSyntacticModifier ( node , ModifierFlags . Default ) || isExportSpecifier ( node ) && node . name . escapedText === "default" ;
417417
418418 // The exported symbol for an export default function/class node is always named "default"
419- const name = isDefaultExport && parent ? InternalSymbolName . Default : getDeclarationName ( node ) ;
419+ const name = isComputedName ? InternalSymbolName . Computed
420+ : isDefaultExport && parent ? InternalSymbolName . Default
421+ : getDeclarationName ( node ) ;
420422
421423 let symbol : Symbol | undefined ;
422424 if ( name === undefined ) {
@@ -2929,7 +2931,7 @@ namespace ts {
29292931 constructorSymbol . members = constructorSymbol . members || createSymbolTable ( ) ;
29302932 // It's acceptable for multiple 'this' assignments of the same identifier to occur
29312933 if ( hasDynamicName ( node ) ) {
2932- bindDynamicallyNamedThisPropertyAssignment ( node , constructorSymbol ) ;
2934+ bindDynamicallyNamedThisPropertyAssignment ( node , constructorSymbol , constructorSymbol . members ) ;
29332935 }
29342936 else {
29352937 declareSymbol ( constructorSymbol . members , constructorSymbol , node , SymbolFlags . Property | SymbolFlags . Assignment , SymbolFlags . PropertyExcludes & ~ SymbolFlags . Property ) ;
@@ -2948,7 +2950,7 @@ namespace ts {
29482950 const containingClass = thisContainer . parent ;
29492951 const symbolTable = hasSyntacticModifier ( thisContainer , ModifierFlags . Static ) ? containingClass . symbol . exports ! : containingClass . symbol . members ! ;
29502952 if ( hasDynamicName ( node ) ) {
2951- bindDynamicallyNamedThisPropertyAssignment ( node , containingClass . symbol ) ;
2953+ bindDynamicallyNamedThisPropertyAssignment ( node , containingClass . symbol , symbolTable ) ;
29522954 }
29532955 else {
29542956 declareSymbol ( symbolTable , containingClass . symbol , node , SymbolFlags . Property | SymbolFlags . Assignment , SymbolFlags . None , /*isReplaceableByMethod*/ true ) ;
@@ -2972,8 +2974,8 @@ namespace ts {
29722974 }
29732975 }
29742976
2975- function bindDynamicallyNamedThisPropertyAssignment ( node : BinaryExpression | DynamicNamedDeclaration , symbol : Symbol ) {
2976- bindAnonymousDeclaration ( node , SymbolFlags . Property , InternalSymbolName . Computed ) ;
2977+ function bindDynamicallyNamedThisPropertyAssignment ( node : BinaryExpression | DynamicNamedDeclaration , symbol : Symbol , symbolTable : SymbolTable ) {
2978+ declareSymbol ( symbolTable , symbol , node , SymbolFlags . Property , SymbolFlags . None , /*isReplaceableByMethod*/ true , /*isComputedName*/ true ) ;
29772979 addLateBoundAssignmentDeclarationToSymbol ( node , symbol ) ;
29782980 }
29792981
0 commit comments