MCPcopy Create free account
hub / github.com/nodejs/node / getBinderAndCheckerDiagnosticsOfFile

Function getBinderAndCheckerDiagnosticsOfFile

test/fixtures/snapshot/typescript.js:120538–120553  ·  view source on GitHub ↗

* Gets the binder and checker diagnostics either from cache if present, or otherwise from program and caches it * Note that it is assumed that when asked about binder and checker diagnostics, the file has been taken out of affected files/changed file set

(state, sourceFile, cancellationToken)

Source from the content-addressed store, hash-verified

120536 * Note that it is assumed that when asked about binder and checker diagnostics, the file has been taken out of affected files/changed file set
120537 */
120538 function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken) {
120539 var path = sourceFile.resolvedPath;
120540 if (state.semanticDiagnosticsPerFile) {
120541 var cachedDiagnostics = state.semanticDiagnosticsPerFile.get(path);
120542 // Report the bind and check diagnostics from the cache if we already have those diagnostics present
120543 if (cachedDiagnostics) {
120544 return ts.filterSemanticDiagnostics(cachedDiagnostics, state.compilerOptions);
120545 }
120546 }
120547 // Diagnostics werent cached, get them from program, and cache the result
120548 var diagnostics = ts.Debug.checkDefined(state.program).getBindAndCheckDiagnostics(sourceFile, cancellationToken);
120549 if (state.semanticDiagnosticsPerFile) {
120550 state.semanticDiagnosticsPerFile.set(path, diagnostics);
120551 }
120552 return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
120553 }
120554 /**
120555 * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120556 */

Callers 1

Calls 2

getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected