(decl)
| 136390 | } |
| 136391 | return { importSearches: importSearches, singleReferences: singleReferences }; |
| 136392 | function handleImport(decl) { |
| 136393 | if (decl.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { |
| 136394 | if (isExternalModuleImportEquals(decl)) { |
| 136395 | handleNamespaceImportLike(decl.name); |
| 136396 | } |
| 136397 | return; |
| 136398 | } |
| 136399 | if (decl.kind === 79 /* SyntaxKind.Identifier */) { |
| 136400 | handleNamespaceImportLike(decl); |
| 136401 | return; |
| 136402 | } |
| 136403 | if (decl.kind === 200 /* SyntaxKind.ImportType */) { |
| 136404 | if (decl.qualifier) { |
| 136405 | var firstIdentifier = ts.getFirstIdentifier(decl.qualifier); |
| 136406 | if (firstIdentifier.escapedText === ts.symbolName(exportSymbol)) { |
| 136407 | singleReferences.push(firstIdentifier); |
| 136408 | } |
| 136409 | } |
| 136410 | else if (exportKind === 2 /* ExportKind.ExportEquals */) { |
| 136411 | singleReferences.push(decl.argument.literal); |
| 136412 | } |
| 136413 | return; |
| 136414 | } |
| 136415 | // Ignore if there's a grammar error |
| 136416 | if (decl.moduleSpecifier.kind !== 10 /* SyntaxKind.StringLiteral */) { |
| 136417 | return; |
| 136418 | } |
| 136419 | if (decl.kind === 272 /* SyntaxKind.ExportDeclaration */) { |
| 136420 | if (decl.exportClause && ts.isNamedExports(decl.exportClause)) { |
| 136421 | searchForNamedImport(decl.exportClause); |
| 136422 | } |
| 136423 | return; |
| 136424 | } |
| 136425 | var _a = decl.importClause || { name: undefined, namedBindings: undefined }, name = _a.name, namedBindings = _a.namedBindings; |
| 136426 | if (namedBindings) { |
| 136427 | switch (namedBindings.kind) { |
| 136428 | case 268 /* SyntaxKind.NamespaceImport */: |
| 136429 | handleNamespaceImportLike(namedBindings.name); |
| 136430 | break; |
| 136431 | case 269 /* SyntaxKind.NamedImports */: |
| 136432 | // 'default' might be accessed as a named import `{ default as foo }`. |
| 136433 | if (exportKind === 0 /* ExportKind.Named */ || exportKind === 1 /* ExportKind.Default */) { |
| 136434 | searchForNamedImport(namedBindings); |
| 136435 | } |
| 136436 | break; |
| 136437 | default: |
| 136438 | ts.Debug.assertNever(namedBindings); |
| 136439 | } |
| 136440 | } |
| 136441 | // `export =` might be imported by a default import if `--allowSyntheticDefaultImports` is on, so this handles both ExportKind.Default and ExportKind.ExportEquals. |
| 136442 | // If a default import has the same name as the default export, allow to rename it. |
| 136443 | // Given `import f` and `export default function f`, we will rename both, but for `import g` we will rename just that. |
| 136444 | if (name && (exportKind === 1 /* ExportKind.Default */ || exportKind === 2 /* ExportKind.ExportEquals */) && (!isForRename || name.escapedText === ts.symbolEscapedNameNoDefault(exportSymbol))) { |
| 136445 | var defaultImportAlias = checker.getSymbolAtLocation(name); |
| 136446 | addSearch(name, defaultImportAlias); |
| 136447 | } |
| 136448 | } |
| 136449 | /** |
no test coverage detected