Skip to content

Commit d865ea7

Browse files
ajafffRyanCavanaugh
authored andcommitted
resolveName: remove useless case (microsoft#28669)
PropertySignature cannot occur in a class. The condition inside the clause required the parent to be a class, so it was never true. This removes the case clause and the part of the condition that is now useless.
1 parent f9d12ed commit d865ea7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,15 +1409,14 @@ namespace ts {
14091409
}
14101410
break;
14111411
case SyntaxKind.PropertyDeclaration:
1412-
case SyntaxKind.PropertySignature:
14131412
// TypeScript 1.0 spec (April 2014): 8.4.1
14141413
// Initializer expressions for instance member variables are evaluated in the scope
14151414
// of the class constructor body but are not permitted to reference parameters or
14161415
// local variables of the constructor. This effectively means that entities from outer scopes
14171416
// by the same name as a constructor parameter or local variable are inaccessible
14181417
// in initializer expressions for instance member variables.
1419-
if (isClassLike(location.parent) && !hasModifier(location, ModifierFlags.Static)) {
1420-
const ctor = findConstructorDeclaration(location.parent);
1418+
if (!hasModifier(location, ModifierFlags.Static)) {
1419+
const ctor = findConstructorDeclaration(location.parent as ClassLikeDeclaration);
14211420
if (ctor && ctor.locals) {
14221421
if (lookup(ctor.locals, name, meaning & SymbolFlags.Value)) {
14231422
// Remember the property node, it will be used later to report appropriate error

0 commit comments

Comments
 (0)