@@ -1376,15 +1376,13 @@ namespace ts.FindAllReferences.Core {
1376
1376
const result : Symbol [ ] = [ ] ;
1377
1377
forEachRelatedSymbol < void > ( symbol , location , checker ,
1378
1378
( sym , root , base ) => { result . push ( base || root || sym ) ; } ,
1379
- parameterProperties => { result . push ( ...parameterProperties ) ; } ,
1380
1379
/*allowBaseTypes*/ ( ) => ! implementations ) ;
1381
1380
return result ;
1382
1381
}
1383
1382
1384
1383
function forEachRelatedSymbol < T > (
1385
1384
symbol : Symbol , location : Node , checker : TypeChecker ,
1386
1385
cbSymbol : ( symbol : Symbol , rootSymbol ?: Symbol , baseSymbol ?: Symbol ) => T | undefined ,
1387
- cbParameterProperties : ( s : Symbol [ ] ) => T | undefined ,
1388
1386
allowBaseTypes : ( rootSymbol : Symbol ) => boolean ,
1389
1387
) : T | undefined {
1390
1388
const containingObjectLiteralElement = getContainingObjectLiteralElement ( location ) ;
@@ -1421,14 +1419,11 @@ namespace ts.FindAllReferences.Core {
1421
1419
const res = fromRoot ( symbol ) ;
1422
1420
if ( res ) return res ;
1423
1421
1424
- // If the symbol.valueDeclaration is a property parameter declaration,
1425
- // we should include both parameter declaration symbol and property declaration symbol
1426
- // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals.
1427
- // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members
1428
- if ( symbol . valueDeclaration && isParameter ( symbol . valueDeclaration ) && isParameterPropertyDeclaration ( symbol . valueDeclaration ) ) {
1429
- const paramProps = checker . getSymbolsOfParameterPropertyDeclaration ( symbol . valueDeclaration , symbol . name ) ;
1430
- const res = paramProps && cbParameterProperties ( paramProps ) ;
1431
- if ( res ) return res ;
1422
+ if ( symbol . valueDeclaration && isParameterPropertyDeclaration ( symbol . valueDeclaration ) ) {
1423
+ // For a parameter property, now try on the other symbol (property if this was a parameter, parameter if this was a property).
1424
+ const paramProps = checker . getSymbolsOfParameterPropertyDeclaration ( cast ( symbol . valueDeclaration , isParameter ) , symbol . name ) ;
1425
+ Debug . assert ( paramProps . length === 2 && ! ! ( paramProps [ 0 ] . flags & SymbolFlags . FunctionScopedVariable ) && ! ! ( paramProps [ 1 ] . flags & SymbolFlags . Property ) ) ; // is [parameter, property]
1426
+ return fromRoot ( symbol . flags & SymbolFlags . FunctionScopedVariable ? paramProps [ 1 ] : paramProps [ 0 ] ) ;
1432
1427
}
1433
1428
1434
1429
// If this is symbol of binding element without propertyName declaration in Object binding pattern
@@ -1487,9 +1482,6 @@ namespace ts.FindAllReferences.Core {
1487
1482
// For a base type, use the symbol for the derived type. For a synthetic (e.g. union) property, use the union symbol.
1488
1483
? rootSymbol && ! ( getCheckFlags ( sym ) & CheckFlags . Synthetic ) ? rootSymbol : sym
1489
1484
: undefined ,
1490
- paramProps => referenceSymbol . flags & SymbolFlags . FunctionScopedVariable
1491
- ? getRelatedSymbol ( search , find ( paramProps , x => ! ! ( x . flags & SymbolFlags . Property ) ) ! , referenceLocation , state )
1492
- : undefined ,
1493
1485
/*allowBaseTypes*/ rootSymbol =>
1494
1486
! ( search . parents && ! some ( search . parents , parent => explicitlyInheritsFrom ( rootSymbol . parent , parent , state . inheritsFromCache , checker ) ) ) ) ;
1495
1487
}
0 commit comments