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

Function getTypeReferenceDirectivesForSymbol

test/fixtures/snapshot/typescript.js:87402–87425  ·  view source on GitHub ↗
(symbol, meaning)

Source from the content-addressed store, hash-verified

87400 }
87401 // defined here to avoid outer scope pollution
87402 function getTypeReferenceDirectivesForSymbol(symbol, meaning) {
87403 // program does not have any files with type reference directives - bail out
87404 if (!fileToDirective || !isSymbolFromTypeDeclarationFile(symbol)) {
87405 return undefined;
87406 }
87407 // check what declarations in the symbol can contribute to the target meaning
87408 var typeReferenceDirectives;
87409 for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
87410 var decl = _a[_i];
87411 // check meaning of the local symbol to see if declaration needs to be analyzed further
87412 if (decl.symbol && decl.symbol.flags & meaning) {
87413 var file = ts.getSourceFileOfNode(decl);
87414 var typeReferenceDirective = fileToDirective.get(file.path);
87415 if (typeReferenceDirective) {
87416 (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective);
87417 }
87418 else {
87419 // found at least one entry that does not originate from type reference directive
87420 return undefined;
87421 }
87422 }
87423 }
87424 return typeReferenceDirectives;
87425 }
87426 function isSymbolFromTypeDeclarationFile(symbol) {
87427 // bail out if symbol does not have associated declarations (i.e. this is transient symbol created for property in binding pattern)
87428 if (!symbol.declarations) {

Calls 3

getMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected