(referenceLocation, referenceSymbol, exportSpecifier, search, state, addReferencesHere, alwaysGetReferences)
| 138222 | getImportOrExportReferences(referenceLocation, referenceSymbol, search, state); |
| 138223 | } |
| 138224 | function getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, search, state, addReferencesHere, alwaysGetReferences) { |
| 138225 | ts.Debug.assert(!alwaysGetReferences || !!state.options.providePrefixAndSuffixTextForRename, "If alwaysGetReferences is true, then prefix/suffix text must be enabled"); |
| 138226 | var parent = exportSpecifier.parent, propertyName = exportSpecifier.propertyName, name = exportSpecifier.name; |
| 138227 | var exportDeclaration = parent.parent; |
| 138228 | var localSymbol = getLocalSymbolForExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, state.checker); |
| 138229 | if (!alwaysGetReferences && !search.includes(localSymbol)) { |
| 138230 | return; |
| 138231 | } |
| 138232 | if (!propertyName) { |
| 138233 | // Don't rename at `export { default } from "m";`. (but do continue to search for imports of the re-export) |
| 138234 | if (!(state.options.use === 2 /* FindReferencesUse.Rename */ && (name.escapedText === "default" /* InternalSymbolName.Default */))) { |
| 138235 | addRef(); |
| 138236 | } |
| 138237 | } |
| 138238 | else if (referenceLocation === propertyName) { |
| 138239 | // For `export { foo as bar } from "baz"`, "`foo`" will be added from the singleReferences for import searches of the original export. |
| 138240 | // For `export { foo as bar };`, where `foo` is a local, so add it now. |
| 138241 | if (!exportDeclaration.moduleSpecifier) { |
| 138242 | addRef(); |
| 138243 | } |
| 138244 | if (addReferencesHere && state.options.use !== 2 /* FindReferencesUse.Rename */ && state.markSeenReExportRHS(name)) { |
| 138245 | addReference(name, ts.Debug.checkDefined(exportSpecifier.symbol), state); |
| 138246 | } |
| 138247 | } |
| 138248 | else { |
| 138249 | if (state.markSeenReExportRHS(referenceLocation)) { |
| 138250 | addRef(); |
| 138251 | } |
| 138252 | } |
| 138253 | // For `export { foo as bar }`, rename `foo`, but not `bar`. |
| 138254 | if (!isForRenameWithPrefixAndSuffixText(state.options) || alwaysGetReferences) { |
| 138255 | var isDefaultExport = referenceLocation.originalKeywordKind === 88 /* SyntaxKind.DefaultKeyword */ |
| 138256 | || exportSpecifier.name.originalKeywordKind === 88 /* SyntaxKind.DefaultKeyword */; |
| 138257 | var exportKind = isDefaultExport ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; |
| 138258 | var exportSymbol = ts.Debug.checkDefined(exportSpecifier.symbol); |
| 138259 | var exportInfo = FindAllReferences.getExportInfo(exportSymbol, exportKind, state.checker); |
| 138260 | if (exportInfo) { |
| 138261 | searchForImportsOfExport(referenceLocation, exportSymbol, exportInfo, state); |
| 138262 | } |
| 138263 | } |
| 138264 | // At `export { x } from "foo"`, also search for the imported symbol `"foo".x`. |
| 138265 | if (search.comingFrom !== 1 /* ImportExport.Export */ && exportDeclaration.moduleSpecifier && !propertyName && !isForRenameWithPrefixAndSuffixText(state.options)) { |
| 138266 | var imported = state.checker.getExportSpecifierLocalTargetSymbol(exportSpecifier); |
| 138267 | if (imported) |
| 138268 | searchForImportedSymbol(imported, state); |
| 138269 | } |
| 138270 | function addRef() { |
| 138271 | if (addReferencesHere) |
| 138272 | addReference(referenceLocation, localSymbol, state); |
| 138273 | } |
| 138274 | } |
| 138275 | function getLocalSymbolForExportSpecifier(referenceLocation, referenceSymbol, exportSpecifier, checker) { |
| 138276 | return isExportSpecifierAlias(referenceLocation, exportSpecifier) && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier) || referenceSymbol; |
| 138277 | } |
no test coverage detected