(node)
| 85940 | } |
| 85941 | // Fully type check a source file and collect the relevant diagnostics. |
| 85942 | function checkSourceFileWorker(node) { |
| 85943 | var links = getNodeLinks(node); |
| 85944 | if (!(links.flags & 1 /* NodeCheckFlags.TypeChecked */)) { |
| 85945 | if (ts.skipTypeChecking(node, compilerOptions, host)) { |
| 85946 | return; |
| 85947 | } |
| 85948 | // Grammar checking |
| 85949 | checkGrammarSourceFile(node); |
| 85950 | ts.clear(potentialThisCollisions); |
| 85951 | ts.clear(potentialNewTargetCollisions); |
| 85952 | ts.clear(potentialWeakMapSetCollisions); |
| 85953 | ts.clear(potentialReflectCollisions); |
| 85954 | ts.forEach(node.statements, checkSourceElement); |
| 85955 | checkSourceElement(node.endOfFileToken); |
| 85956 | checkDeferredNodes(node); |
| 85957 | if (ts.isExternalOrCommonJsModule(node)) { |
| 85958 | registerForUnusedIdentifiersCheck(node); |
| 85959 | } |
| 85960 | addLazyDiagnostic(function () { |
| 85961 | // This relies on the results of other lazy diagnostics, so must be computed after them |
| 85962 | if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) { |
| 85963 | checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), function (containingNode, kind, diag) { |
| 85964 | if (!ts.containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 16777216 /* NodeFlags.Ambient */))) { |
| 85965 | diagnostics.add(diag); |
| 85966 | } |
| 85967 | }); |
| 85968 | } |
| 85969 | }); |
| 85970 | if (compilerOptions.importsNotUsedAsValues === 2 /* ImportsNotUsedAsValues.Error */ && |
| 85971 | !node.isDeclarationFile && |
| 85972 | ts.isExternalModule(node)) { |
| 85973 | checkImportsForTypeOnlyConversion(node); |
| 85974 | } |
| 85975 | if (ts.isExternalOrCommonJsModule(node)) { |
| 85976 | checkExternalModuleExports(node); |
| 85977 | } |
| 85978 | if (potentialThisCollisions.length) { |
| 85979 | ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); |
| 85980 | ts.clear(potentialThisCollisions); |
| 85981 | } |
| 85982 | if (potentialNewTargetCollisions.length) { |
| 85983 | ts.forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope); |
| 85984 | ts.clear(potentialNewTargetCollisions); |
| 85985 | } |
| 85986 | if (potentialWeakMapSetCollisions.length) { |
| 85987 | ts.forEach(potentialWeakMapSetCollisions, checkWeakMapSetCollision); |
| 85988 | ts.clear(potentialWeakMapSetCollisions); |
| 85989 | } |
| 85990 | if (potentialReflectCollisions.length) { |
| 85991 | ts.forEach(potentialReflectCollisions, checkReflectCollision); |
| 85992 | ts.clear(potentialReflectCollisions); |
| 85993 | } |
| 85994 | links.flags |= 1 /* NodeCheckFlags.TypeChecked */; |
| 85995 | } |
| 85996 | } |
| 85997 | function getDiagnostics(sourceFile, ct) { |
| 85998 | try { |
| 85999 | // Record the cancellation token so it can be checked later on during checkSourceElement. |
no test coverage detected
searching dependent graphs…