Improvements to checkUnusedIdentifiers (#19607)

This commit is contained in:
Andy
2017-11-06 10:59:39 -08:00
committed by GitHub
parent b5f4a83365
commit c4bf21b9cb

View File

@@ -20430,21 +20430,20 @@ namespace ts {
case SyntaxKind.MethodSignature:
case SyntaxKind.CallSignature:
case SyntaxKind.ConstructSignature:
case SyntaxKind.IndexSignature:
case SyntaxKind.FunctionType:
case SyntaxKind.ConstructorType:
checkUnusedTypeParameters(<FunctionLikeDeclaration>node);
break;
case SyntaxKind.TypeAliasDeclaration:
checkUnusedTypeParameters(<TypeAliasDeclaration>node);
checkUnusedTypeParameters(<MethodSignature | CallSignatureDeclaration | ConstructSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | TypeAliasDeclaration>node);
break;
default:
Debug.fail("Node should not have been registered for unused identifiers check");
}
}
}
}
function checkUnusedLocalsAndParameters(node: Node): void {
if (node.parent.kind !== SyntaxKind.InterfaceDeclaration && noUnusedIdentifiers && !(node.flags & NodeFlags.Ambient)) {
if (noUnusedIdentifiers && !(node.flags & NodeFlags.Ambient)) {
node.locals.forEach(local => {
if (!local.isReferenced) {
if (local.valueDeclaration && getRootDeclaration(local.valueDeclaration).kind === SyntaxKind.Parameter) {