mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
findAllReferences: Don't fail on broken re-export (#21841)
This commit is contained in:
@@ -914,7 +914,8 @@ namespace ts.FindAllReferences.Core {
|
||||
|
||||
// At `export { x } from "foo"`, also search for the imported symbol `"foo".x`.
|
||||
if (search.comingFrom !== ImportExport.Export && exportDeclaration.moduleSpecifier && !propertyName) {
|
||||
searchForImportedSymbol(state.checker.getExportSpecifierLocalTargetSymbol(exportSpecifier), state);
|
||||
const imported = state.checker.getExportSpecifierLocalTargetSymbol(exportSpecifier);
|
||||
if (imported) searchForImportedSymbol(imported, state);
|
||||
}
|
||||
|
||||
function addRef() {
|
||||
@@ -923,7 +924,7 @@ namespace ts.FindAllReferences.Core {
|
||||
}
|
||||
|
||||
function getLocalSymbolForExportSpecifier(referenceLocation: Identifier, referenceSymbol: Symbol, exportSpecifier: ExportSpecifier, checker: TypeChecker): Symbol {
|
||||
return isExportSpecifierAlias(referenceLocation, exportSpecifier) ? checker.getExportSpecifierLocalTargetSymbol(exportSpecifier) : referenceSymbol;
|
||||
return isExportSpecifierAlias(referenceLocation, exportSpecifier) && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier) || referenceSymbol;
|
||||
}
|
||||
|
||||
function isExportSpecifierAlias(referenceLocation: Identifier, exportSpecifier: ExportSpecifier): boolean {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /a.ts
|
||||
////export { [|{| "isWriteAccess": true, "isDefinition": true |}x|] };
|
||||
|
||||
verify.singleReferenceGroup("import x");
|
||||
@@ -0,0 +1,6 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /a.ts
|
||||
////export { [|{| "isWriteAccess": true, "isDefinition": true |}x|] } from "nonsense";
|
||||
|
||||
verify.singleReferenceGroup("import x");
|
||||
Reference in New Issue
Block a user