Fixed findAllRefs/getOccs bug where private properties declared in the constructor were only local to the constructor.

Fixes #975.
This commit is contained in:
Daniel Rosenwasser 2014-10-27 18:08:49 -07:00
parent 20392de6ef
commit e3d82b7db3
3 changed files with 20 additions and 2 deletions

View File

@ -766,7 +766,7 @@ module ts {
}
export enum SymbolFlags {
FunctionScopedVariable = 0x00000001, // Variable (var) or parameter
FunctionScopedVariable = 0x00000001, // Variable (var) or parameter
Property = 0x00000002, // Property or enum member
EnumMember = 0x00000004, // Enum member
Function = 0x00000008, // Function

View File

@ -3836,7 +3836,7 @@ module ts {
if (symbol.getFlags() && (SymbolFlags.Property | SymbolFlags.Method)) {
var privateDeclaration = forEach(symbol.getDeclarations(), d => (d.flags & NodeFlags.Private) ? d : undefined);
if (privateDeclaration) {
return privateDeclaration.parent;
return getAncestor(privateDeclaration, SyntaxKind.ClassDeclaration);
}
}

View File

@ -0,0 +1,18 @@
/// <reference path="fourslash.ts" />
////class ABCD {
//// constructor(private x: number, public y: number, private [|z|]: number) {
//// }
////
//// func() {
//// return this.[|z|];
//// }
////}
test.ranges().forEach(r => {
goTo.position(r.start);
test.ranges().forEach(range => {
verify.referencesAtPositionContains(range);
});
});