MCPcopy Index your code
hub / github.com/nodejs/node / checkUnusedIdentifiers

Function checkUnusedIdentifiers

test/fixtures/snapshot/typescript.js:81948–81994  ·  view source on GitHub ↗
(potentiallyUnusedIdentifiers, addDiagnostic)

Source from the content-addressed store, hash-verified

81946 }
81947 }
81948 function checkUnusedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic) {
81949 for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) {
81950 var node = potentiallyUnusedIdentifiers_1[_i];
81951 switch (node.kind) {
81952 case 257 /* SyntaxKind.ClassDeclaration */:
81953 case 226 /* SyntaxKind.ClassExpression */:
81954 checkUnusedClassMembers(node, addDiagnostic);
81955 checkUnusedTypeParameters(node, addDiagnostic);
81956 break;
81957 case 305 /* SyntaxKind.SourceFile */:
81958 case 261 /* SyntaxKind.ModuleDeclaration */:
81959 case 235 /* SyntaxKind.Block */:
81960 case 263 /* SyntaxKind.CaseBlock */:
81961 case 242 /* SyntaxKind.ForStatement */:
81962 case 243 /* SyntaxKind.ForInStatement */:
81963 case 244 /* SyntaxKind.ForOfStatement */:
81964 checkUnusedLocalsAndParameters(node, addDiagnostic);
81965 break;
81966 case 171 /* SyntaxKind.Constructor */:
81967 case 213 /* SyntaxKind.FunctionExpression */:
81968 case 256 /* SyntaxKind.FunctionDeclaration */:
81969 case 214 /* SyntaxKind.ArrowFunction */:
81970 case 169 /* SyntaxKind.MethodDeclaration */:
81971 case 172 /* SyntaxKind.GetAccessor */:
81972 case 173 /* SyntaxKind.SetAccessor */:
81973 if (node.body) { // Don't report unused parameters in overloads
81974 checkUnusedLocalsAndParameters(node, addDiagnostic);
81975 }
81976 checkUnusedTypeParameters(node, addDiagnostic);
81977 break;
81978 case 168 /* SyntaxKind.MethodSignature */:
81979 case 174 /* SyntaxKind.CallSignature */:
81980 case 175 /* SyntaxKind.ConstructSignature */:
81981 case 179 /* SyntaxKind.FunctionType */:
81982 case 180 /* SyntaxKind.ConstructorType */:
81983 case 259 /* SyntaxKind.TypeAliasDeclaration */:
81984 case 258 /* SyntaxKind.InterfaceDeclaration */:
81985 checkUnusedTypeParameters(node, addDiagnostic);
81986 break;
81987 case 190 /* SyntaxKind.InferType */:
81988 checkUnusedInferTypeParameter(node, addDiagnostic);
81989 break;
81990 default:
81991 ts.Debug.assertNever(node, "Node should not have been registered for unused identifiers check");
81992 }
81993 }
81994 }
81995 function errorUnusedLocal(declaration, name, addDiagnostic) {
81996 var node = ts.getNameOfDeclaration(declaration) || declaration;
81997 var message = isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read;

Callers 2

createTypeCheckerFunction · 0.85
checkSourceFileWorkerFunction · 0.85

Tested by

no test coverage detected