Skip to content

Commit 3e89452

Browse files
Merge pull request #976 from Microsoft/privatePropertiesBeingTooPrivate
Fixed findAllRefs/getOccs bug where private properties declared in the constructor were only local to the constructor.
2 parents c28fb0e + e3d82b7 commit 3e89452

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ module ts {
766766
}
767767

768768
export enum SymbolFlags {
769-
FunctionScopedVariable = 0x00000001, // Variable (var) or parameter
769+
FunctionScopedVariable = 0x00000001, // Variable (var) or parameter
770770
Property = 0x00000002, // Property or enum member
771771
EnumMember = 0x00000004, // Enum member
772772
Function = 0x00000008, // Function

src/services/services.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3836,7 +3836,7 @@ module ts {
38363836
if (symbol.getFlags() && (SymbolFlags.Property | SymbolFlags.Method)) {
38373837
var privateDeclaration = forEach(symbol.getDeclarations(), d => (d.flags & NodeFlags.Private) ? d : undefined);
38383838
if (privateDeclaration) {
3839-
return privateDeclaration.parent;
3839+
return getAncestor(privateDeclaration, SyntaxKind.ClassDeclaration);
38403840
}
38413841
}
38423842

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
////class ABCD {
4+
//// constructor(private x: number, public y: number, private [|z|]: number) {
5+
//// }
6+
////
7+
//// func() {
8+
//// return this.[|z|];
9+
//// }
10+
////}
11+
12+
test.ranges().forEach(r => {
13+
goTo.position(r.start);
14+
15+
test.ranges().forEach(range => {
16+
verify.referencesAtPositionContains(range);
17+
});
18+
});

0 commit comments

Comments
 (0)