(singleRef *ast.Node)
| 2386 | } |
| 2387 | |
| 2388 | func (state *refState) shouldAddSingleReference(singleRef *ast.Node) bool { |
| 2389 | if !state.hasMatchingMeaning(singleRef) { |
| 2390 | return false |
| 2391 | } |
| 2392 | if state.options.use != referenceUseRename { |
| 2393 | return true |
| 2394 | } |
| 2395 | // Don't rename an import type `import("./module-name")` when renaming `name` in `export = name;` |
| 2396 | if !ast.IsIdentifier(singleRef) && !ast.IsImportOrExportSpecifier(singleRef.Parent) { |
| 2397 | return false |
| 2398 | } |
| 2399 | // At `default` in `import { default as x }` or `export { default as x }`, do add a reference, but do not rename. |
| 2400 | return !(ast.IsImportOrExportSpecifier(singleRef.Parent) && ast.ModuleExportNameIsDefault(singleRef)) |
| 2401 | } |
| 2402 | |
| 2403 | func (state *refState) hasMatchingMeaning(referenceLocation *ast.Node) bool { |
| 2404 | return getMeaningFromLocation(referenceLocation)&state.searchMeaning != 0 |
no test coverage detected