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

Function eachExportReference

test/fixtures/snapshot/typescript.js:137845–137870  ·  view source on GitHub ↗
(sourceFiles, checker, cancellationToken, exportSymbol, exportingModuleSymbol, exportName, isDefaultExport, cb)

Source from the content-addressed store, hash-verified

137843 }
137844 }
137845 function eachExportReference(sourceFiles, checker, cancellationToken, exportSymbol, exportingModuleSymbol, exportName, isDefaultExport, cb) {
137846 var importTracker = FindAllReferences.createImportTracker(sourceFiles, new ts.Set(sourceFiles.map(function (f) { return f.fileName; })), checker, cancellationToken);
137847 var _a = importTracker(exportSymbol, { exportKind: isDefaultExport ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */, exportingModuleSymbol: exportingModuleSymbol }, /*isForRename*/ false), importSearches = _a.importSearches, indirectUsers = _a.indirectUsers, singleReferences = _a.singleReferences;
137848 for (var _i = 0, importSearches_2 = importSearches; _i < importSearches_2.length; _i++) {
137849 var importLocation = importSearches_2[_i][0];
137850 cb(importLocation);
137851 }
137852 for (var _b = 0, singleReferences_2 = singleReferences; _b < singleReferences_2.length; _b++) {
137853 var singleReference = singleReferences_2[_b];
137854 if (ts.isIdentifier(singleReference) && ts.isImportTypeNode(singleReference.parent)) {
137855 cb(singleReference);
137856 }
137857 }
137858 for (var _c = 0, indirectUsers_2 = indirectUsers; _c < indirectUsers_2.length; _c++) {
137859 var indirectUser = indirectUsers_2[_c];
137860 for (var _d = 0, _e = getPossibleSymbolReferenceNodes(indirectUser, isDefaultExport ? "default" : exportName); _d < _e.length; _d++) {
137861 var node = _e[_d];
137862 // Import specifiers should be handled by importSearches
137863 var symbol = checker.getSymbolAtLocation(node);
137864 var hasExportAssignmentDeclaration = ts.some(symbol === null || symbol === void 0 ? void 0 : symbol.declarations, function (d) { return ts.tryCast(d, ts.isExportAssignment) ? true : false; });
137865 if (ts.isIdentifier(node) && !ts.isImportOrExportSpecifier(node.parent) && (symbol === exportSymbol || hasExportAssignmentDeclaration)) {
137866 cb(node);
137867 }
137868 }
137869 }
137870 }
137871 Core.eachExportReference = eachExportReference;
137872 function shouldAddSingleReference(singleRef, state) {
137873 if (!hasMatchingMeaning(singleRef, state))

Callers

nothing calls this directly

Calls 4

someMethod · 0.80
mapMethod · 0.65
cbFunction · 0.50

Tested by

no test coverage detected