@@ -241,7 +241,6 @@ import {
241
241
getAllJSDocTags,
242
242
getAllowSyntheticDefaultImports,
243
243
getAncestor,
244
- getAnyImportSyntax,
245
244
getAssignedExpandoInitializer,
246
245
getAssignmentDeclarationKind,
247
246
getAssignmentDeclarationPropertyAccessKind,
@@ -329,6 +328,7 @@ import {
329
328
getModeForUsageLocation,
330
329
getModifiers,
331
330
getModuleInstanceState,
331
+ getModuleSpecifierForImportOrExport,
332
332
getNameFromImportAttribute,
333
333
getNameFromIndexInfo,
334
334
getNameOfDeclaration,
@@ -1477,14 +1477,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1477
1477
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : ObjectFlags.FreshLiteral;
1478
1478
var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
1479
1479
1480
- var { hasVisibleDeclarations, isEntityNameVisible } = createEntityVisibilityChecker({
1480
+ var { hasVisibleDeclarations, isEntityNameVisible, collectLinkedAliases } = createEntityVisibilityChecker({
1481
1481
defaultSymbolAccessibility: SymbolAccessibility.NotAccessible,
1482
1482
isThisAccessible,
1483
1483
isDeclarationVisible,
1484
1484
markDeclarationAsVisible(declaration) {
1485
1485
getNodeLinks(declaration).isVisible = true;
1486
1486
},
1487
1487
resolveName,
1488
+ getTargetOfExportSpecifier,
1488
1489
});
1489
1490
var checkBinaryExpression = createCheckBinaryExpression();
1490
1491
var emitResolver = createResolver();
@@ -4168,23 +4169,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4168
4169
return exportDefaultSymbol;
4169
4170
}
4170
4171
4171
- function getModuleSpecifierForImportOrExport(node: ImportEqualsDeclaration | ImportClause | NamespaceImport | ImportOrExportSpecifier): Expression | undefined {
4172
- switch (node.kind) {
4173
- case SyntaxKind.ImportClause:
4174
- return node.parent.moduleSpecifier;
4175
- case SyntaxKind.ImportEqualsDeclaration:
4176
- return isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined;
4177
- case SyntaxKind.NamespaceImport:
4178
- return node.parent.parent.moduleSpecifier;
4179
- case SyntaxKind.ImportSpecifier:
4180
- return node.parent.parent.parent.moduleSpecifier;
4181
- case SyntaxKind.ExportSpecifier:
4182
- return node.parent.parent.moduleSpecifier;
4183
- default:
4184
- return Debug.assertNever(node);
4185
- }
4186
- }
4187
-
4188
4172
function reportNonDefaultExport(moduleSymbol: Symbol, node: ImportClause) {
4189
4173
if (moduleSymbol.exports?.has(node.symbol.escapedName)) {
4190
4174
error(
@@ -10367,48 +10351,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
10367
10351
return false;
10368
10352
}
10369
10353
10370
- function collectLinkedAliases(node: Identifier, setVisibility?: boolean): Node[] | undefined {
10371
- let exportSymbol: Symbol | undefined;
10372
- if (node.parent && node.parent.kind === SyntaxKind.ExportAssignment) {
10373
- exportSymbol = resolveName(node, node.escapedText, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false);
10374
- }
10375
- else if (node.parent.kind === SyntaxKind.ExportSpecifier) {
10376
- exportSymbol = getTargetOfExportSpecifier(node.parent as ExportSpecifier, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias);
10377
- }
10378
- let result: Node[] | undefined;
10379
- let visited: Set<number> | undefined;
10380
- if (exportSymbol) {
10381
- visited = new Set();
10382
- visited.add(getSymbolId(exportSymbol));
10383
- buildVisibleNodeList(exportSymbol.declarations);
10384
- }
10385
- return result;
10386
-
10387
- function buildVisibleNodeList(declarations: Declaration[] | undefined) {
10388
- forEach(declarations, declaration => {
10389
- const resultNode = getAnyImportSyntax(declaration) || declaration;
10390
- if (setVisibility) {
10391
- getNodeLinks(declaration).isVisible = true;
10392
- }
10393
- else {
10394
- result = result || [];
10395
- pushIfUnique(result, resultNode);
10396
- }
10397
-
10398
- if (isInternalModuleImportEqualsDeclaration(declaration)) {
10399
- // Add the referenced top container visible
10400
- const internalModuleReference = declaration.moduleReference as Identifier | QualifiedName;
10401
- const firstIdentifier = getFirstIdentifier(internalModuleReference);
10402
- const importSymbol = resolveName(declaration, firstIdentifier.escapedText, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
10403
- if (importSymbol && visited) {
10404
- if (tryAddToSet(visited, getSymbolId(importSymbol))) {
10405
- buildVisibleNodeList(importSymbol.declarations);
10406
- }
10407
- }
10408
- }
10409
- });
10410
- }
10411
- }
10412
10354
10413
10355
/**
10414
10356
* Push an entry on the type resolution stack. If an entry with the given target and the given property name
0 commit comments