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

Function add

test/fixtures/snapshot/typescript.js:18029–18048  ·  view source on GitHub ↗
(diagnostic)

Source from the content-addressed store, hash-verified

18027 return undefined;
18028 }
18029 function add(diagnostic) {
18030 var diagnostics;
18031 if (diagnostic.file) {
18032 diagnostics = fileDiagnostics.get(diagnostic.file.fileName);
18033 if (!diagnostics) {
18034 diagnostics = []; // See GH#19873
18035 fileDiagnostics.set(diagnostic.file.fileName, diagnostics);
18036 ts.insertSorted(filesWithDiagnostics, diagnostic.file.fileName, ts.compareStringsCaseSensitive);
18037 }
18038 }
18039 else {
18040 // If we've already read the non-file diagnostics, do not modify the existing array.
18041 if (hasReadNonFileDiagnostics) {
18042 hasReadNonFileDiagnostics = false;
18043 nonFileDiagnostics = nonFileDiagnostics.slice();
18044 }
18045 diagnostics = nonFileDiagnostics;
18046 }
18047 ts.insertSorted(diagnostics, diagnostic, compareDiagnostics);
18048 }
18049 function getGlobalDiagnostics() {
18050 hasReadNonFileDiagnostics = true;
18051 return nonFileDiagnostics;

Calls 3

getMethod · 0.65
sliceMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected