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

Function checkForClassificationCancellation

test/fixtures/snapshot/typescript.js:130371–130392  ·  view source on GitHub ↗
(cancellationToken, kind)

Source from the content-addressed store, hash-verified

130369 }
130370 ts.getSemanticClassifications = getSemanticClassifications;
130371 function checkForClassificationCancellation(cancellationToken, kind) {
130372 // We don't want to actually call back into our host on every node to find out if we've
130373 // been canceled. That would be an enormous amount of chattyness, along with the all
130374 // the overhead of marshalling the data to/from the host. So instead we pick a few
130375 // reasonable node kinds to bother checking on. These node kinds represent high level
130376 // constructs that we would expect to see commonly, but just at a far less frequent
130377 // interval.
130378 //
130379 // For example, in checker.ts (around 750k) we only have around 600 of these constructs.
130380 // That means we're calling back into the host around every 1.2k of the file we process.
130381 // Lib.d.ts has similar numbers.
130382 switch (kind) {
130383 case 261 /* SyntaxKind.ModuleDeclaration */:
130384 case 257 /* SyntaxKind.ClassDeclaration */:
130385 case 258 /* SyntaxKind.InterfaceDeclaration */:
130386 case 256 /* SyntaxKind.FunctionDeclaration */:
130387 case 226 /* SyntaxKind.ClassExpression */:
130388 case 213 /* SyntaxKind.FunctionExpression */:
130389 case 214 /* SyntaxKind.ArrowFunction */:
130390 cancellationToken.throwIfCancellationRequested();
130391 }
130392 }
130393 /* @internal */
130394 function getEncodedSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span) {
130395 var spans = [];

Callers 2

processElementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected