Skip to content

Commit f0b3ff1

Browse files
committed
Merge pull request #7532 from Microsoft/declarationEmitFixes2
Remove members from getAccessibleSymbolChain walk
2 parents 51e8f7d + 59f4687 commit f0b3ff1

File tree

1,194 files changed

+7253
-6911
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,194 files changed

+7253
-6911
lines changed

src/compiler/checker.ts

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,12 +1444,6 @@ namespace ts {
14441444
return result;
14451445
}
14461446
break;
1447-
case SyntaxKind.ClassDeclaration:
1448-
case SyntaxKind.InterfaceDeclaration:
1449-
if (result = callback(getSymbolOfNode(location).members)) {
1450-
return result;
1451-
}
1452-
break;
14531447
}
14541448
}
14551449

@@ -1515,7 +1509,9 @@ namespace ts {
15151509
}
15161510

15171511
if (symbol) {
1518-
return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable);
1512+
if (!(isPropertyOrMethodDeclarationSymbol(symbol))) {
1513+
return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable);
1514+
}
15191515
}
15201516
}
15211517

@@ -1548,6 +1544,24 @@ namespace ts {
15481544
return qualify;
15491545
}
15501546

1547+
function isPropertyOrMethodDeclarationSymbol(symbol: Symbol) {
1548+
if (symbol.declarations && symbol.declarations.length) {
1549+
for (const declaration of symbol.declarations) {
1550+
switch (declaration.kind) {
1551+
case SyntaxKind.PropertyDeclaration:
1552+
case SyntaxKind.MethodDeclaration:
1553+
case SyntaxKind.GetAccessor:
1554+
case SyntaxKind.SetAccessor:
1555+
continue;
1556+
default:
1557+
return false;
1558+
}
1559+
}
1560+
return true;
1561+
}
1562+
return false;
1563+
}
1564+
15511565
function isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessibilityResult {
15521566
if (symbol && enclosingDeclaration && !(symbol.flags & SymbolFlags.TypeParameter)) {
15531567
const initialSymbol = symbol;

tests/baselines/reference/1.0lib-noErrors.symbols

Lines changed: 188 additions & 188 deletions
Large diffs are not rendered by default.

tests/baselines/reference/2dArrays.symbols

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@ class Ship {
77
>Ship : Symbol(Ship, Decl(2dArrays.ts, 1, 1))
88

99
isSunk: boolean;
10-
>isSunk : Symbol(isSunk, Decl(2dArrays.ts, 3, 12))
10+
>isSunk : Symbol(Ship.isSunk, Decl(2dArrays.ts, 3, 12))
1111
}
1212

1313
class Board {
1414
>Board : Symbol(Board, Decl(2dArrays.ts, 5, 1))
1515

1616
ships: Ship[];
17-
>ships : Symbol(ships, Decl(2dArrays.ts, 7, 13))
17+
>ships : Symbol(Board.ships, Decl(2dArrays.ts, 7, 13))
1818
>Ship : Symbol(Ship, Decl(2dArrays.ts, 1, 1))
1919

2020
cells: Cell[];
21-
>cells : Symbol(cells, Decl(2dArrays.ts, 8, 18))
21+
>cells : Symbol(Board.cells, Decl(2dArrays.ts, 8, 18))
2222
>Cell : Symbol(Cell, Decl(2dArrays.ts, 0, 0))
2323

2424
private allShipsSunk() {
25-
>allShipsSunk : Symbol(allShipsSunk, Decl(2dArrays.ts, 9, 18))
25+
>allShipsSunk : Symbol(Board.allShipsSunk, Decl(2dArrays.ts, 9, 18))
2626

2727
return this.ships.every(function (val) { return val.isSunk; });
2828
>this.ships.every : Symbol(Array.every, Decl(lib.d.ts, --, --))
29-
>this.ships : Symbol(ships, Decl(2dArrays.ts, 7, 13))
29+
>this.ships : Symbol(Board.ships, Decl(2dArrays.ts, 7, 13))
3030
>this : Symbol(Board, Decl(2dArrays.ts, 5, 1))
31-
>ships : Symbol(ships, Decl(2dArrays.ts, 7, 13))
31+
>ships : Symbol(Board.ships, Decl(2dArrays.ts, 7, 13))
3232
>every : Symbol(Array.every, Decl(lib.d.ts, --, --))
3333
>val : Symbol(val, Decl(2dArrays.ts, 12, 42))
3434
>val.isSunk : Symbol(Ship.isSunk, Decl(2dArrays.ts, 3, 12))

tests/baselines/reference/AmbientModuleAndAmbientWithSameNameAndCommonRoot.symbols

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ declare module A {
2929
>y : Symbol(y, Decl(class.d.ts, 2, 30))
3030

3131
x: number;
32-
>x : Symbol(x, Decl(class.d.ts, 2, 42))
32+
>x : Symbol(Point.x, Decl(class.d.ts, 2, 42))
3333

3434
y: number;
35-
>y : Symbol(y, Decl(class.d.ts, 3, 18))
35+
>y : Symbol(Point.y, Decl(class.d.ts, 3, 18))
3636
}
3737
}
3838

tests/baselines/reference/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.symbols

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ module A {
2525
>Point : Symbol(Point, Decl(module.d.ts, 0, 18), Decl(classPoint.ts, 0, 10))
2626

2727
constructor(public x: number, public y: number) { }
28-
>x : Symbol(x, Decl(classPoint.ts, 2, 20))
29-
>y : Symbol(y, Decl(classPoint.ts, 2, 37))
28+
>x : Symbol(Point.x, Decl(classPoint.ts, 2, 20))
29+
>y : Symbol(Point.y, Decl(classPoint.ts, 2, 37))
3030
}
3131
}
3232

tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.symbols

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ class Point {
33
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 4, 1))
44

55
constructor(public x: number, public y: number) { }
6-
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 1, 16))
7-
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 1, 33))
6+
>x : Symbol(Point.x, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 1, 16))
7+
>y : Symbol(Point.y, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 1, 33))
88

99
static Origin(): Point { return { x: 0, y: 0 }; }
1010
>Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 1, 55))
@@ -28,8 +28,8 @@ module A {
2828
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 11, 10), Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 16, 5))
2929

3030
constructor(public x: number, public y: number) { }
31-
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 13, 20))
32-
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 13, 37))
31+
>x : Symbol(Point.x, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 13, 20))
32+
>y : Symbol(Point.y, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 13, 37))
3333

3434
static Origin(): Point { return { x: 0, y: 0 }; }
3535
>Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 13, 59))

tests/baselines/reference/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.symbols

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ class Point {
33
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 4, 1))
44

55
constructor(public x: number, public y: number) { }
6-
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 1, 16))
7-
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 1, 33))
6+
>x : Symbol(Point.x, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 1, 16))
7+
>y : Symbol(Point.y, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 1, 33))
88

99
static Origin: Point = { x: 0, y: 0 };
1010
>Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 1, 55))
@@ -28,8 +28,8 @@ module A {
2828
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 11, 10), Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 16, 5))
2929

3030
constructor(public x: number, public y: number) { }
31-
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 13, 20))
32-
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 13, 37))
31+
>x : Symbol(Point.x, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 13, 20))
32+
>y : Symbol(Point.y, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 13, 37))
3333

3434
static Origin: Point = { x: 0, y: 0 };
3535
>Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 13, 59))

tests/baselines/reference/ClassDeclarationWithInvalidConstOnPropertyDeclaration2.symbols

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ class C {
33
>C : Symbol(C, Decl(ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts, 0, 0))
44

55
const
6-
>const : Symbol(const, Decl(ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts, 0, 9))
6+
>const : Symbol(C.const, Decl(ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts, 0, 9))
77

88
x = 10;
9-
>x : Symbol(x, Decl(ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts, 1, 9))
9+
>x : Symbol(C.x, Decl(ClassDeclarationWithInvalidConstOnPropertyDeclaration2.ts, 1, 9))
1010
}

tests/baselines/reference/EnumAndModuleWithSameNameAndCommonRoot.symbols

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ module enumdule {
1414
>Point : Symbol(Point, Decl(EnumAndModuleWithSameNameAndCommonRoot.ts, 4, 17))
1515

1616
constructor(public x: number, public y: number) { }
17-
>x : Symbol(x, Decl(EnumAndModuleWithSameNameAndCommonRoot.ts, 7, 20))
18-
>y : Symbol(y, Decl(EnumAndModuleWithSameNameAndCommonRoot.ts, 7, 37))
17+
>x : Symbol(Point.x, Decl(EnumAndModuleWithSameNameAndCommonRoot.ts, 7, 20))
18+
>y : Symbol(Point.y, Decl(EnumAndModuleWithSameNameAndCommonRoot.ts, 7, 37))
1919
}
2020
}
2121

tests/baselines/reference/ExportClassWhichExtendsInterfaceWithInaccessibleType.symbols

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ module A {
66
>Point : Symbol(Point, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 0, 10))
77

88
x: number;
9-
>x : Symbol(x, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 2, 21))
9+
>x : Symbol(Point.x, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 2, 21))
1010

1111
y: number;
12-
>y : Symbol(y, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 3, 18))
12+
>y : Symbol(Point.y, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 3, 18))
1313

1414
fromOrigin(p: Point): number;
15-
>fromOrigin : Symbol(fromOrigin, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 4, 18))
15+
>fromOrigin : Symbol(Point.fromOrigin, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 4, 18))
1616
>p : Symbol(p, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 6, 19))
1717
>Point : Symbol(Point, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 0, 10))
1818
}
@@ -22,11 +22,11 @@ module A {
2222
>Point : Symbol(Point, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 0, 10))
2323

2424
constructor(public x: number, public y: number) { }
25-
>x : Symbol(x, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 10, 20))
26-
>y : Symbol(y, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 10, 37))
25+
>x : Symbol(Point2d.x, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 10, 20))
26+
>y : Symbol(Point2d.y, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 10, 37))
2727

2828
fromOrigin(p: Point) {
29-
>fromOrigin : Symbol(fromOrigin, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 10, 59))
29+
>fromOrigin : Symbol(Point2d.fromOrigin, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 10, 59))
3030
>p : Symbol(p, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 12, 19))
3131
>Point : Symbol(Point, Decl(ExportClassWhichExtendsInterfaceWithInaccessibleType.ts, 0, 10))
3232

0 commit comments

Comments
 (0)