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

Function getReferencedFileLocation

test/fixtures/snapshot/typescript.js:116359–116388  ·  view source on GitHub ↗
(getSourceFileByPath, ref)

Source from the content-addressed store, hash-verified

116357 ts.isReferenceFileLocation = isReferenceFileLocation;
116358 /*@internal*/
116359 function getReferencedFileLocation(getSourceFileByPath, ref) {
116360 var _a, _b, _c;
116361 var _d, _e, _f, _g;
116362 var file = ts.Debug.checkDefined(getSourceFileByPath(ref.file));
116363 var kind = ref.kind, index = ref.index;
116364 var pos, end, packageId, resolutionMode;
116365 switch (kind) {
116366 case ts.FileIncludeKind.Import:
116367 var importLiteral = getModuleNameStringLiteralAt(file, index);
116368 packageId = (_e = (_d = file.resolvedModules) === null || _d === void 0 ? void 0 : _d.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) === null || _e === void 0 ? void 0 : _e.packageId;
116369 if (importLiteral.pos === -1)
116370 return { file: file, packageId: packageId, text: importLiteral.text };
116371 pos = ts.skipTrivia(file.text, importLiteral.pos);
116372 end = importLiteral.end;
116373 break;
116374 case ts.FileIncludeKind.ReferenceFile:
116375 (_a = file.referencedFiles[index], pos = _a.pos, end = _a.end);
116376 break;
116377 case ts.FileIncludeKind.TypeReferenceDirective:
116378 (_b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end, resolutionMode = _b.resolutionMode);
116379 packageId = (_g = (_f = file.resolvedTypeReferenceDirectiveNames) === null || _f === void 0 ? void 0 : _f.get(ts.toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) === null || _g === void 0 ? void 0 : _g.packageId;
116380 break;
116381 case ts.FileIncludeKind.LibReferenceDirective:
116382 (_c = file.libReferenceDirectives[index], pos = _c.pos, end = _c.end);
116383 break;
116384 default:
116385 return ts.Debug.assertNever(kind);
116386 }
116387 return { file: file, pos: pos, end: end, packageId: packageId };
116388 }
116389 ts.getReferencedFileLocation = getReferencedFileLocation;
116390 /**
116391 * Determines if program structure is upto date or needs to be recreated

Callers 3

createProgramFunction · 0.85

Calls 4

getSourceFileByPathFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…