diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 9ce8b4f4eda..b63348bfb60 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1444,7 +1444,7 @@ namespace ts { // If this is a property-parameter, then also declare the property symbol into the // containing class. - if (isPropertyParameterDeclaration(node)) { + if (isParameterPropertyDeclaration(node)) { const classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes); } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a2338c5ba5b..9d14bb39206 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -67,7 +67,7 @@ namespace ts { // The language service will always care about the narrowed type of a symbol, because that is // the type the language says the symbol should have. getTypeOfSymbolAtLocation: getNarrowedTypeOfSymbol, - getSymbolOfParameterPropertyDeclaration, + getSymbolsOfParameterPropertyDeclaration, getDeclaredTypeOfSymbol, getPropertiesOfType, getPropertyOfType, @@ -435,7 +435,7 @@ namespace ts { * @param parameterName a name of the parameter to get the symbols for. * @return a tuple of two symbols */ - function getSymbolOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): [Symbol, Symbol] { + function getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): [Symbol, Symbol] { const constructoDeclaration = parameter.parent; const classDeclaration = parameter.parent.parent; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 4c1fb2bb1cd..ad446792f04 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1723,7 +1723,7 @@ namespace ts { getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolAtLocation(node: Node): Symbol; - getSymbolOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; + getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; getShorthandAssignmentValueSymbol(location: Node): Symbol; getTypeAtLocation(node: Node): Type; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 566a578cedf..384f27c8868 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -2742,9 +2742,7 @@ namespace ts { } } - export function isPropertyParameterDeclaration(node: ParameterDeclaration): boolean { - // If this is a property-parameter, then also declare the property symbol into the - // containing class. + export function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean { return node.flags & NodeFlags.AccessibilityModifier && node.parent.kind === SyntaxKind.Constructor && isClassLike(node.parent.parent); } } diff --git a/src/services/services.ts b/src/services/services.ts index 6728c0d5ebc..8e2e4913edd 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -5972,8 +5972,8 @@ namespace ts { // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in contructor.locals. // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members if (symbol.valueDeclaration && symbol.valueDeclaration.kind === SyntaxKind.Parameter && - isPropertyParameterDeclaration(symbol.valueDeclaration)) { - result = result.concat(typeChecker.getSymbolOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); + isParameterPropertyDeclaration(symbol.valueDeclaration)) { + result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); } // If this is a union property, add all the symbols from all its source symbols in all unioned types. diff --git a/tests/cases/fourslash/documentHighlightAtParameterPropertyDeclaration2.ts b/tests/cases/fourslash/documentHighlightAtParameterPropertyDeclaration2.ts index 2658dd56371..f5d6764205b 100644 --- a/tests/cases/fourslash/documentHighlightAtParameterPropertyDeclaration2.ts +++ b/tests/cases/fourslash/documentHighlightAtParameterPropertyDeclaration2.ts @@ -20,5 +20,5 @@ let markers = test.markers() for (let marker of markers) { goTo.position(marker.position); - verify.documentHighlightsAtPositionCount(3, ["file1.ts"]); + verify.documentHighlightsAtPositionCount(2, ["file1.ts"]); } \ No newline at end of file